是否可以在python脚本中调用salt-call state.highstate
(命令)并知道它何时完成? (全自动(Masterless))
答案 0 :(得分:0)
看起来可能需要编写returner,将结果存储在文件或其他内容
并使用
调用该命令subprocess.check_output("salt-call state.highstate --returner=myReturner",shell=True)
#if the command blocks and does not return immediatly at this point it is finished
#if the command does not block you will have to check for the file that your returner creates until it exists
while not os.path.exists("my_returner_output.txt"):
time.sleep(1)
print "OK COMMAND COMPLETE"