chef-cli 1.0.14 → 3.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -11
  3. data/Rakefile +0 -16
  4. data/bin/{chef → chef-cli} +0 -0
  5. data/chef-cli.gemspec +7 -6
  6. data/lib/chef-cli/cli.rb +6 -6
  7. data/lib/chef-cli/command/clean_policy_cookbooks.rb +1 -1
  8. data/lib/chef-cli/command/clean_policy_revisions.rb +1 -1
  9. data/lib/chef-cli/command/delete_policy.rb +1 -1
  10. data/lib/chef-cli/command/delete_policy_group.rb +1 -1
  11. data/lib/chef-cli/command/describe_cookbook.rb +1 -1
  12. data/lib/chef-cli/command/export.rb +1 -1
  13. data/lib/chef-cli/command/generator_commands/cookbook.rb +1 -1
  14. data/lib/chef-cli/command/generator_commands/generator_generator.rb +0 -1
  15. data/lib/chef-cli/command/generator_commands/policyfile.rb +2 -2
  16. data/lib/chef-cli/command/install.rb +2 -2
  17. data/lib/chef-cli/command/push.rb +1 -1
  18. data/lib/chef-cli/command/push_archive.rb +1 -1
  19. data/lib/chef-cli/command/show_policy.rb +1 -1
  20. data/lib/chef-cli/command/undelete.rb +1 -1
  21. data/lib/chef-cli/command/update.rb +1 -1
  22. data/lib/chef-cli/dist.rb +8 -0
  23. data/lib/chef-cli/generator.rb +1 -1
  24. data/lib/chef-cli/helpers.rb +2 -2
  25. data/lib/chef-cli/policyfile/cookbook_location_specification.rb +2 -1
  26. data/lib/chef-cli/policyfile/lock_fetcher_mixin.rb +2 -2
  27. data/lib/chef-cli/policyfile/uploader.rb +2 -2
  28. data/lib/chef-cli/policyfile_services/export_repo.rb +5 -0
  29. data/lib/chef-cli/policyfile_services/install.rb +2 -0
  30. data/lib/chef-cli/policyfile_services/rm_policy.rb +1 -1
  31. data/lib/chef-cli/policyfile_services/update_attributes.rb +2 -0
  32. data/lib/chef-cli/skeletons/code_generator/files/default/build_cookbook/README.md +3 -3
  33. data/lib/chef-cli/skeletons/code_generator/files/default/build_cookbook/kitchen.yml +2 -2
  34. data/lib/chef-cli/skeletons/code_generator/files/default/chefignore +2 -3
  35. data/lib/chef-cli/skeletons/code_generator/files/default/cookbook_readmes/README-policy.md +1 -1
  36. data/lib/chef-cli/skeletons/code_generator/files/default/cookbook_readmes/README.md +2 -2
  37. data/lib/chef-cli/skeletons/code_generator/files/default/delivery-project.toml +3 -5
  38. data/lib/chef-cli/skeletons/code_generator/files/default/repo/README.md +1 -1
  39. data/lib/chef-cli/skeletons/code_generator/files/default/repo/cookbooks/example/README.md +2 -2
  40. data/lib/chef-cli/skeletons/code_generator/files/default/repo/cookbooks/example/attributes/default.rb +1 -1
  41. data/lib/chef-cli/skeletons/code_generator/files/default/repo/cookbooks/example/recipes/default.rb +1 -1
  42. data/lib/chef-cli/skeletons/code_generator/files/default/repo/data_bags/README.md +4 -4
  43. data/lib/chef-cli/skeletons/code_generator/files/default/repo/environments/README.md +2 -2
  44. data/lib/chef-cli/skeletons/code_generator/files/default/repo/roles/README.md +2 -2
  45. data/lib/chef-cli/skeletons/code_generator/metadata.rb +2 -3
  46. data/lib/chef-cli/skeletons/code_generator/recipes/build_cookbook.rb +2 -2
  47. data/lib/chef-cli/skeletons/code_generator/recipes/cookbook.rb +1 -1
  48. data/lib/chef-cli/skeletons/code_generator/recipes/repo.rb +1 -1
  49. data/lib/chef-cli/skeletons/code_generator/templates/default/CHANGELOG.md.erb +1 -2
  50. data/lib/chef-cli/skeletons/code_generator/templates/default/Policyfile.rb.erb +1 -1
  51. data/lib/chef-cli/skeletons/code_generator/templates/default/helpers.rb.erb +2 -2
  52. data/lib/chef-cli/skeletons/code_generator/templates/default/kitchen.yml.erb +4 -4
  53. data/lib/chef-cli/skeletons/code_generator/templates/default/kitchen_dokken.yml.erb +4 -4
  54. data/lib/chef-cli/skeletons/code_generator/templates/default/kitchen_policyfile.yml.erb +4 -4
  55. data/lib/chef-cli/skeletons/code_generator/templates/default/metadata.rb.erb +0 -1
  56. data/lib/chef-cli/skeletons/code_generator/templates/default/recipe_spec.rb.erb +4 -4
  57. data/lib/chef-cli/skeletons/code_generator/templates/default/resource.rb.erb +1 -1
  58. data/lib/chef-cli/version.rb +1 -1
  59. data/lib/kitchen/provisioner/chef_zero_capture.rb +90 -0
  60. data/spec/unit/command/generator_commands/cookbook_spec.rb +15 -17
  61. data/spec/unit/command/generator_commands/generator_generator_spec.rb +0 -1
  62. data/spec/unit/command/generator_commands/policyfile_spec.rb +1 -1
  63. data/spec/unit/command/generator_commands/repo_spec.rb +5 -5
  64. data/spec/unit/kitchen/provisioner/chef_zero_capture_spec.rb +84 -0
  65. data/spec/unit/policyfile/cookbook_location_specification_spec.rb +5 -0
  66. data/spec/unit/policyfile/uploader_spec.rb +2 -2
  67. data/spec/unit/policyfile_lock_build_spec.rb +1 -1
  68. data/spec/unit/policyfile_services/clean_policies_spec.rb +2 -0
  69. data/spec/unit/policyfile_services/update_attributes_spec.rb +1 -1
  70. data/spec/unit/service_exception_inspectors/http_spec.rb +1 -1
  71. metadata +36 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 86cf14e43550aba70dc825275b3a3a6b86513da7d550a0bc610175a769d53d56
