Support Questions

Find answers, ask questions, and share your expertise

List all the installed mPacks in Ambari

avatar
Super Guru

How can I list all the installed Mpacks in ambari. I want to install few mPacks and uninstall mPack asks for the mpack name. I want to check all the installed mpacks and uninstall few.

Thanks,

Aditya

1 ACCEPTED SOLUTION

avatar
Super Guru

Found out the solution. This is not a single line command though

1) Find out the mpack.staging.path by running

cat /etc/ambari-server/conf/ambari.properties | grep -i mpack 

2) Go to the mpack.staging.path directory (default is : /var/lib/ambari-server/resources/mpacks )

cd /var/lib/ambari-server/resources/mpacks

3) Iterate through all the directories in the mpack staging directory excpet the "cache" directory and read the mpack.json in each directory

The mpack.json has the name of the mPack.

You can write a small script to iterate through the directories and print all the mpack names

Thanks,

Aditya

View solution in original post

4 REPLIES 4

avatar
@Aditya Sirna

Try listing the installed packages using yum command:
yum list installed | grep mpack

avatar
Super Guru

Hi @Sindhu,

I'm sorry, my question was not so clear. I was trying to list all the installed mPacks in ambari which we usually install using

ambari-server install-mpack <args>

avatar
Super Guru

Found out the solution. This is not a single line command though

1) Find out the mpack.staging.path by running

cat /etc/ambari-server/conf/ambari.properties | grep -i mpack 

2) Go to the mpack.staging.path directory (default is : /var/lib/ambari-server/resources/mpacks )

cd /var/lib/ambari-server/resources/mpacks

3) Iterate through all the directories in the mpack staging directory excpet the "cache" directory and read the mpack.json in each directory

The mpack.json has the name of the mPack.

You can write a small script to iterate through the directories and print all the mpack names

Thanks,

Aditya

avatar
New Contributor

brutal I know but a oneliner

cd $(cat /etc/ambari-server/conf/ambari.properties | grep -i mpack|awk -F'=' '{print$2}') ; ls -l|grep -v cache |grep -v mpacks_replay.log |grep -v total |awk '{print$9}' |xargs

 

The last bit is handy if you to create a ruby fact out of the data