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.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -6
  3. data/chef-cli.gemspec +2 -2
  4. data/lib/chef-cli/cli.rb +5 -5
  5. data/lib/chef-cli/command/describe_cookbook.rb +1 -1
  6. data/lib/chef-cli/command/generator_commands/policyfile.rb +2 -2
  7. data/lib/chef-cli/command/install.rb +1 -1
  8. data/lib/chef-cli/dist.rb +8 -0
  9. data/lib/chef-cli/helpers.rb +2 -2
  10. data/lib/chef-cli/policyfile/cookbook_location_specification.rb +2 -1
  11. data/lib/chef-cli/policyfile/lock_fetcher_mixin.rb +2 -2
  12. data/lib/chef-cli/policyfile/uploader.rb +2 -2
  13. data/lib/chef-cli/policyfile_services/export_repo.rb +5 -0
  14. data/lib/chef-cli/policyfile_services/install.rb +2 -0
  15. data/lib/chef-cli/policyfile_services/rm_policy.rb +1 -1
  16. data/lib/chef-cli/policyfile_services/update_attributes.rb +2 -0
  17. data/lib/chef-cli/skeletons/code_generator/files/default/build_cookbook/README.md +3 -3
  18. data/lib/chef-cli/skeletons/code_generator/files/default/build_cookbook/kitchen.yml +1 -1
  19. data/lib/chef-cli/skeletons/code_generator/files/default/chefignore +2 -1
  20. data/lib/chef-cli/skeletons/code_generator/files/default/cookbook_readmes/README-policy.md +1 -1
  21. data/lib/chef-cli/skeletons/code_generator/files/default/cookbook_readmes/README.md +2 -2
  22. data/lib/chef-cli/skeletons/code_generator/files/default/repo/cookbooks/example/README.md +2 -2
  23. data/lib/chef-cli/skeletons/code_generator/recipes/build_cookbook.rb +2 -2
  24. data/lib/chef-cli/skeletons/code_generator/recipes/cookbook.rb +1 -1
  25. data/lib/chef-cli/skeletons/code_generator/recipes/repo.rb +1 -1
  26. data/lib/chef-cli/skeletons/code_generator/templates/default/kitchen.yml.erb +1 -1
  27. data/lib/chef-cli/skeletons/code_generator/templates/default/kitchen_dokken.yml.erb +2 -2
  28. data/lib/chef-cli/skeletons/code_generator/templates/default/kitchen_policyfile.yml.erb +1 -1
  29. data/lib/chef-cli/version.rb +1 -1
  30. data/spec/unit/command/generator_commands/cookbook_spec.rb +4 -4
  31. data/spec/unit/command/generator_commands/repo_spec.rb +1 -1
  32. data/spec/unit/policyfile/cookbook_location_specification_spec.rb +5 -0
  33. data/spec/unit/policyfile/uploader_spec.rb +2 -2
  34. data/spec/unit/policyfile_lock_build_spec.rb +1 -1
  35. data/spec/unit/policyfile_services/clean_policies_spec.rb +2 -0
  36. data/spec/unit/policyfile_services/update_attributes_spec.rb +1 -1
  37. data/spec/unit/service_exception_inspectors/http_spec.rb +1 -1
  38. metadata +14 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a332f5ef78a94ff791b922851caaa215aa6e405d0527c86bfce99700b8e24ac6
4
- data.tar.gz: 691ba55cbd141be7d1fa47008ca2683ba3d9be29993ea0a9f04a87b598aeb4fa
3
+ metadata.gz: 7ebc60c7c08e91010059db01bc99774da3a071cb08320ed2cedd0f3faec80efa
4
+ data.tar.gz: '08b56a1c62d520a03198a1c7e5dbbff004d967571945eb0049f665a7379e5e96'
5
5
  SHA512:
6
- metadata.gz: 9371a1c03deded16d223414d60688cb1dfeabbd40491b41bcc821e8d99b83ef716ad405b19121a25568df0a7bafd3f552500626e004ed8385603d11f2972618c
7
- data.tar.gz: '092c102be465ef8212c25fcd6df21ec372e6e743c389422308e43ce877c2a1c08c8a3d1205a7013f6d17c2aafc2240bc116f13c72b7fdb761c99f49ebe017537'
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.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
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
- 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|
@@ -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
@@ -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
 
@@ -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
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
 
@@ -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/cookstyle 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
 
@@ -12,7 +12,7 @@ provisioner:
12
12
 
13
13
  platforms:
14
14
  - name: ubuntu-18.04
15
- - name: centos-7
15
+ - name: centos-8
16
16
 
17
17
  suites:
18
18
  - name: default
@@ -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
- # Cookbooks #
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 the comments in those files.
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
 
@@ -4,11 +4,11 @@ An example cookbook
4
4
 
5
5
  ## Requirements
6
6
 
7
- ### Platforms:
7
+ ### Platforms
8
8
 
9
9
  _No platforms defined_
10
10
 
11
- ### Cookbooks:
11
+ ### Cookbooks
12
12
 
13
13
  _No dependencies defined_
14
14
 
@@ -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
 
@@ -60,7 +60,7 @@ if context.have_git
60
60
  execute('initialize-git') do
61
61
  command('git init .')
62
62
  cwd repo_dir
63
- not_if { File.exist?("#{repo_dir}/.gitignore") }
63
+ not_if { ::File.exist?("#{repo_dir}/.gitignore") }
64
64
  end
65
65
  end
66
66
  template "#{repo_dir}/.gitignore" do
@@ -26,7 +26,7 @@ verifier:
26
26
 
27
27
  platforms:
28
28
  - name: ubuntu-18.04
29
- - name: centos-7
29
+ - name: centos-8
30
30
 
31
31
  suites:
32
32
  - name: default
@@ -21,9 +21,9 @@ platforms:
21
21
  intermediate_instructions:
22
22
  - RUN /usr/bin/apt-get update
23
23
 
24
- - name: centos-7
24
+ - name: centos-8
25
25
  driver:
26
- image: dokken/centos-7
26
+ image: dokken/centos-8
27
27
  pid_one_command: /usr/lib/systemd/systemd
28
28
 
29
29
  suites:
@@ -22,7 +22,7 @@ verifier:
22
22
 
23
23
  platforms:
24
24
  - name: ubuntu-18.04
25
- - name: centos-7
25
+ - name: centos-8
26
26
 
27
27
  suites:
28
28
  - name: default
@@ -16,5 +16,5 @@
16
16
  #
17
17
 
18
18
  module ChefCLI
19
- VERSION = "2.0.0".freeze
19
+ VERSION = "2.0.10".freeze
20
20
  end
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright:: Copyright (c) 2014-2019 Chef Software Inc.
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:: 2019, The Authors, All Rights Reserved.
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-7
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-7
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::HTTPServerException.new("conflict", response)
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::HTTPServerException.new("Not Found", response)
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).not_to receive(:with_unlocked_policies)
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::HTTPServerException.new(message, response).tap { |e| e.chef_rest_request = request }
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.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: 2019-10-01 00:00:00.000000000 Z
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.6'
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.6'
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.0'
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.0'
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