You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ambari.apache.org by Christopher Jackson <ja...@gmail.com> on 2015/12/09 21:53:18 UTC

Checking installed services.

Hi All,

Does the core ambari.resource.management python scripts provide any mechanism for checking if a given service is installed? For instance how would I go about setting a flag whether or not Knox is installed in the params.py file for a custom service? 

Regards,
Christopher Jackson

Re: Checking installed services.

Posted by Bhuvnesh Chaudhary <bc...@pivotal.io>.
Cool. Well config['clusterHostInfo'] is used pretty extensively at several
places to get the related info, so you might want to use.

Thanks,
Bhuvnesh Chaudhary
Email: bchau <bc...@gopivotal.com>dhary@pivotal.io
Desk: +1-650-846-1696 | Mobile: +1-973-906-6976

On Wed, Dec 9, 2015 at 4:47 PM, Christopher Jackson <
jackson.christopher.lee@gmail.com> wrote:

> Thanks Bhuvnesh,
>
> I was actually already doing something similar to what you suggested:
>
> has_knox = 'topology' in config['configurations’]
>
> I was hoping there was a way that felt less hackish.
>
> Regards,
>
> Christopher Jackson
>
> On Dec 9, 2015, at 5:37 PM, Bhuvnesh Chaudhary <bc...@pivotal.io>
> wrote:
>
> Hello Christopher,
>
> You can check the key clusterHostInfo and examine its content if they have
> any component for Knox (knox_gateway_hosts). In params.py you can probably
> use the below.
> config = Script.get_config()
> config['clusterHostInfo']
>
> Example of config['clusterHostInfo'] with knox during start of the
> component.
>
> {'snamenode_host': ['c6402.ambari.apache.org'], 'nm_hosts': ['
> c6402.ambari.apache.org', 'c6403.ambari.apache.org', '
> c6401.ambari.apache.org'], 'app_timeline_server_hosts': ['
> c6402.ambari.apache.org'], 'hawqsegment_hosts': ['c6401.ambari.apache.org'],
> 'all_ping_ports': ['8670', '8670', '8670'], 'rm_host': ['
> c6402.ambari.apache.org', 'c6401.ambari.apache.org'], 'all_hosts': ['
> c6402.ambari.apache.org', 'c6403.ambari.apache.org', '
> c6401.ambari.apache.org'], 'slave_hosts': ['c6402.ambari.apache.org', '
> c6403.ambari.apache.org', 'c6401.ambari.apache.org'], 'all_racks':
> ['/default-rack', '/default-rack', '/default-rack'], 'all_ipv4_ips':
> ['192.168.64.102', '192.168.64.103', '192.168.64.101'], 'hs_host': ['
> c6402.ambari.apache.org'], *'knox_gateway_hosts':
> ['c6401.ambari.apache.org <http://c6401.ambari.apache.org/>']*,
> 'hawqmaster_hosts': ['c6403.ambari.apache.org'], 'namenode_host': ['
> c6401.ambari.apache.org'], 'pxf_hosts': ['c6402.ambari.apache.org', '
> c6403.ambari.apache.org', 'c6401.ambari.apache.org'],
> 'ambari_server_host': ['c6401.ambari.apache.org'], 'zookeeper_hosts': ['
> c6402.ambari.apache.org', 'c6403.ambari.apache.org', '
> c6401.ambari.apache.org'], 'hawqstandby_hosts': ['c6402.ambari.apache.org
> ']}
>
> Thanks,
> Bhuvnesh Chaudhary
> Email: bchau <bc...@gopivotal.com>dhary@pivotal.io
> Desk: +1-650-846-1696 | Mobile: +1-973-906-6976
>
> On Wed, Dec 9, 2015 at 12:53 PM, Christopher Jackson <
> jackson.christopher.lee@gmail.com> wrote:
>
>> Hi All,
>>
>> Does the core ambari.resource.management python scripts provide any
>> mechanism for checking if a given service is installed? For instance how
>> would I go about setting a flag whether or not Knox is installed in the
>> params.py file for a custom service?
>>
>> Regards,
>> Christopher Jackson
>
>
>
>

Re: Checking installed services.

Posted by Christopher Jackson <ja...@gmail.com>.
Thanks Bhuvnesh,

I was actually already doing something similar to what you suggested:

has_knox = 'topology' in config['configurations’]

I was hoping there was a way that felt less hackish. 

Regards,

Christopher Jackson

> On Dec 9, 2015, at 5:37 PM, Bhuvnesh Chaudhary <bc...@pivotal.io> wrote:
> 
> Hello Christopher,
> 
> You can check the key clusterHostInfo and examine its content if they have any component for Knox (knox_gateway_hosts). In params.py you can probably use the below.
> config = Script.get_config()
> config['clusterHostInfo']
> 
> Example of config['clusterHostInfo'] with knox during start of the component.
> 
> {'snamenode_host': ['c6402.ambari.apache.org <http://c6402.ambari.apache.org/>'], 'nm_hosts': ['c6402.ambari.apache.org <http://c6402.ambari.apache.org/>', 'c6403.ambari.apache.org <http://c6403.ambari.apache.org/>', 'c6401.ambari.apache.org <http://c6401.ambari.apache.org/>'], 'app_timeline_server_hosts': ['c6402.ambari.apache.org <http://c6402.ambari.apache.org/>'], 'hawqsegment_hosts': ['c6401.ambari.apache.org <http://c6401.ambari.apache.org/>'], 'all_ping_ports': ['8670', '8670', '8670'], 'rm_host': ['c6402.ambari.apache.org <http://c6402.ambari.apache.org/>', 'c6401.ambari.apache.org <http://c6401.ambari.apache.org/>'], 'all_hosts': ['c6402.ambari.apache.org <http://c6402.ambari.apache.org/>', 'c6403.ambari.apache.org <http://c6403.ambari.apache.org/>', 'c6401.ambari.apache.org <http://c6401.ambari.apache.org/>'], 'slave_hosts': ['c6402.ambari.apache.org <http://c6402.ambari.apache.org/>', 'c6403.ambari.apache.org <http://c6403.ambari.apache.org/>', 'c6401.ambari.apache.org <http://c6401.ambari.apache.org/>'], 'all_racks': ['/default-rack', '/default-rack', '/default-rack'], 'all_ipv4_ips': ['192.168.64.102', '192.168.64.103', '192.168.64.101'], 'hs_host': ['c6402.ambari.apache.org <http://c6402.ambari.apache.org/>'], 'knox_gateway_hosts': ['c6401.ambari.apache.org <http://c6401.ambari.apache.org/>'], 'hawqmaster_hosts': ['c6403.ambari.apache.org <http://c6403.ambari.apache.org/>'], 'namenode_host': ['c6401.ambari.apache.org <http://c6401.ambari.apache.org/>'], 'pxf_hosts': ['c6402.ambari.apache.org <http://c6402.ambari.apache.org/>', 'c6403.ambari.apache.org <http://c6403.ambari.apache.org/>', 'c6401.ambari.apache.org <http://c6401.ambari.apache.org/>'], 'ambari_server_host': ['c6401.ambari.apache.org <http://c6401.ambari.apache.org/>'], 'zookeeper_hosts': ['c6402.ambari.apache.org <http://c6402.ambari.apache.org/>', 'c6403.ambari.apache.org <http://c6403.ambari.apache.org/>', 'c6401.ambari.apache.org <http://c6401.ambari.apache.org/>'], 'hawqstandby_hosts': ['c6402.ambari.apache.org <http://c6402.ambari.apache.org/>']}
> 
> Thanks,
> Bhuvnesh Chaudhary
> Email: bchau <ma...@gopivotal.com>dhary@pivotal.io <ma...@pivotal.io> 
> Desk: +1-650-846-1696 | Mobile: +1-973-906-6976
> 
> On Wed, Dec 9, 2015 at 12:53 PM, Christopher Jackson <jackson.christopher.lee@gmail.com <ma...@gmail.com>> wrote:
> Hi All,
> 
> Does the core ambari.resource.management python scripts provide any mechanism for checking if a given service is installed? For instance how would I go about setting a flag whether or not Knox is installed in the params.py file for a custom service?
> 
> Regards,
> Christopher Jackson
> 


Re: Checking installed services.

Posted by Bhuvnesh Chaudhary <bc...@pivotal.io>.
Hello Christopher,

You can check the key clusterHostInfo and examine its content if they have
any component for Knox (knox_gateway_hosts). In params.py you can probably
use the below.
config = Script.get_config()
config['clusterHostInfo']

Example of config['clusterHostInfo'] with knox during start of the
component.

{'snamenode_host': ['c6402.ambari.apache.org'], 'nm_hosts': ['
c6402.ambari.apache.org', 'c6403.ambari.apache.org', '
c6401.ambari.apache.org'], 'app_timeline_server_hosts': ['
c6402.ambari.apache.org'], 'hawqsegment_hosts': ['c6401.ambari.apache.org'],
'all_ping_ports': ['8670', '8670', '8670'], 'rm_host': ['
c6402.ambari.apache.org', 'c6401.ambari.apache.org'], 'all_hosts': ['
c6402.ambari.apache.org', 'c6403.ambari.apache.org', '
c6401.ambari.apache.org'], 'slave_hosts': ['c6402.ambari.apache.org', '
c6403.ambari.apache.org', 'c6401.ambari.apache.org'], 'all_racks':
['/default-rack', '/default-rack', '/default-rack'], 'all_ipv4_ips':
['192.168.64.102', '192.168.64.103', '192.168.64.101'], 'hs_host': ['
c6402.ambari.apache.org'], *'knox_gateway_hosts': ['c6401.ambari.apache.org
<http://c6401.ambari.apache.org>']*, 'hawqmaster_hosts': ['
c6403.ambari.apache.org'], 'namenode_host': ['c6401.ambari.apache.org'],
'pxf_hosts': ['c6402.ambari.apache.org', 'c6403.ambari.apache.org', '
c6401.ambari.apache.org'], 'ambari_server_host': ['c6401.ambari.apache.org'],
'zookeeper_hosts': ['c6402.ambari.apache.org', 'c6403.ambari.apache.org', '
c6401.ambari.apache.org'], 'hawqstandby_hosts': ['c6402.ambari.apache.org']}

Thanks,
Bhuvnesh Chaudhary
Email: bchau <bc...@gopivotal.com>dhary@pivotal.io
Desk: +1-650-846-1696 | Mobile: +1-973-906-6976

On Wed, Dec 9, 2015 at 12:53 PM, Christopher Jackson <
jackson.christopher.lee@gmail.com> wrote:

> Hi All,
>
> Does the core ambari.resource.management python scripts provide any
> mechanism for checking if a given service is installed? For instance how
> would I go about setting a flag whether or not Knox is installed in the
> params.py file for a custom service?
>
> Regards,
> Christopher Jackson