knife-essentials 1.2.1 → 1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/chef_fs/config.rb +15 -5
- data/lib/chef_fs/knife.rb +2 -0
- data/lib/chef_fs/version.rb +1 -1
- data/spec/integration/redirection_spec.rb +1 -0
- metadata +1 -1
data/lib/chef_fs/config.rb
CHANGED
@@ -100,7 +100,13 @@ module ChefFS
|
|
100
100
|
|
101
101
|
# The current directory, relative to server root
|
102
102
|
def base_path
|
103
|
-
@base_path ||=
|
103
|
+
@base_path ||= begin
|
104
|
+
if @chef_config[:chef_repo_path]
|
105
|
+
server_path(File.expand_path(@cwd))
|
106
|
+
else
|
107
|
+
nil
|
108
|
+
end
|
109
|
+
end
|
104
110
|
end
|
105
111
|
|
106
112
|
# Print the given server path, relative to the current directory
|
@@ -118,14 +124,18 @@ module ChefFS
|
|
118
124
|
server_path
|
119
125
|
end
|
120
126
|
|
127
|
+
def require_chef_repo_path
|
128
|
+
if !@chef_config[:chef_repo_path]
|
129
|
+
Chef::Log.error("Must specify either chef_repo_path or cookbook_path in Chef config file")
|
130
|
+
exit(1)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
121
134
|
private
|
122
135
|
|
123
136
|
def object_paths
|
124
137
|
@object_paths ||= begin
|
125
|
-
|
126
|
-
Chef::Log.error("Must specify either chef_repo_path or cookbook_path in Chef config file")
|
127
|
-
exit(1)
|
128
|
-
end
|
138
|
+
require_chef_repo_path
|
129
139
|
|
130
140
|
result = {}
|
131
141
|
case @chef_config[:repo_mode]
|
data/lib/chef_fs/knife.rb
CHANGED
@@ -94,6 +94,8 @@ module ChefFS
|
|
94
94
|
# Could be super useful in a world with multiple repo paths
|
95
95
|
args.map do |arg|
|
96
96
|
if !@chef_fs_config.base_path && !ChefFS::PathUtils.is_absolute?(arg)
|
97
|
+
# Check if chef repo path is specified to give a better error message
|
98
|
+
@chef_fs_config.require_chef_repo_path
|
97
99
|
ui.error("Attempt to use relative path '#{arg}' when current directory is outside the repository path")
|
98
100
|
exit(1)
|
99
101
|
end
|
data/lib/chef_fs/version.rb
CHANGED
@@ -16,6 +16,7 @@ describe 'redirection' do
|
|
16
16
|
app = lambda do |env|
|
17
17
|
[302, {'Content-Type' => 'text','Location' => "#{@real_chef_server_url}#{env['PATH_INFO']}" }, ['302 found'] ]
|
18
18
|
end
|
19
|
+
Thin::Logging.silent = true
|
19
20
|
@redirector_server = Thin::Server.new('127.0.0.1', 9018, app, { :signals => false })
|
20
21
|
@redirector_thread = Thread.new do
|
21
22
|
begin
|