4
- data.tar.gz: 3fc61ee5fcd4aaa816d370840383e078a5597d8d7cb71fdcf57390758ba380d1
3
+ metadata.gz: d8ef75d64aed76476f1ca99d5e36ebba9d39f408dd2a7dfc842929e0b74e6b44
4
+ data.tar.gz: 246b506ff8bae1577ffdeac5888f26d94fa45223fe02c0236d82d2ab0cfed326
5
5
  SHA512:
6
- metadata.gz: 87b2f14824b5c4e2f75a2e570434d5b52db36e8bd49b074857fec624240cf099c16cb8ea57ce8bffc81aca9843e3fe2647662d99d52438964008fc4e05b0b6b4
7
- data.tar.gz: 7022751ac3061e3823180c51b2e3288970e0666d6a11dbf9c0d28e5b472860637fe44e7f3cb67d0453146c280fcfb369d0b87be7a0c48bf8fb57014c9c54c76b
6
+ metadata.gz: a2105386dd0b2fd89e09e9ba027c3da1b2557cb3cb5ff1a655215d936e5224034ded81d07e08f65c5971228b7391277e9ecf7ebaafd46933de16fe105882c68a
7
+ data.tar.gz: 9ba7a7cd5f85f3e577710621f701f266750e25ac24383ef688f821599642fa7b61e25bb3ff6f0fc7ef88a75a981269449e5c6b675852aca91b936210c51f05bf
data/Gemfile CHANGED
@@ -9,17 +9,12 @@ group :docs do
9
9
  end
10
10
 
11
11
  group :test do
12
- # For ruby 2.4 testing we need to use ohai 14
13
- if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.5")
14
- gem "ohai", "~> 14"
15
- end
16
12
  gem "rake"
17
13
  gem "rspec", "~> 3.8"
18
14
  gem "rspec-expectations", "~> 3.8"
19
15
  gem "rspec-mocks", "~> 3.8"
20
16
  gem "cookstyle"
21
17
  gem "chefstyle"
22
- gem "foodcritic"
23
18
  end
24
19
 
25
20
  group :development do
@@ -28,9 +23,3 @@ group :development do
28
23
  gem "pry-stack_explorer"
29
24
  gem "rb-readline"
30
25
  end
31
-
32
- instance_eval(ENV["GEMFILE_MOD"]) if ENV["GEMFILE_MOD"]
33
-
34
- # If you want to load debugging tools into the bundle exec sandbox,
35
- # add these additional dependencies into Gemfile.local
36
- eval_gemfile(__FILE__ + ".local") if File.exist?(__FILE__ + ".local")
data/Rakefile CHANGED
@@ -51,20 +51,4 @@ namespace :style do
51
51
  rescue LoadError => e
52
52
  puts ">>> Gem load error: #{e}, omitting #{task.name}" unless ENV["CI"]
53
53
  end
