chef-cli 3.0.16 → 3.0.22
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.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/lib/chef-cli/cli.rb +12 -5
- data/lib/chef-cli/command/env.rb +1 -1
- data/lib/chef-cli/command/gem.rb +0 -1
- data/lib/chef-cli/command/generator_commands.rb +1 -2
- data/lib/chef-cli/command/generator_commands/cookbook.rb +15 -12
- data/lib/chef-cli/command/provision.rb +0 -2
- data/lib/chef-cli/command/shell_init.rb +1 -1
- data/lib/chef-cli/policyfile/artifactory_cookbook_source.rb +2 -2
- data/lib/chef-cli/policyfile/attribute_merge_checker.rb +1 -1
- data/lib/chef-cli/policyfile/community_cookbook_source.rb +1 -1
- data/lib/chef-cli/policyfile/cookbook_location_specification.rb +1 -1
- data/lib/chef-cli/policyfile/delivery_supermarket_source.rb +1 -3
- data/lib/chef-cli/policyfile/dsl.rb +1 -1
- data/lib/chef-cli/version.rb +1 -1
- data/lib/kitchen/provisioner/chef_zero_capture.rb +1 -1
- data/spec/unit/cli_spec.rb +2 -2
- data/spec/unit/command/env_spec.rb +1 -1
- data/spec/unit/fixtures/cookbooks_api/update_fixtures.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4ad30b471d00e7b8b9d9b2c94a9722d4fa2dbd5a2b8db6eaf6340ad5cbee006
|
4
|
+
data.tar.gz: e925152292893332d5f846db05bc52299823f6e4e7043cc23783ed1ffd7b3a17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f1860d196d449214a2e5511c4add38e0b50a39c660837a1f6052fe145e274706f80dc44c474f0480c2b16518c08f77b424c902b1664cfa9bb7ab63408d3dc07
|
7
|
+
data.tar.gz: b1ad7b8563c1389e9ae62e906c998be45ee23d3bb2f044c7cc62fe4fd061577d33d70ab46e00445cb3d84d3754d033432c8cdbd553b9a263b8a5bc5eddb1ce23
|
data/Gemfile
CHANGED
@@ -13,7 +13,7 @@ group :test do
|
|
13
13
|
gem "rspec", "~> 3.8"
|
14
14
|
gem "rspec-expectations", "~> 3.8"
|
15
15
|
gem "rspec-mocks", "~> 3.8"
|
16
|
-
gem "cookstyle", "6.
|
16
|
+
gem "cookstyle", "6.14.7" # this forces dependabot PRs to open which triggers cookstyle CI on the chef generate command
|
17
17
|
gem "chefstyle", "1.2.0"
|
18
18
|
gem "test-kitchen", "> 2.5"
|
19
19
|
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.6")
|
data/lib/chef-cli/cli.rb
CHANGED
@@ -59,7 +59,7 @@ module ChefCLI
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def run(enforce_license: false)
|
62
|
-
|
62
|
+
path_check!
|
63
63
|
|
64
64
|
subcommand_name, *subcommand_params = argv
|
65
65
|
|
@@ -149,8 +149,15 @@ module ChefCLI
|
|
149
149
|
commands_map.command_specs
|
150
150
|
end
|
151
151
|
|
152
|
+
#
|
153
|
+
# Is a passed parameter actually an option aka does it start with '-'
|
154
|
+
#
|
155
|
+
# @param [String] param The passed parameter to check
|
156
|
+
#
|
157
|
+
# @return [Boolean]
|
158
|
+
#
|
152
159
|
def option?(param)
|
153
|
-
param
|
160
|
+
param[0] == "-"
|
154
161
|
end
|
155
162
|
|
156
163
|
def instantiate_subcommand(name)
|
@@ -178,12 +185,12 @@ module ChefCLI
|
|
178
185
|
end
|
179
186
|
|
180
187
|
def manifest_hash
|
181
|
-
require "json"
|
188
|
+
require "json" unless defined?(JSON)
|
182
189
|
@manifest_hash ||= JSON.parse(read_version_manifest_json)
|
183
190
|
end
|
184
191
|
|
185
192
|
def gem_manifest_hash
|
186
|
-
require "json"
|
193
|
+
require "json" unless defined?(JSON)
|
187
194
|
@gem_manifest_hash ||= JSON.parse(read_gem_version_manifest_json)
|
188
195
|
end
|
189
196
|
|
@@ -224,7 +231,7 @@ module ChefCLI
|
|
224
231
|
# catch the cases where users setup only the embedded_bin_dir in their path, or
|
225
232
|
# when they have the embedded_bin_dir before the omnibus_bin_dir -- both of which will
|
226
233
|
# defeat appbundler and interact very badly with our intent.
|
227
|
-
def
|
234
|
+
def path_check!
|
228
235
|
# When installed outside of omnibus, trust the user to configure their PATH
|
229
236
|
return true unless omnibus_install?
|
230
237
|
|
data/lib/chef-cli/command/env.rb
CHANGED
data/lib/chef-cli/command/gem.rb
CHANGED
@@ -16,7 +16,6 @@
|
|
16
16
|
#
|
17
17
|
|
18
18
|
require "mixlib/cli" unless defined?(Mixlib::CLI)
|
19
|
-
require "rbconfig"
|
20
19
|
require "pathname" unless defined?(Pathname)
|
21
20
|
require_relative "base"
|
22
21
|
require_relative "../chef_runner"
|
@@ -38,7 +37,7 @@ module ChefCLI
|
|
38
37
|
long: "--license LICENSE",
|
39
38
|
description: "all_rights, apachev2, mit, gplv2, gplv3 - defaults to all_rights",
|
40
39
|
proc: Proc.new { |l|
|
41
|
-
|
40
|
+
/apache2/.match?(l) ? "apachev2" : l
|
42
41
|
},
|
43
42
|
default: nil
|
44
43
|
|
@@ -187,27 +187,30 @@ module ChefCLI
|
|
187
187
|
@verbose
|
188
188
|
end
|
189
189
|
|
190
|
+
#
|
191
|
+
# Is there a .delivery/cli.toml in the current dir or any of the parent dirs
|
192
|
+
#
|
193
|
+
# @return [Boolean]
|
194
|
+
#
|
190
195
|
def have_delivery_config?
|
191
196
|
# delivery-cli's logic is to look recursively upward for
|
192
197
|
# .delivery/cli.toml starting from pwd:
|
193
198
|
# https://github.com/chef/delivery-cli/blob/22cbef3987ebd0aee98405b7e161a100edc87e49/src/delivery/config/mod.rs#L225-L247
|
194
199
|
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
Pathname.new(path_to_check).ascend do |path|
|
199
|
-
if contains_delivery_cli_toml?(path)
|
200
|
-
result = true
|
201
|
-
break
|
202
|
-
end
|
200
|
+
Pathname.new(Dir.pwd).ascend do |path|
|
201
|
+
return true if contains_delivery_cli_toml?(path)
|
203
202
|
end
|
204
203
|
|
205
|
-
|
204
|
+
false # nothing was found
|
206
205
|
end
|
207
206
|
|
207
|
+
#
|
208
|
+
# @param [Pathname] path a directory
|
209
|
+
#
|
210
|
+
# @return [Boolean] delivery cli.toml exists
|
211
|
+
#
|
208
212
|
def contains_delivery_cli_toml?(path)
|
209
|
-
|
210
|
-
delivery_cli_path.exist?
|
213
|
+
path.join(".delivery/cli.toml").exist?
|
211
214
|
end
|
212
215
|
|
213
216
|
def read_and_validate_params
|
@@ -215,7 +218,7 @@ module ChefCLI
|
|
215
218
|
@cookbook_name_or_path = arguments[0]
|
216
219
|
if !@cookbook_name_or_path
|
217
220
|
@params_valid = false
|
218
|
-
elsif
|
221
|
+
elsif File.basename(@cookbook_name_or_path).include?("-")
|
219
222
|
msg("Hyphens are discouraged in cookbook names as they may cause problems with custom resources. See https://docs.chef.io/ctl_chef/#chef-generate-cookbook for more information.")
|
220
223
|
end
|
221
224
|
|
@@ -15,11 +15,11 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require "json"
|
18
|
+
require "json" unless defined?(JSON)
|
19
19
|
require_relative "../cookbook_omnifetch"
|
20
20
|
require_relative "source_uri"
|
21
21
|
require_relative "../exceptions"
|
22
|
-
require "chef/http/simple"
|
22
|
+
require "chef/http/simple" unless defined?(Chef::HTTP::Simple)
|
23
23
|
|
24
24
|
module ChefCLI
|
25
25
|
module Policyfile
|
@@ -233,7 +233,7 @@ module ChefCLI
|
|
233
233
|
message = "#{run_list_desc} has invalid cookbook name '#{cookbook}'.\nCookbook names can only contain alphanumerics, hyphens, and underscores."
|
234
234
|
|
235
235
|
# Special case when there's only one colon instead of two:
|
236
|
-
if
|
236
|
+
if /[^:]:[^:]/.match?(cookbook)
|
237
237
|
message << "\nDid you mean '#{item.sub(":", "::")}'?"
|
238
238
|
end
|
239
239
|
|
data/lib/chef-cli/version.rb
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
|
18
|
-
require "json"
|
18
|
+
require "json" unless defined?(JSON)
|
19
19
|
require "kitchen"
|
20
20
|
require "kitchen/provisioner/base"
|
21
21
|
require "kitchen/provisioner/chef_zero"
|
data/spec/unit/cli_spec.rb
CHANGED
@@ -55,7 +55,7 @@ describe ChefCLI::CLI do
|
|
55
55
|
|
56
56
|
def run_cli(expected_exit_code)
|
57
57
|
expect(cli).to receive(:exit).with(expected_exit_code)
|
58
|
-
expect(cli).to receive(:
|
58
|
+
expect(cli).to receive(:path_check!)
|
59
59
|
cli.run
|
60
60
|
end
|
61
61
|
|
@@ -256,7 +256,7 @@ describe ChefCLI::CLI do
|
|
256
256
|
end
|
257
257
|
end
|
258
258
|
|
259
|
-
context "
|
259
|
+
context "path_check!" do
|
260
260
|
|
261
261
|
before do
|
262
262
|
allow(Gem).to receive(:ruby).and_return(ruby_path)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chef Software, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08-
|
11
|
+
date: 2020-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-cli
|