Hi,
I've been implementing a simple Service extensions for Ambari 1.7.
It appears that Script.get_config() called inside the "status" method of
the master component does not initialize the config files (e.g.
my-site.xml) defined in the metainfo.xml.
An attempt to access the config['configuration']['my-site'] inside the
status method throws the following error:
>>> Configuration parameter \'my-site\' was not found in configurations
dictionary!'
But the same configuration properties are accessible inside the
"initialize", "start" and "stop" though.
Is there something special for the 'status' method's configuration
initialization or am i overlooking some detail?
I've tried to extract a snipped of my service below.
my-site.xml (under SERVICE/configuration)
------------------------------------------------------
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>my.user</name>
<value>someuser</value>
<description></description>
</property>
</configuration>
params.py (under SERVICE/package/scripts)
-------------------------------------------------------
from resource_management import *
config = Script.get_config()
# My user
my_user = config['configurations']['my-site']['my.user']
master.py
--------------------------------------------------------
from resource_management import *
class MyMaster(Script):
def install(self, env):
import os
import params
env.set_params(params)
self.configure(env)
# WORKS and params.my_user is properly resolved
Execute(format('.....'), user=params.my_user, timeout=300)
def configure(self, env):
import params
env.set_params(params)
if not self.user_exists():
#Create user
def start(self, env):
import params
env.set_params(params)
self.configure(env)
# WORKS
Execute(format('....'), user=params.my_user, timeout=300)
def stop(self, env):
import params
env.set_params(params)
# WORKS
Execute(format('.... '), user=params.my_user, timeout=300)
def status(self, env):
import params
env.set_params(params)
# FAILS with: "Configuration parameter \'my-site\' was not
found in configurations dictionary!'"
Execute(format('..... | grep RUNNING '),
user=params.my_user, logoutput=True, timeout=300)
if __name__ == '__main__':
MyMaster().execute()
Thanks,
Christian
--
Christian Tzolov <http://www.linkedin.com/in/tzolov> | Solution Architect,
EMEA Practice Team | Pivotal <http://pivotal.io/>
[email protected]|+31610285517