-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upstream berskfile support #231
Changes from 4 commits
24a8922
224d905
dc34e8d
3849aed
c19f50e
a54d393
db8792d
12ae027
9a9a267
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,7 @@ | |
|
||
__testing__ = False | ||
|
||
env.berksfile_cookbooks_directory="" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There should be spaces to both sides of the equality sign. Also a better place to put this statement would be further up, for example right below |
||
|
||
@hosts('setup') | ||
def new_kitchen(): | ||
|
@@ -123,6 +124,9 @@ def nodes_with_tag(tag): | |
@hosts('setup') | ||
def node(*nodes): | ||
"""Selects and configures a list of nodes. 'all' configures all nodes""" | ||
if env.berksfile: | ||
chef.ensure_berksfile_cookbooks_are_installed() | ||
|
||
chef.build_node_data_bag() | ||
if not len(nodes) or nodes[0] == '': | ||
abort('No node was given') | ||
|
@@ -156,7 +160,7 @@ def node(*nodes): | |
with settings(): | ||
execute(_node_runner) | ||
chef.remove_local_node_data_bag() | ||
|
||
chef.cleanup_berksfile_cookbooks() | ||
|
||
def _configure_fabric_for_platform(platform): | ||
"""Configures fabric for a specific platform""" | ||
|
@@ -533,16 +537,20 @@ def _readconfig(): | |
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError) as e: | ||
env.berksfile = None | ||
else: | ||
env.cookbook_search_paths=[] | ||
try: | ||
env.berksfile_cookbooks_directory = config.get('kitchen', 'berksfile_cookbooks_directory') | ||
littlechef.cookbook_paths.append(env.berksfile_cookbooks_directory) | ||
env.cookbook_search_paths.append(env.berksfile_cookbooks_directory)+'/berks_cookbooks' | ||
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError) as e: | ||
if env.berksfile: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would put this if before trying to set env.berksfile_cookbooks_directory. |
||
env.berksfile_cookbooks_directory = tempfile.mkdtemp('littlechef-berks') | ||
littlechef.cookbook_paths.append(env.berksfile_cookbooks_directory) | ||
env.berksfile_cookbooks_directory = tempfile.mkdtemp('littlechef-berks')+'/berks_cookbooks' | ||
env.cookbook_search_paths.append(env.berksfile_cookbooks_directory) | ||
else: | ||
env.berksfile_cookbooks_directory = None | ||
chef.ensure_berksfile_cookbooks_are_installed() | ||
|
||
#print("Setting env.berksfile_cookbooks_directory = {0}".format(env.berksfile_cookbooks_directory)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Forgot a print statement here |
||
# Add defined cookbooks directories to search path | ||
env.cookbook_search_paths+=cookbook_paths | ||
|
||
# Upload Directory | ||
try: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is cookbook_search_paths for? I didn't find where it is initialized anywere...
OK, sorry, in
_readconfig
. But why not usecookbook_paths
? It can be directly modified in the same way to append berksfile directoriesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will have a look at it today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I wrote this code I thought that it would be better to have one main arrays for all cookbook paths where others will be merged, because cookbook_paths were user customizable.
So I use cookbook_paths as place where to look for non berkshelf cookbooks and berksfile_cookbooks_directory as a place where I will berks vendor cookbooks. Then I will add both directories to one array and use them later.