summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Keiser <jkeiser@opscode.com>2013-06-06 08:34:58 -0700
committerJohn Keiser <jkeiser@opscode.com>2013-06-07 13:12:36 -0700
commit8da7858b6020ba72b9ee9a023e5f744fb35ef393 (patch)
tree0f75572006f23a042419252ca5a81884b08b0880
parentfa45b5705e6c3ed34ddd04da349dd7acecae583c (diff)
downloadchef-8da7858b6020ba72b9ee9a023e5f744fb35ef393.tar.gz
Smooth out bad cookbook_path defaults from chef
-rw-r--r--lib/chef/chef_fs/config.rb18
-rw-r--r--lib/chef/chef_fs/knife.rb2
2 files changed, 12 insertions, 8 deletions
diff --git a/lib/chef/chef_fs/config.rb b/lib/chef/chef_fs/config.rb
index 4a8ca26ee8..71a32f91eb 100644
--- a/lib/chef/chef_fs/config.rb
+++ b/lib/chef/chef_fs/config.rb
@@ -147,14 +147,11 @@ class Chef
end
def configure_repo_paths
- # Infer chef_repo_path from cookbook_path if not speciifed
- if !@chef_config[:chef_repo_path]
- if @chef_config[:cookbook_path]
- @chef_config[:chef_repo_path] = Array(@chef_config[:cookbook_path]).flatten.map { |path| File.expand_path('..', path) }
- end
- end
-
# Smooth out some (for now) inappropriate defaults set by Chef
+ if @chef_config[:cookbook_path] == [ @chef_config.platform_specific_path("/var/chef/cookbooks"),
+ @chef_config.platform_specific_path("/var/chef/site-cookbooks") ]
+ @chef_config[:cookbook_path] = nil
+ end
if @chef_config[:data_bag_path] == @chef_config.platform_specific_path('/var/chef/data_bags')
@chef_config[:data_bag_path] = nil
end
@@ -165,6 +162,13 @@ class Chef
@chef_config[:role_path] = nil
end
+ # Infer chef_repo_path from cookbook_path if not speciifed
+ if !@chef_config[:chef_repo_path]
+ if @chef_config[:cookbook_path]
+ @chef_config[:chef_repo_path] = Array(@chef_config[:cookbook_path]).flatten.map { |path| File.expand_path('..', path) }
+ end
+ end
+
# Default to getting *everything* from the server.
if !@chef_config[:repo_mode]
if @chef_config[:chef_server_url] =~ /\/+organizations\/.+/
diff --git a/lib/chef/chef_fs/knife.rb b/lib/chef/chef_fs/knife.rb
index 46b30cacbe..ce621d2231 100644
--- a/lib/chef/chef_fs/knife.rb
+++ b/lib/chef/chef_fs/knife.rb
@@ -98,7 +98,7 @@ class Chef
ui.error("Attempt to use relative path '#{arg}' when current directory is outside the repository path")
exit(1)
end
- Chef::ChefFS::FilePattern::relative_to(@chef_fs_config.base_path, arg)
+ Chef::ChefFS::FilePattern.relative_to(@chef_fs_config.base_path, arg)
end
end