tobami / littlechef

Cook with Chef without a Chef Server
Apache License 2.0
472 stars 71 forks source link

env.sync_packages_dest_dir is undefined when using littlechef as library #204

Closed thekorn closed 10 years ago

thekorn commented 10 years ago

when running

import littlechef.runner as lc
lc.chef.sync_node(mynode)

we get an AttributeError

[...]
  File "/home/markus/devel/git/devops/imgdeploy/fabfile.py", line 1089, in _chef_apply_role
    chef.sync_node(node)
  File "/home/markus/devel/git/littlechef/littlechef/chef.py", line 90, in sync_node
    _synchronize_node(filepath, node)
  File "/home/markus/devel/git/littlechef/littlechef/chef.py", line 139, in _synchronize_node
    if env.sync_packages_dest_dir and env.sync_packages_local_dir:
  File "/home/markus/devel/.virtualenvs/DEVOPS11/local/lib/python2.7/site-packages/Fabric-1.8.3-py2.7.egg/fabric/utils.py", line 184, in __getattr__
    raise AttributeError(key)
AttributeError: sync_packages_dest_dir

This is because sync_packages_dest_dir is only defined in runner._readconfig() which is not executed when importing runner.py

tobami commented 10 years ago

:+1: