我可以运行:蟒蛇厨师在控制台的工作不是在脚本
import chef
chef.autoconfigure()
for node in chef.Node.list():
if "auto" in node.lower():
print "deleting node " + node
nodeObj = chef.Node(node)
nodeObj.delete()
在控制台
直接,但是当我尝试运行它作为一个脚本:python2.7 test.py
我收到以下错误:
Traceback (most recent call last):
File "test.py", line 38, in <module>
for node in chef.Node.list():
File "/usr/local/lib/python2.7/site-packages/chef/base.py", line 86, in list
names = [name for name, url in api[cls.url].iteritems()]
TypeError: 'NoneType' object has no attribute '__getitem__'
我用控制台验证
>>> chef.__path__
['/usr/local/lib/python2.7/site-packages/chef']
因此,机器是一样的,蟒蛇的版本是一样的, nd模块是一样的。为什么这可能发生?