chef-cli 2.0.0 → 2.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -6
- data/chef-cli.gemspec +2 -2
- data/lib/chef-cli/cli.rb +5 -5
- data/lib/chef-cli/command/describe_cookbook.rb +1 -1
- data/lib/chef-cli/command/generator_commands/policyfile.rb +2 -2
- data/lib/chef-cli/command/install.rb +1 -1
- data/lib/chef-cli/dist.rb +8 -0
- data/lib/chef-cli/helpers.rb +2 -2
- data/lib/chef-cli/policyfile/cookbook_location_specification.rb +2 -1
- data/lib/chef-cli/policyfile/lock_fetcher_mixin.rb +2 -2
- data/lib/chef-cli/policyfile/uploader.rb +2 -2
- data/lib/chef-cli/policyfile_services/export_repo.rb +5 -0
- data/lib/chef-cli/policyfile_services/install.rb +2 -0
- data/lib/chef-cli/policyfile_services/rm_policy.rb +1 -1
- data/lib/chef-cli/policyfile_services/update_attributes.rb +2 -0
- data/lib/chef-cli/skeletons/code_generator/files/default/build_cookbook/README.md +3 -3
- data/lib/chef-cli/skeletons/code_generator/files/default/build_cookbook/kitchen.yml +1 -1
- data/lib/chef-cli/skeletons/code_generator/files/default/chefignore +2 -1
- data/lib/chef-cli/skeletons/code_generator/files/default/cookbook_readmes/README-policy.md +1 -1
- data/lib/chef-cli/skeletons/code_generator/files/default/cookbook_readmes/README.md +2 -2
- data/lib/chef-cli/skeletons/code_generator/files/default/repo/cookbooks/example/README.md +2 -2
- data/lib/chef-cli/skeletons/code_generator/recipes/build_cookbook.rb +2 -2
- data/lib/chef-cli/skeletons/code_generator/recipes/cookbook.rb +1 -1
- data/lib/chef-cli/skeletons/code_generator/recipes/repo.rb +1 -1
- data/lib/chef-cli/skeletons/code_generator/templates/default/kitchen.yml.erb +1 -1
- data/lib/chef-cli/skeletons/code_generator/templates/default/kitchen_dokken.yml.erb +2 -2
- data/lib/chef-cli/skeletons/code_generator/templates/default/kitchen_policyfile.yml.erb +1 -1
- data/lib/chef-cli/version.rb +1 -1
- data/spec/unit/command/generator_commands/cookbook_spec.rb +4 -4
- data/spec/unit/command/generator_commands/repo_spec.rb +1 -1
- data/spec/unit/policyfile/cookbook_location_specification_spec.rb +5 -0
- data/spec/unit/policyfile/uploader_spec.rb +2 -2
- data/spec/unit/policyfile_lock_build_spec.rb +1 -1
- data/spec/unit/policyfile_services/clean_policies_spec.rb +2 -0
- data/spec/unit/policyfile_services/update_attributes_spec.rb +1 -1
- data/spec/unit/service_exception_inspectors/http_spec.rb +1 -1
- metadata +14 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ebc60c7c08e91010059db01bc99774da3a071cb08320ed2cedd0f3faec80efa
|
4
|
+
data.tar.gz: '08b56a1c62d520a03198a1c7e5dbbff004d967571945eb0049f665a7379e5e96'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fff531a5e154a54d3bc751ae067abfcf2febeae073d9ba22739fc814089fb3d019259ea7a4d04c71967b44c698543cadeefe0c5d0bc9fa51a2fc1541430ba9fd
|
7
|
+
data.tar.gz: 3bec22ca55b7f1c04e38695b5a1f26c4e308c996c613bf008fd17a66ec0bae8576ef9716f35cd126cad65b43d4b58436fb265c2df797edc5f9ad3694d5d09b57
|
data/Gemfile
CHANGED
@@ -27,9 +27,3 @@ group :development do
|
|
27
27
|
gem "pry-stack_explorer"
|
28
28
|
gem "rb-readline"
|
29
29
|
end
|
30
|
-
|
31
|
-
instance_eval(ENV["GEMFILE_MOD"]) if ENV["GEMFILE_MOD"]
|
32
|
-
|
33
|
-
# If you want to load debugging tools into the bundle exec sandbox,
|
34
|
-
# add these additional dependencies into Gemfile.local
|
35
|
-
eval_gemfile(__FILE__ + ".local") if File.exist?(__FILE__ + ".local")
|
data/chef-cli.gemspec
CHANGED
@@ -45,9 +45,9 @@ Gem::Specification.new do |gem|
|
|
45
45
|
gem.add_dependency "minitar", "~> 0.6"
|
46
46
|
gem.add_dependency "chef", ">= 14.0"
|
47
47
|
gem.add_dependency "solve", "< 5.0", "> 2.0"
|
48
|
-
gem.add_dependency "addressable", ">= 2.3.5", "< 2.
|
48
|
+
gem.add_dependency "addressable", ">= 2.3.5", "< 2.8"
|
49
49
|
gem.add_dependency "cookbook-omnifetch", "~> 0.5"
|
50
50
|
gem.add_dependency "diff-lcs", "~> 1.0"
|
51
|
-
gem.add_dependency "paint", "
|
51
|
+
gem.add_dependency "paint", ">= 1", "< 3"
|
52
52
|
gem.add_dependency "license-acceptance", "~> 1.0", ">= 1.0.11"
|
53
53
|
end
|
data/lib/chef-cli/cli.rb
CHANGED
@@ -34,9 +34,9 @@ module ChefCLI
|
|
34
34
|
|
35
35
|
banner(<<~BANNER)
|
36
36
|
Usage:
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
#{ChefCLI::Dist::EXEC} -h/--help
|
38
|
+
#{ChefCLI::Dist::EXEC} -v/--version
|
39
|
+
#{ChefCLI::Dist::EXEC} command [arguments...] [options...]
|
40
40
|
BANNER
|
41
41
|
|
42
42
|
option :version,
|
@@ -105,9 +105,9 @@ module ChefCLI
|
|
105
105
|
|
106
106
|
def show_version_via_version_manifest
|
107
107
|
msg("#{ChefCLI::Dist::PRODUCT} version: #{manifest_field("build_version")}")
|
108
|
-
{ "#{ChefCLI::Dist::INFRA_CLIENT_PRODUCT}": "
|
108
|
+
{ "#{ChefCLI::Dist::INFRA_CLIENT_PRODUCT}": "#{ChefCLI::Dist::INFRA_CLIENT_GEM}",
|
109
109
|
"#{ChefCLI::Dist::INSPEC_PRODUCT}": "#{ChefCLI::Dist::INSPEC_CLI}",
|
110
|
-
"
|
110
|
+
"#{ChefCLI::Dist::CLI_PRODUCT}": "#{ChefCLI::Dist::CLI_GEM}",
|
111
111
|
"Test Kitchen": "test-kitchen",
|
112
112
|
"Cookstyle": "cookstyle",
|
113
113
|
}.each do |name, gem|
|
@@ -76,7 +76,7 @@ module ChefCLI
|
|
76
76
|
if chef_repo_mode?
|
77
77
|
err("ERROR: You must give a policy name when generating a policy in a chef-repo.")
|
78
78
|
@params_valid = false
|
79
|
-
|
79
|
+
false
|
80
80
|
else
|
81
81
|
use_default_policy_settings
|
82
82
|
end
|
@@ -85,7 +85,7 @@ module ChefCLI
|
|
85
85
|
else
|
86
86
|
@params_valid = false
|
87
87
|
err("ERROR: too many arguments")
|
88
|
-
|
88
|
+
false
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
data/lib/chef-cli/dist.rb
CHANGED
@@ -4,6 +4,11 @@ module ChefCLI
|
|
4
4
|
|
5
5
|
# The full marketing name of the product
|
6
6
|
PRODUCT = "Chef Workstation".freeze
|
7
|
+
PRODUCT_PKG_HOME = "chef-workstation".freeze
|
8
|
+
|
9
|
+
# the name of the chef-cli gem
|
10
|
+
CLI_PRODUCT = "Chef CLI".freeze
|
11
|
+
CLI_GEM = "chef-cli".freeze
|
7
12
|
|
8
13
|
# the name of the overall infra product
|
9
14
|
INFRA_PRODUCT = "Chef Infra".freeze
|
@@ -14,6 +19,9 @@ module ChefCLI
|
|
14
19
|
# The client's alias (chef-client)
|
15
20
|
INFRA_CLIENT_CLI = "chef-client".freeze
|
16
21
|
|
22
|
+
# The client's gem
|
23
|
+
INFRA_CLIENT_GEM = "chef".freeze
|
24
|
+
|
17
25
|
INSPEC_PRODUCT = "Chef InSpec".freeze
|
18
26
|
INSPEC_CLI = "inspec".freeze
|
19
27
|
|
data/lib/chef-cli/helpers.rb
CHANGED
@@ -141,9 +141,9 @@ module ChefCLI
|
|
141
141
|
|
142
142
|
def default_package_home
|
143
143
|
if Chef::Platform.windows?
|
144
|
-
File.join(ENV["LOCALAPPDATA"], "
|
144
|
+
File.join(ENV["LOCALAPPDATA"], "#{ChefCLI::Dist::PRODUCT_PKG_HOME}")
|
145
145
|
else
|
146
|
-
File.expand_path("
|
146
|
+
File.expand_path("~/.#{ChefCLI::Dist::PRODUCT_PKG_HOME}")
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
@@ -125,7 +125,8 @@ module ChefCLI
|
|
125
125
|
|
126
126
|
def cookbook_has_recipe?(recipe_name)
|
127
127
|
expected_path = cookbook_path.join("recipes/#{recipe_name}.rb")
|
128
|
-
|
128
|
+
expected_path_yml = cookbook_path.join("recipes/#{recipe_name}.yml")
|
129
|
+
expected_path.exist? || expected_path_yml.exist?
|
129
130
|
end
|
130
131
|
|
131
132
|
def cached_cookbook
|
@@ -24,9 +24,9 @@ module ChefCLI
|
|
24
24
|
expected_id = source_options[:policy_revision_id]
|
25
25
|
if expected_id
|
26
26
|
if included_id.eql?(expected_id) # are they the same?
|
27
|
-
|
27
|
+
nil
|
28
28
|
elsif included_id[0, 10].eql?(expected_id) # did they use the 10 char substring
|
29
|
-
|
29
|
+
nil
|
30
30
|
else
|
31
31
|
raise ChefCLI::InvalidLockfile, "Expected policy_revision_id '#{expected_id}' does not match included_policy '#{included_id}'."
|
32
32
|
end
|
@@ -79,7 +79,7 @@ module ChefCLI
|
|
79
79
|
|
80
80
|
def data_bag_create
|
81
81
|
http_client.post("data", { "name" => COMPAT_MODE_DATA_BAG_NAME })
|
82
|
-
rescue Net::
|
82
|
+
rescue Net::HTTPClientException => e
|
83
83
|
raise e unless e.response.code == "409"
|
84
84
|
end
|
85
85
|
|
@@ -214,7 +214,7 @@ module ChefCLI
|
|
214
214
|
|
215
215
|
def upload_lockfile_as_data_bag_item(policy_id, data_item)
|
216
216
|
http_client.put("data/#{COMPAT_MODE_DATA_BAG_NAME}/#{policy_id}", data_item)
|
217
|
-
rescue Net::
|
217
|
+
rescue Net::HTTPClientException => e
|
218
218
|
raise e unless e.response.code == "404"
|
219
219
|
|
220
220
|
http_client.post("data/#{COMPAT_MODE_DATA_BAG_NAME}", data_item)
|
@@ -44,12 +44,14 @@ module ChefCLI
|
|
44
44
|
attr_reader :storage_config
|
45
45
|
attr_reader :root_dir
|
46
46
|
attr_reader :export_dir
|
47
|
+
attr_reader :ui
|
47
48
|
|
48
49
|
def initialize(policyfile: nil, export_dir: nil, root_dir: nil, archive: false, force: false)
|
49
50
|
@root_dir = root_dir
|
50
51
|
@export_dir = File.expand_path(export_dir)
|
51
52
|
@archive = archive
|
52
53
|
@force_export = force
|
54
|
+
@ui = UI.new
|
53
55
|
|
54
56
|
@policy_data = nil
|
55
57
|
@policyfile_lock = nil
|
@@ -162,6 +164,9 @@ module ChefCLI
|
|
162
164
|
FileUtils.mkdir(export_path) unless File.directory?(export_path)
|
163
165
|
copy_unignored_cookbook_files(lock, export_path)
|
164
166
|
FileUtils.rm_f(metadata_rb_path)
|
167
|
+
if lock.cookbook_version.nil?
|
168
|
+
ui.msg "Unable to get the cookbook version/metadata for #{lock}"
|
169
|
+
end
|
165
170
|
metadata = lock.cookbook_version.metadata
|
166
171
|
|
167
172
|
metadata_json_path = File.join(export_path, "metadata.json")
|
@@ -147,8 +147,10 @@ module ChefCLI
|
|
147
147
|
end
|
148
148
|
|
149
149
|
def prepare_constraints_for_policies
|
150
|
+
# Ensure we recompute policies from their (possibly updated) source
|
150
151
|
Policyfile::LockApplier
|
151
152
|
.new(policyfile_lock, policyfile_compiler)
|
153
|
+
.with_unlocked_policies(:all)
|
152
154
|
.apply!
|
153
155
|
end
|
154
156
|
|
@@ -134,7 +134,7 @@ module ChefCLI
|
|
134
134
|
def fetch_policy_revision_data
|
135
135
|
@policy_revision_data = http_client.get("/policies/#{policy_name}")
|
136
136
|
@policy_exists = true
|
137
|
-
rescue Net::
|
137
|
+
rescue Net::HTTPClientException => e
|
138
138
|
raise unless e.response.code == "404"
|
139
139
|
|
140
140
|
@policy_exists = false
|
@@ -102,7 +102,9 @@ module ChefCLI
|
|
102
102
|
end
|
103
103
|
|
104
104
|
def prepare_constraints
|
105
|
+
# Ensure we recompute policies from their (possibly updated) source
|
105
106
|
Policyfile::LockApplier.new(policyfile_lock, policyfile_compiler)
|
107
|
+
.with_unlocked_policies(:all)
|
106
108
|
.apply!
|
107
109
|
end
|
108
110
|
end
|
@@ -101,7 +101,7 @@ cd .delivery/build_cookbook
|
|
101
101
|
kitchen converge
|
102
102
|
```
|
103
103
|
|
104
|
-
This will take
|
104
|
+
This will take a while because it will now pass on the first VM and then create the second VM. We should have warned you this was a good time for a coffee break.
|
105
105
|
|
106
106
|
```
|
107
107
|
Recipe: test::default
|
@@ -115,7 +115,7 @@ Recipe: test::default
|
|
115
115
|
Running handlers:
|
116
116
|
Running handlers complete
|
117
117
|
Chef Infra Client finished, 3/32 resources updated in 54.665445968 seconds
|
118
|
-
Finished converging <default-centos-
|
118
|
+
Finished converging <default-centos-8> (1m26.83s).
|
119
119
|
```
|
120
120
|
|
121
121
|
Victory is ours! Our verify phase passed on the build nodes.
|
@@ -129,7 +129,7 @@ delivery review
|
|
129
129
|
|
130
130
|
## FAQ
|
131
131
|
|
132
|
-
### Why don't I just run rspec and
|
132
|
+
### Why don't I just run rspec and cookstyle on my local system?
|
133
133
|
|
134
134
|
An objection to the Test Kitchen approach is that it is much faster to run the unit, lint, and syntax commands for the project on the local system. That is totally true, and also totally valid. Do that for the really fast feedback loop. However, the dance we do with Test Kitchen brings a much higher degree of confidence in the changes we're making, that everything will run on the build nodes in Chef Workflow. We strongly encourage this approach before actually pushing the changes to Workflow.
|
135
135
|
|
@@ -30,6 +30,7 @@ mkmf.log
|
|
30
30
|
REVISION
|
31
31
|
TAGS*
|
32
32
|
tmtags
|
33
|
+
.vscode
|
33
34
|
|
34
35
|
## COMPILED ##
|
35
36
|
##############
|
@@ -97,7 +98,7 @@ Gemfile.lock
|
|
97
98
|
Policyfile.rb
|
98
99
|
Policyfile.lock.json
|
99
100
|
|
100
|
-
#
|
101
|
+
# Documentation #
|
101
102
|
#############
|
102
103
|
CHANGELOG*
|
103
104
|
CONTRIBUTING*
|
@@ -1,4 +1,4 @@
|
|
1
|
-
This directory typically contains Chef cookbooks. This repository was
|
1
|
+
This directory typically contains Chef Infra cookbooks. This repository was
|
2
2
|
generated with the '--policy-only' option, which means you have chosen
|
3
3
|
to use a workflow where each cookbook is treated as an independent
|
4
4
|
software project. As a result, any cookbooks present in this directory
|
@@ -1,4 +1,4 @@
|
|
1
|
-
This directory contains the cookbooks used to configure systems in your infrastructure with Chef - an example basic cookbook called `example` has been automatically created for you.
|
1
|
+
This directory contains the cookbooks used to configure systems in your infrastructure with Chef Infra - an example basic cookbook called `example` has been automatically created for you.
|
2
2
|
|
3
3
|
Knife needs to be configured to know where the cookbooks are located with the `cookbook_path` setting. If this is not set, then several cookbook operations will fail to work properly.
|
4
4
|
|
@@ -23,7 +23,7 @@ cookbook_email "cookbooks@example.com"
|
|
23
23
|
cookbook_license "apachev2"
|
24
24
|
```
|
25
25
|
|
26
|
-
Supported values for `cookbook_license` are "apachev2", "mit","gplv2","gplv3", or "none". These settings are used to prefill comments in the default recipe, and the corresponding values in the metadata.rb. You are free to change the
|
26
|
+
Supported values for `cookbook_license` are "apachev2", "mit","gplv2","gplv3", or "none". These settings are used to prefill comments in the default recipe, and the corresponding values in the metadata.rb. You are free to change the comments in those files.
|
27
27
|
|
28
28
|
Create new cookbooks in this directory with Chef.
|
29
29
|
|
@@ -11,13 +11,13 @@ directory dot_delivery_dir
|
|
11
11
|
|
12
12
|
cookbook_file config_json do
|
13
13
|
source 'delivery-config.json'
|
14
|
-
not_if { File.exist?(config_json) }
|
14
|
+
not_if { ::File.exist?(config_json) }
|
15
15
|
end
|
16
16
|
|
17
17
|
# Adding the delivery local-mode config
|
18
18
|
cookbook_file project_toml do
|
19
19
|
source 'delivery-project.toml'
|
20
|
-
not_if { File.exist?(project_toml) }
|
20
|
+
not_if { ::File.exist?(project_toml) }
|
21
21
|
end
|
22
22
|
|
23
23
|
generator_desc('Ensuring correct Workflow (Delivery) build cookbook content')
|
@@ -129,7 +129,7 @@ unless context.enable_workflow
|
|
129
129
|
# Adding the delivery local-mode config
|
130
130
|
cookbook_file "#{cookbook_dir}/.delivery/project.toml" do
|
131
131
|
source 'delivery-project.toml'
|
132
|
-
not_if { File.exist?("#{cookbook_dir}/.delivery/project.toml") }
|
132
|
+
not_if { ::File.exist?("#{cookbook_dir}/.delivery/project.toml") }
|
133
133
|
end
|
134
134
|
end
|
135
135
|
|
data/lib/chef-cli/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright:: Copyright (c) 2014-
|
2
|
+
# Copyright:: Copyright (c) 2014-2020 Chef Software Inc.
|
3
3
|
# License:: Apache License, Version 2.0
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -269,7 +269,7 @@ describe ChefCLI::Command::GeneratorCommands::Cookbook do
|
|
269
269
|
# Cookbook:: build_cookbook
|
270
270
|
# Recipe:: publish
|
271
271
|
#
|
272
|
-
# Copyright::
|
272
|
+
# Copyright:: #{DateTime.now.year}, The Authors, All Rights Reserved.
|
273
273
|
|
274
274
|
include_recipe 'delivery-truck::publish'
|
275
275
|
CONFIG_DOT_JSON
|
@@ -580,7 +580,7 @@ describe ChefCLI::Command::GeneratorCommands::Cookbook do
|
|
580
580
|
|
581
581
|
platforms:
|
582
582
|
- name: ubuntu-18.04
|
583
|
-
- name: centos-
|
583
|
+
- name: centos-8
|
584
584
|
|
585
585
|
suites:
|
586
586
|
- name: default
|
@@ -667,7 +667,7 @@ describe ChefCLI::Command::GeneratorCommands::Cookbook do
|
|
667
667
|
|
668
668
|
platforms:
|
669
669
|
- name: ubuntu-18.04
|
670
|
-
- name: centos-
|
670
|
+
- name: centos-8
|
671
671
|
|
672
672
|
suites:
|
673
673
|
- name: default
|
@@ -231,7 +231,7 @@ describe ChefCLI::Command::GeneratorCommands::Repo do
|
|
231
231
|
let(:argv) { ["new_repo", "--policy-only" ] }
|
232
232
|
|
233
233
|
it "tells you whats up" do
|
234
|
-
expect(file_contents).to match(/This directory typically contains Chef cookbooks/)
|
234
|
+
expect(file_contents).to match(/This directory typically contains Chef Infra cookbooks/)
|
235
235
|
end
|
236
236
|
end
|
237
237
|
end
|
@@ -143,13 +143,18 @@ describe ChefCLI::Policyfile::CookbookLocationSpecification do
|
|
143
143
|
allow(cookbook_location_spec).to receive(:cookbook_path).and_return(cookbook_path)
|
144
144
|
|
145
145
|
default_recipe_path = install_path.join("recipes/default.rb")
|
146
|
+
default_yml_recipe_path = install_path.join("recipes/default.yml")
|
146
147
|
nope_recipe_path = install_path.join("recipes/nope.rb")
|
148
|
+
nope_yml_recipe_path = install_path.join("recipes/nope.yml")
|
147
149
|
|
148
150
|
expect(cookbook_path).to receive(:join).with("recipes/default.rb").and_return(default_recipe_path)
|
151
|
+
expect(cookbook_path).to receive(:join).with("recipes/default.yml").and_return(default_yml_recipe_path)
|
149
152
|
expect(cookbook_path).to receive(:join).with("recipes/nope.rb").and_return(nope_recipe_path)
|
153
|
+
expect(cookbook_path).to receive(:join).with("recipes/nope.yml").and_return(nope_yml_recipe_path)
|
150
154
|
|
151
155
|
expect(default_recipe_path).to receive(:exist?).and_return(true)
|
152
156
|
expect(nope_recipe_path).to receive(:exist?).and_return(false)
|
157
|
+
expect(nope_yml_recipe_path).to receive(:exist?).and_return(false)
|
153
158
|
|
154
159
|
expect(cookbook_location_spec.cookbook_has_recipe?("default")).to be(true)
|
155
160
|
expect(cookbook_location_spec.cookbook_has_recipe?("nope")).to be(false)
|
@@ -319,14 +319,14 @@ describe ChefCLI::Policyfile::Uploader do
|
|
319
319
|
|
320
320
|
it "does not error when the 'policyfiles' data bag exists" do
|
321
321
|
response = double("Net::HTTP response", code: "409")
|
322
|
-
error = Net::
|
322
|
+
error = Net::HTTPClientException.new("conflict", response)
|
323
323
|
expect(http_client).to receive(:post).with("data", { "name" => "policyfiles" }).and_raise(error)
|
324
324
|
expect { uploader.data_bag_create }.to_not raise_error
|
325
325
|
end
|
326
326
|
|
327
327
|
it "uploads the policyfile as a data bag item" do
|
328
328
|
response = double("Net::HTTP response", code: "404")
|
329
|
-
error = Net::
|
329
|
+
error = Net::HTTPClientException.new("Not Found", response)
|
330
330
|
expect(http_client).to receive(:put)
|
331
331
|
.with("data/policyfiles/example-unit-test", policyfile_as_data_bag_item)
|
332
332
|
.and_raise(error)
|
@@ -22,7 +22,7 @@ require "shared/fixture_cookbook_checksums"
|
|
22
22
|
require "chef-cli/policyfile/storage_config"
|
23
23
|
require "chef-cli/policyfile_lock.rb"
|
24
24
|
|
25
|
-
describe ChefCLI::PolicyfileLock, "building a lockfile" do
|
25
|
+
describe ChefCLI::PolicyfileLock, "building a lockfile", :skip_on_windows do
|
26
26
|
|
27
27
|
include_context "fixture cookbooks checksums"
|
28
28
|
|
@@ -211,6 +211,8 @@ describe ChefCLI::PolicyfileServices::CleanPolicies do
|
|
211
211
|
end
|
212
212
|
|
213
213
|
it "deletes what it can, then raises an error" do
|
214
|
+
# Ruby 2.6 deprecated HTTPServerException but the errors are still initialized using it, so
|
215
|
+
# this will continue to print that out until they remove HTTPServerException
|
214
216
|
expected_message = <<~ERROR
|
215
217
|
Failed to delete some policy revisions:
|
216
218
|
- appserver (4444444444444444444444444444444444444444444444444444444444444444): Net::HTTPServerException 403 \"Unauthorized\"
|
@@ -176,7 +176,7 @@ describe ChefCLI::PolicyfileServices::UpdateAttributes do
|
|
176
176
|
expect(ChefCLI::Policyfile::LockApplier).to receive(:new).with(
|
177
177
|
update_attrs_service.policyfile_lock, update_attrs_service.policyfile_compiler
|
178
178
|
).and_return(lock_applier)
|
179
|
-
expect(lock_applier).
|
179
|
+
expect(lock_applier).to receive(:with_unlocked_policies).with(:all).and_return(lock_applier)
|
180
180
|
expect(lock_applier).to receive(:apply!)
|
181
181
|
|
182
182
|
update_attrs_service.run
|
@@ -64,7 +64,7 @@ describe ChefCLI::ServiceExceptionInspectors::HTTP do
|
|
64
64
|
end
|
65
65
|
|
66
66
|
let(:exception) do
|
67
|
-
Net::
|
67
|
+
Net::HTTPClientException.new(message, response).tap { |e| e.chef_rest_request = request }
|
68
68
|
end
|
69
69
|
|
70
70
|
subject(:inspector) { described_class.new(exception) }
|
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: 2.0.
|
4
|
+
version: 2.0.10
|
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:
|
11
|
+
date: 2020-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-cli
|
@@ -127,7 +127,7 @@ dependencies:
|
|
127
127
|
version: 2.3.5
|
128
128
|
- - "<"
|
129
129
|
- !ruby/object:Gem::Version
|
130
|
-
version: '2.
|
130
|
+
version: '2.8'
|
131
131
|
type: :runtime
|
132
132
|
prerelease: false
|
133
133
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -137,7 +137,7 @@ dependencies:
|
|
137
137
|
version: 2.3.5
|
138
138
|
- - "<"
|
139
139
|
- !ruby/object:Gem::Version
|
140
|
-
version: '2.
|
140
|
+
version: '2.8'
|
141
141
|
- !ruby/object:Gem::Dependency
|
142
142
|
name: cookbook-omnifetch
|
143
143
|
requirement: !ruby/object:Gem::Requirement
|
@@ -170,16 +170,22 @@ dependencies:
|
|
170
170
|
name: paint
|
171
171
|
requirement: !ruby/object:Gem::Requirement
|
172
172
|
requirements:
|
173
|
-
- - "
|
173
|
+
- - ">="
|
174
174
|
- !ruby/object:Gem::Version
|
175
|
-
version: '1
|
175
|
+
version: '1'
|
176
|
+
- - "<"
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: '3'
|
176
179
|
type: :runtime
|
177
180
|
prerelease: false
|
178
181
|
version_requirements: !ruby/object:Gem::Requirement
|
179
182
|
requirements:
|
180
|
-
- - "
|
183
|
+
- - ">="
|
181
184
|
- !ruby/object:Gem::Version
|
182
|
-
version: '1
|
185
|
+
version: '1'
|
186
|
+
- - "<"
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
version: '3'
|
183
189
|
- !ruby/object:Gem::Dependency
|
184
190
|
name: license-acceptance
|
185
191
|
requirement: !ruby/object:Gem::Requirement
|