fix shaker-spot execution
A previous commit introduced a feature to specify the directory the agent uses for shell class execution via a cfg entry, agent_dir. However this addition introduced an error when using shaker-spot: oslo_config.cfg.NoSuchOptError: no such option agent_dir in group [DEFAULT] This commit fixes shaker-spot while still supporting the agent_dir feature Change-Id: I7cfb87ba406e177121e7914225857937a19502e4
This commit is contained in:
parent
159bd35d2f
commit
a2adff395f
@ -61,10 +61,6 @@ def send_reply(socket, agent_id, result):
|
|||||||
def run_command(command):
|
def run_command(command):
|
||||||
command_stdout, command_stderr = None, None
|
command_stdout, command_stderr = None, None
|
||||||
start = time.time()
|
start = time.time()
|
||||||
agent_dir = cfg.CONF.agent_dir
|
|
||||||
|
|
||||||
if agent_dir:
|
|
||||||
utils.mkdir_tree(agent_dir)
|
|
||||||
|
|
||||||
if command['type'] == 'program':
|
if command['type'] == 'program':
|
||||||
command_stdout, command_stderr = processutils.execute(
|
command_stdout, command_stderr = processutils.execute(
|
||||||
@ -72,7 +68,8 @@ def run_command(command):
|
|||||||
|
|
||||||
elif command['type'] == 'script':
|
elif command['type'] == 'script':
|
||||||
if 'agent_dir' in cfg.CONF:
|
if 'agent_dir' in cfg.CONF:
|
||||||
file_name = tempfile.mktemp(dir="%s" % agent_dir)
|
utils.mkdir_tree(cfg.CONF.agent_dir)
|
||||||
|
file_name = tempfile.mktemp(dir="%s" % cfg.CONF.agent_dir)
|
||||||
else:
|
else:
|
||||||
file_name = tempfile.mktemp()
|
file_name = tempfile.mktemp()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user