knife-essentials 1.2.1 → 1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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 ||= server_path(File.expand_path(@cwd))
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
- if !@chef_config[:chef_repo_path]
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
@@ -1,3 +1,3 @@
1
1
  module ChefFS
2
- VERSION = "1.2.1"
2
+ VERSION = "1.3"
3
3
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-essentials
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: '1.3'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: