我使用salt
,当我运行exec_state('update_salt')
时,会引发以下异常(下面的代码):
File "/usr/lib/python2.6/site-packages/salt/client/__init__.py", line 1582, in __init__
caller = salt.client.Caller()
File "/usr/lib/python2.6/site-packages/salt/minion.py", line 283, in __init__
for key, val in data.items():
File "/usr/lib/python2.6/site-packages/salt/minion.py", line 300, in gen_modules
File "/usr/lib/python2.6/site-packages/salt/loader.py", line 286, in render
opts,
salt.exceptions.LoaderError: The renderer yaml_jinja is unavailable, this error is often because the needed software is unavailable
我尝试通过try和catch块来处理它:
try:
result = exec_state('update_salt')
if not result:
return False
except:
print "got it.."
result = exec_state('update_salt_light')
if not result:
return False
但它在第一次尝试时仍然失败,并且没有到达异常块(没有打印)。为什么呢?