summaryrefslogtreecommitdiff
path: root/lib/chef/chef_fs/knife.rb
diff options
context:
space:
mode:
authorJohn Keiser <jkeiser@opscode.com>2013-06-13 09:39:53 -0700
committerJohn Keiser <jkeiser@opscode.com>2013-09-12 23:05:48 -0700
commit1b9a7e73b6e7a017bc4044da054c690a77898290 (patch)
tree1a940a0a43f6868c9efc2fcc2dbd19edadb5f233 /lib/chef/chef_fs/knife.rb
parent757c3ee44715726fb6e7e3f167cea5320a6fb0f4 (diff)
downloadchef-1b9a7e73b6e7a017bc4044da054c690a77898290.tar.gz
Support chef_server_url 'local' in all knife-essentials commands
Diffstat (limited to 'lib/chef/chef_fs/knife.rb')
-rw-r--r--lib/chef/chef_fs/knife.rb28
1 files changed, 21 insertions, 7 deletions
diff --git a/lib/chef/chef_fs/knife.rb b/lib/chef/chef_fs/knife.rb
index 673e2c9ead..860fdbca48 100644
--- a/lib/chef/chef_fs/knife.rb
+++ b/lib/chef/chef_fs/knife.rb
@@ -98,16 +98,18 @@ class Chef
end
def pattern_args_from(args)
+ args.map { |arg| pattern_arg_from(arg) }
+ end
+
+ def pattern_arg_from(arg)
# TODO support absolute file paths and not just patterns? Too much?
# Could be super useful in a world with multiple repo paths
- args.map do |arg|
- if !@chef_fs_config.base_path && !Chef::ChefFS::PathUtils.is_absolute?(arg)
- # Check if chef repo path is specified to give a better error message
- 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)
+ if !@chef_fs_config.base_path && !Chef::ChefFS::PathUtils.is_absolute?(arg)
+ # Check if chef repo path is specified to give a better error message
+ 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)
end
def format_path(entry)
@@ -159,6 +161,18 @@ EOM
end
def start_local_server
+ begin
+ require 'chef_zero/server'
+ rescue LoadError
+ STDERR.puts <<EOM
+ ERROR: chef-zero must be installed to use local-server mode! To install:
+
+ gem install chef-zero
+
+EOM
+ exit(1)
+ end
+ require 'chef/chef_fs/chef_fs_data_store'
server_options = {}
server_options[:data_store] = ChefFSChefFSDataStore.new(local_fs)
server_options[:log_level] = Chef::Log.level