54
-
55
- begin
56
- require "foodcritic"
57
-
58
- desc "Run Chef Cookbook (Foodcritic) style checks"
59
- FoodCritic::Rake::LintTask.new(:foodcritic) do |t|
60
- t.options = {
61
- fail_tags: ["any"],
62
- tags: ["~FC071", "~supermarket", "~FC031"],
63
- cookbook_paths: ["lib/chef-cli/skeletons/code_generator"],
64
- progress: true,
65
- }
66
- end
67
- rescue LoadError => e
68
- puts ">>> Gem load error: #{e}, omitting #{task.name}" unless ENV["CI"]
69
- end
70
54
  end
File without changes
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright:: Copyright (c) 2014-2019, Chef Software Inc.
2
+ # Copyright:: Copyright (c) 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");
@@ -29,13 +29,13 @@ Gem::Specification.new do |gem|
29
29
  gem.license = "Apache-2.0"
30
30
  gem.homepage = "https://www.chef.io/"
31
31
 
32
- gem.required_ruby_version = ">= 2.4"
32
+ gem.required_ruby_version = ">= 2.7"
33
33
 
34
34
  gem.files = %w{Rakefile LICENSE} +
35
35
  Dir.glob("Gemfile*") + # Includes Gemfile and locks
36
36
  Dir.glob("*.gemspec") +
37
37
  Dir.glob("{lib,spec}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) }
38
- gem.executables = %w{ chef }
38
+ gem.executables = %w{ chef-cli }
39
39
  gem.test_files = gem.files.grep(%r{^spec/})
40
40
  gem.require_paths = ["lib"]
41
41
 
@@ -43,11 +43,12 @@ Gem::Specification.new do |gem|
43
43
  gem.add_dependency "mixlib-shellout", ">= 2.0", "< 4.0"
44
44
  gem.add_dependency "ffi-yajl", ">= 1.0", "< 3.0"
45
45
  gem.add_dependency "minitar", "~> 0.6"
46
- gem.add_dependency "chef", ">= 14.0"
46
+ gem.add_dependency "chef", ">= 15.0"
47
47
  gem.add_dependency "solve", "< 5.0", "> 2.0"
48
- gem.add_dependency "addressable", ">= 2.3.5", "< 2.6"
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", "~> 1.0"
51
+ gem.add_dependency "paint", ">= 1", "< 3"
52
52
  gem.add_dependency "license-acceptance", "~> 1.0", ">= 1.0.11"
53
+ gem.add_development_dependency "test-kitchen", "> 2.5"
53
54
  end
@@ -34,9 +34,9 @@ module ChefCLI
34
34
 
35
35
  banner(<<~BANNER)
36
36
  Usage:
37
- chef -h/--help
38
- chef -v/--version
39
- chef command [arguments...] [options...]
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}": "chef",
108
+ { "#{ChefCLI::Dist::INFRA_CLIENT_PRODUCT}": "#{ChefCLI::Dist::INFRA_CLIENT_GEM}",
109
109
  "#{ChefCLI::Dist::INSPEC_PRODUCT}": "#{ChefCLI::Dist::INSPEC_CLI}",
110
- "Chef CLI": "chef-cli",
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|
@@ -122,7 +122,7 @@ module ChefCLI
122
122
  "Test Kitchen": "kitchen",
123
123
  "Cookstyle": "cookstyle",
124
124
  }.each do |name, cli|
125
- result = Bundler.with_clean_env { shell_out("#{cli} --version") }
125
+ result = Bundler.with_unbundled_env { shell_out("#{cli} --version") }
126
126
  if result.exitstatus != 0
127
127
  msg("#{name} version: ERROR")
128
128
  else
@@ -37,7 +37,7 @@ module ChefCLI
37
37
 
38
38
  See our detailed README for more information:
39
39
 
40
- https://docs.chef.io/policyfile.html
40
+ https://docs.chef.io/policyfile/
41
41
 
42
42
  Options:
43
43
 
@@ -36,7 +36,7 @@ module ChefCLI
36
36
 
37
37
  See our detailed README for more information:
38
38
 
39
- https://docs.chef.io/policyfile.html
39
+ https://docs.chef.io/policyfile/
40
40
 
41
41
  Options:
42
42
 
@@ -36,7 +36,7 @@ module ChefCLI
36
36
 
37
37
  See our detailed README for more information:
38
38
 
39
- https://docs.chef.io/policyfile.html
39
+ https://docs.chef.io/policyfile/
40
40
 
41
41
  Options:
42
42
 
@@ -36,7 +36,7 @@ module ChefCLI
36
36
 
37
37
  See our detailed README for more information:
38
38
 
39
- https://docs.chef.io/policyfile.html
39
+ https://docs.chef.io/policyfile/
40
40
 
41
41
  Options:
42
42
 
@@ -87,7 +87,7 @@ module ChefCLI
87
87
  remaining_args = parse_options(params)
88
88
  if remaining_args.size != 1
89
89
  ui.err(opt_parser)
