sebastien / cuisine

Chef-like functionality for Fabric

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NameError: name 'env' is not defined

prof7bit opened this issue · comments

The "documentation" suggests that I can import cuisine as a drop in replacement for fabric.api, but it seems this is not working:

Example file:

from cuisine import *

env.hosts = ['pruefautomat']
env.user = 'bernd'

def foo():
    run('whoami')
$ fab foo
Traceback (most recent call last):
  File "/home/bernd/.local/lib/python2.7/site-packages/fabric/main.py", line 667, in main
    docstring, callables, default = load_fabfile(fabfile)
  File "/home/bernd/.local/lib/python2.7/site-packages/fabric/main.py", line 168, in load_fabfile
    imported = importer(os.path.splitext(fabfile)[0])
  File "/home/bernd/tmp/cuisine/fabfile.py", line 3, in <module>
    env.hosts = ['pruefautomat']
NameError: name 'env' is not defined

So this is either a bug or a documentation problem. Am I supposed to import both?

Right now you need to import env from fabric.api, but I'm adding an explicit import so that your example works, as it makes sense.