What are your import statements? The "format" function provided by Ambari's 
common library has a naming conflict with a default python function named 
"format". If you don't import the right one, your format("...") command will 
fail silently. Make sure you are importing:

from resource_management.libraries.functions.format import format

On Apr 18, 2016, at 4:27 AM, Souvik Sarkhel 
<[email protected]<mailto:[email protected]>> wrote:

Hi All,

I have created a custom service for Zookeeper and using Ambari 2.1.0 .In status 
function of master.py if its defined in this way:
def status(self, env):
        config = Script.get_config()
        zkDataDir = config['configurations']['zoo']['dataDir']
        print 'Status of the Zookeeper Master'
        print *****************************************
        print zkDataDir
        dummy_master_pid_file = format("{zkDataDir}/zookeeper_server.pid")
        check_process_status(dummy_master_pid_file)

Ambari is always showing status of application stopped but when I provide the 
constant path of the pid file for example:

dummy_master_pid_file = "/usr/share/zookeeper/tmp/zookeeper_server.pid")

it starts working perfectly and Ambari is able to correctly show the status of 
the application. I need a variable pid file instead of a constant one. I would 
to thankful if someone suggest me a way out.

Thanking you in advance

--
Souvik Sarkhel

Reply via email to