90
- return false
90
+ false
91
91
  else
92
92
  @cookbook_path = File.expand_path(remaining_args.first)
93
93
  true
@@ -41,7 +41,7 @@ module ChefCLI
41
41
 
42
42
  See our detailed README for more information:
43
43
 
44
- https://docs.chef.io/policyfile.html
44
+ https://docs.chef.io/policyfile/
45
45
 
46
46
  Options:
47
47
 
@@ -216,7 +216,7 @@ module ChefCLI
216
216
  if !@cookbook_name_or_path
217
217
  @params_valid = false
218
218
  elsif /-/ =~ File.basename(@cookbook_name_or_path)
219
- msg("Hyphens are discouraged in cookbook names as they may cause problems with custom resources. See https://docs.chef.io/ctl_chef.html#chef-generate-cookbook for more information.")
219
+ 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
220
  end
221
221
 
222
222
  if config[:berks] && config[:policy]
@@ -111,7 +111,6 @@ module ChefCLI
111
111
  <<~METADATA
112
112
  name '#{cookbook_name}'
113
113
  description 'Custom code generator cookbook for use with #{ChefCLI::Dist::PRODUCT}'
114
- long_description 'Custom code generator cookbook for use with #{ChefCLI::Dist::PRODUCT}'
115
114
  version '0.1.0'
116
115
 
117
116
  METADATA
@@ -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
- return false
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
- return false
88
+ false
89
89
  end
90
90
  end
91
91
 
@@ -40,7 +40,7 @@ module ChefCLI
40
40
 
41
41
  See our detailed README for more information:
42
42
 
43
- https://docs.chef.io/policyfile.html
43
+ https://docs.chef.io/policyfile/
44
44
 
45
45
  Options:
46
46
 
@@ -110,7 +110,7 @@ module ChefCLI
110
110
  remaining_args = parse_options(params)
111
111
  if remaining_args.size > 1
112
112
  ui.err(opt_parser)
113
- return false
113
+ false
114
114
  else
115
115
  @policyfile_relative_path = remaining_args.first
116
116
  true
@@ -38,7 +38,7 @@ module ChefCLI
38
38
 
39
39
  See our detailed README for more information:
40
40
 
41
- https://docs.chef.io/policyfile.html
41
+ https://docs.chef.io/policyfile/
42
42
 
43
43
  Options:
44
44
 
@@ -38,7 +38,7 @@ module ChefCLI
38
38
 
39
39
  For more information about Policyfiles, see our detailed README:
40
40
 
41
- https://docs.chef.io/policyfile.html
41
+ https://docs.chef.io/policyfile/
42
42
 
43
43
  Options:
44
44
  E
@@ -40,7 +40,7 @@ module ChefCLI
40
40
 
41
41
  See our detailed README for more information:
42
42
 
43
- https://docs.chef.io/policyfile.html
43
+ https://docs.chef.io/policyfile/
44
44
 
45
45
  Options:
46
46
 
@@ -47,7 +47,7 @@ module ChefCLI
47
47
 
48
48
  See our detailed README for more information:
49
49
 
50
- https://docs.chef.io/policyfile.html
50
+ https://docs.chef.io/policyfile/
51
51
 
52
52
  Options:
53
53
 
@@ -43,7 +43,7 @@ module ChefCLI
43
43
 
44
44
  See our detailed README for more information:
45
45
 
46
- https://docs.chef.io/policyfile.html
46
+ https://docs.chef.io/policyfile/
47
47
 
48
48
  Options:
49
49
 
@@ -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
 
@@ -150,7 +150,7 @@ module ChefCLI
150
150
  along with this program. If not, see <http://www.gnu.org/licenses/>.
151
151
  EOH
152
152
  else
153
- raise ArgumentError, "Invalid generator.license setting: #{license}. See available licenses at https://docs.chef.io/ctl_chef.html#chef-generate-cookbook"
153
+ raise ArgumentError, "Invalid generator.license setting: #{license}. See available licenses at https://docs.chef.io/ctl_chef/#chef-generate-cookbook"
154
154
  end
155
155
  if comment
156
156
  # Ensure there's no trailing whitespace
@@ -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"], "chef-workstation")
144
+ File.join(ENV["LOCALAPPDATA"], "#{ChefCLI::Dist::PRODUCT_PKG_HOME}")
145
145
  else
146
- File.expand_path("~/.chef-workstation")
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
- expected_path.exist?
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
- return
27
+ nil
28
28
  elsif included_id[0, 10].eql?(expected_id) # did they use the 10 char substring
29
- return
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::HTTPServerException => e
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::HTTPServerException => e
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::HTTPServerException => e
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 awhile 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.
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-71> (1m26.83s).
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 foodcritic/rubocop on my local system?
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