chef-cli 3.0.27 → 3.0.35
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/chef-cli +2 -2
- data/lib/chef-cli/cli.rb +6 -2
- data/lib/chef-cli/command/env.rb +7 -4
- data/lib/chef-cli/command/exec.rb +4 -1
- data/lib/chef-cli/command/generator_commands.rb +1 -1
- data/lib/chef-cli/command/generator_commands/cookbook.rb +5 -0
- data/lib/chef-cli/command/shell_init.rb +5 -2
- data/lib/chef-cli/cookbook_profiler/identifiers.rb +1 -1
- data/lib/chef-cli/dist.rb +7 -2
- data/lib/chef-cli/generator.rb +1 -1
- data/lib/chef-cli/helpers.rb +5 -2
- data/lib/chef-cli/policyfile/chef_server_cookbook_source.rb +1 -1
- data/lib/chef-cli/policyfile/comparison_base.rb +6 -2
- data/lib/chef-cli/policyfile/differ.rb +1 -1
- data/lib/chef-cli/policyfile/git_lock_fetcher.rb +4 -1
- data/lib/chef-cli/policyfile/lister.rb +1 -1
- data/lib/chef-cli/policyfile/remote_lock_fetcher.rb +1 -1
- data/lib/chef-cli/policyfile/solution_dependencies.rb +1 -1
- data/lib/chef-cli/policyfile/source_uri.rb +4 -1
- data/lib/chef-cli/policyfile/storage_config.rb +1 -1
- data/lib/chef-cli/policyfile/undo_stack.rb +1 -1
- data/lib/chef-cli/policyfile_compiler.rb +1 -1
- data/lib/chef-cli/policyfile_services/clean_policy_cookbooks.rb +1 -1
- data/lib/chef-cli/policyfile_services/export_repo.rb +1 -1
- data/lib/chef-cli/policyfile_services/install.rb +8 -6
- data/lib/chef-cli/policyfile_services/push.rb +1 -1
- data/lib/chef-cli/policyfile_services/push_archive.rb +1 -1
- data/lib/chef-cli/service_exception_inspectors/http.rb +1 -27
- data/lib/chef-cli/shell_out.rb +3 -1
- data/lib/chef-cli/skeletons/code_generator/files/default/gitignore +1 -1
- data/lib/chef-cli/skeletons/code_generator/files/default/repo/README.md +3 -3
- data/lib/chef-cli/skeletons/code_generator/recipes/cookbook.rb +15 -2
- data/lib/chef-cli/version.rb +1 -1
- data/lib/kitchen/provisioner/chef_zero_capture.rb +0 -1
- data/spec/test_helpers.rb +2 -2
- data/spec/unit/cli_spec.rb +4 -1
- data/spec/unit/command/env_spec.rb +1 -1
- data/spec/unit/command/exec_spec.rb +1 -1
- data/spec/unit/fixtures/cookbooks_api/update_fixtures.rb +3 -6
- data/spec/unit/policyfile/storage_config_spec.rb +2 -2
- data/spec/unit/policyfile_services/install_spec.rb +20 -0
- data/spec/unit/service_exception_inspectors/http_spec.rb +3 -17
- 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: 027ecd97cab2e569bf86814f9e3788746e9b55a3f31349269b4429e757b96ef9
|
4
|
+
data.tar.gz: 354eb9e12001d0a46cab5b3989e352dec5802885f99dd0a69a9d7a90e3613cab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 129c857eb35d45bfaf5b1ebec95bc80e691571b327d875d7da4ac7e26c7192ee6f5ac2ed79ffbd22cba920284b4c07609f50f0065b242ad93e1b5ad75a902f44
|
7
|
+
data.tar.gz: 7b8813adc11b52f0b5e6280444db3e025e9aa57494b2d17af59cb93ebf7a464e5a9670ecc15b99f5e143383ef073f35d04f56e2fe56b02a2bbc36b5da3ce6ad4
|
data/bin/chef-cli
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
#
|
3
|
-
# Copyright:: Copyright (c)
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -19,7 +19,7 @@
|
|
19
19
|
# Set a trap for ctrl-C right away so we don't surface interrupt exceptions inside of rubygems or whatever.
|
20
20
|
Kernel.trap(:INT) { print("\n"); exit 1 }
|
21
21
|
|
22
|
-
$:.unshift(File.expand_path(File.join(
|
22
|
+
$:.unshift(File.expand_path(File.join(__dir__, "..", "lib")))
|
23
23
|
require "chef-cli/cli"
|
24
24
|
|
25
25
|
ChefCLI::CLI.new(ARGV.clone).run(enforce_license: true)
|
data/lib/chef-cli/cli.rb
CHANGED
@@ -33,6 +33,10 @@ module ChefCLI
|
|
33
33
|
include Chef::Mixin::ShellOut
|
34
34
|
|
35
35
|
banner(<<~BANNER)
|
36
|
+
#{ChefCLI::Dist::WORKSTATION_HEADER}
|
37
|
+
Docs: #{ChefCLI::Dist::WORKSTATION_DOCS}
|
38
|
+
Patents: #{ChefCLI::Dist::PATENTS}
|
39
|
+
|
36
40
|
Usage:
|
37
41
|
#{ChefCLI::Dist::EXEC} -h/--help
|
38
42
|
#{ChefCLI::Dist::EXEC} -v/--version
|
@@ -119,13 +123,13 @@ module ChefCLI
|
|
119
123
|
|
120
124
|
def show_help
|
121
125
|
msg(banner)
|
122
|
-
msg("
|
126
|
+
msg("Available Commands:")
|
123
127
|
|
124
128
|
justify_length = subcommands.map(&:length).max + 2
|
125
129
|
subcommand_specs.each do |name, spec|
|
126
130
|
next if spec.hidden
|
127
131
|
|
128
|
-
msg(" #{
|
132
|
+
msg(" #{name.to_s.ljust(justify_length)}#{spec.description}")
|
129
133
|
end
|
130
134
|
end
|
131
135
|
|
data/lib/chef-cli/command/env.rb
CHANGED
@@ -20,8 +20,11 @@ require_relative "../cookbook_omnifetch"
|
|
20
20
|
require_relative "../ui"
|
21
21
|
require_relative "../version"
|
22
22
|
require_relative "../dist"
|
23
|
-
|
24
|
-
|
23
|
+
|
24
|
+
module Mixlib
|
25
|
+
autoload :ShellOut, "mixlib/shellout"
|
26
|
+
end
|
27
|
+
autoload :YAML, "yaml"
|
25
28
|
|
26
29
|
module ChefCLI
|
27
30
|
module Command
|
@@ -37,10 +40,10 @@ module ChefCLI
|
|
37
40
|
|
38
41
|
def run(params)
|
39
42
|
info = {}
|
40
|
-
info[
|
43
|
+
info[ChefCLI::Dist::PRODUCT] = workstation_info
|
41
44
|
info["Ruby"] = ruby_info
|
42
45
|
info["Path"] = paths
|
43
|
-
ui.msg info
|
46
|
+
ui.msg YAML.dump(info)
|
44
47
|
end
|
45
48
|
|
46
49
|
def workstation_info
|
@@ -137,6 +137,7 @@ module ChefCLI
|
|
137
137
|
Generator.add_attr_to_context(:use_policyfile, policy_mode?)
|
138
138
|
Generator.add_attr_to_context(:pipeline, pipeline)
|
139
139
|
Generator.add_attr_to_context(:kitchen, kitchen)
|
140
|
+
Generator.add_attr_to_context(:vscode_dir, create_vscode_dir?)
|
140
141
|
end
|
141
142
|
|
142
143
|
def kitchen
|
@@ -235,6 +236,10 @@ module ChefCLI
|
|
235
236
|
end
|
236
237
|
false
|
237
238
|
end
|
239
|
+
|
240
|
+
def create_vscode_dir?
|
241
|
+
::File.exist?("/Applications/Visual Studio Code.app") || ::File.exist?("#{ENV["APPDATA"]}\\Code")
|
242
|
+
end
|
238
243
|
end
|
239
244
|
end
|
240
245
|
end
|
@@ -15,13 +15,16 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
|
18
|
+
autoload :ERB, "erb"
|
19
19
|
|
20
20
|
require_relative "../commands_map"
|
21
21
|
require_relative "../builtin_commands"
|
22
22
|
require_relative "base"
|
23
23
|
require_relative "../dist"
|
24
|
-
|
24
|
+
|
25
|
+
module Mixlib
|
26
|
+
autoload :ShellOut, "mixlib/shellout"
|
27
|
+
end
|
25
28
|
|
26
29
|
module ChefCLI
|
27
30
|
|
@@ -18,7 +18,7 @@
|
|
18
18
|
# TODO: Chef should require its dependency correctly.
|
19
19
|
require "singleton" unless defined?(Singleton)
|
20
20
|
require "chef/cookbook/cookbook_version_loader"
|
21
|
-
require "digest/sha1"
|
21
|
+
require "digest/sha1" unless defined?(Digest::SHA1)
|
22
22
|
|
23
23
|
require "chef/digester"
|
24
24
|
|
data/lib/chef-cli/dist.rb
CHANGED
@@ -27,7 +27,6 @@ module ChefCLI
|
|
27
27
|
|
28
28
|
# The name of the server product
|
29
29
|
SERVER_PRODUCT = "Chef Infra Server".freeze
|
30
|
-
|
31
30
|
WORKFLOW = "Chef Workflow (Delivery)".freeze
|
32
31
|
|
33
32
|
# The chef executable, as in `chef gem install` or `chef generate cookbook`
|
@@ -38,7 +37,13 @@ module ChefCLI
|
|
38
37
|
|
39
38
|
HAB_PRODUCT = "Chef Habitat".freeze
|
40
39
|
HAB_SOFTWARE_NAME = "habitat".freeze
|
41
|
-
|
42
40
|
HAB_CLI = "hab".freeze
|
41
|
+
|
42
|
+
# product patents page
|
43
|
+
PATENTS = "https://www.chef.io/patents".freeze
|
44
|
+
|
45
|
+
# Workstation banner/help text
|
46
|
+
WORKSTATION_DOCS = "https://docs.chef.io/workstation/".freeze
|
47
|
+
WORKSTATION_HEADER = "The Chef command line tool for managing your infrastructure from your workstation.".freeze
|
43
48
|
end
|
44
49
|
end
|
data/lib/chef-cli/generator.rb
CHANGED
@@ -154,7 +154,7 @@ module ChefCLI
|
|
154
154
|
end
|
155
155
|
if comment
|
156
156
|
# Ensure there's no trailing whitespace
|
157
|
-
result.gsub(/^(.+)$/, "#{comment} \\1").gsub(/^$/,
|
157
|
+
result.gsub(/^(.+)$/, "#{comment} \\1").gsub(/^$/, comment).strip
|
158
158
|
else
|
159
159
|
result
|
160
160
|
end
|
data/lib/chef-cli/helpers.rb
CHANGED
@@ -15,7 +15,10 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
|
18
|
+
module Mixlib
|
19
|
+
autoload :ShellOut, "mixlib/shellout"
|
20
|
+
end
|
21
|
+
|
19
22
|
require_relative "exceptions"
|
20
23
|
|
21
24
|
module ChefCLI
|
@@ -141,7 +144,7 @@ module ChefCLI
|
|
141
144
|
|
142
145
|
def default_package_home
|
143
146
|
if Chef::Platform.windows?
|
144
|
-
File.join(ENV["LOCALAPPDATA"],
|
147
|
+
File.join(ENV["LOCALAPPDATA"], ChefCLI::Dist::PRODUCT_PKG_HOME)
|
145
148
|
else
|
146
149
|
File.expand_path("~/.#{ChefCLI::Dist::PRODUCT_PKG_HOME}")
|
147
150
|
end
|
@@ -15,9 +15,13 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
module Mixlib
|
19
|
+
autoload :ShellOut, "mixlib/shellout"
|
20
|
+
end
|
21
|
+
|
22
|
+
autoload :FFI_Yajl, "ffi_yajl"
|
20
23
|
require_relative "../service_exceptions"
|
24
|
+
require "net/protocol" unless defined?(Net::ProtocolError)
|
21
25
|
|
22
26
|
module ChefCLI
|
23
27
|
module Policyfile
|
@@ -15,10 +15,13 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
+
module Mixlib
|
19
|
+
autoload :ShellOut, "mixlib/shellout"
|
20
|
+
end
|
21
|
+
|
18
22
|
require_relative "../policyfile_lock"
|
19
23
|
require_relative "../exceptions"
|
20
24
|
require_relative "../helpers"
|
21
|
-
require "mixlib/shellout" unless defined?(Mixlib::ShellOut)
|
22
25
|
require "tmpdir" unless defined?(Dir.mktmpdir)
|
23
26
|
|
24
27
|
module ChefCLI
|
@@ -18,7 +18,7 @@
|
|
18
18
|
require_relative "../policyfile_lock"
|
19
19
|
require_relative "lock_fetcher_mixin"
|
20
20
|
require_relative "../exceptions"
|
21
|
-
require "
|
21
|
+
require "net/protocol" unless defined?(Net::ProtocolError)
|
22
22
|
require "tempfile" unless defined?(Tempfile)
|
23
23
|
|
24
24
|
module ChefCLI
|
@@ -52,7 +52,7 @@ module ChefCLI
|
|
52
52
|
return use_policyfile_lock(policyfile_filename)
|
53
53
|
end
|
54
54
|
unless policyfile_filename.end_with?(".rb")
|
55
|
-
raise InvalidPolicyfileFilename, "Policyfile filenames must end with `.rb' extension (you gave: `#{policyfile_filename}')"
|
55
|
+
raise InvalidPolicyfileFilename, "Policyfile filenames must end with an `.rb' or `.lock.json' extension (you gave: `#{policyfile_filename}')"
|
56
56
|
end
|
57
57
|
|
58
58
|
@policyfile_filename = policyfile_filename
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
|
18
|
+
autoload :FFI_Yajl, "ffi_yajl"
|
19
19
|
|
20
20
|
require_relative "../helpers"
|
21
21
|
require_relative "../service_exceptions"
|
@@ -42,8 +42,8 @@ module ChefCLI
|
|
42
42
|
@overwrite = overwrite
|
43
43
|
@chef_config = config
|
44
44
|
|
45
|
-
policyfile_rel_path = policyfile || "Policyfile.rb"
|
46
|
-
policyfile_full_path = File.expand_path(policyfile_rel_path, root_dir)
|
45
|
+
@policyfile_rel_path = policyfile || "Policyfile.rb"
|
46
|
+
policyfile_full_path = File.expand_path(@policyfile_rel_path, root_dir)
|
47
47
|
@storage_config = Policyfile::StorageConfig.new.use_policyfile(policyfile_full_path)
|
48
48
|
|
49
49
|
@policyfile_content = nil
|
@@ -51,9 +51,11 @@ module ChefCLI
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def run(cookbooks_to_update = [], exclude_deps = false)
|
54
|
-
|
55
|
-
|
56
|
-
|
54
|
+
# TODO: suggest next step. Add a generator/init command? Specify path to Policyfile.rb?
|
55
|
+
# See card CC-232
|
56
|
+
if @policyfile_rel_path.end_with?(".lock.json") && !File.exist?(policyfile_lock_expanded_path)
|
57
|
+
raise PolicyfileNotFound, "Policyfile lock not found at path #{policyfile_lock_expanded_path}"
|
58
|
+
elsif @policyfile_rel_path.end_with?(".rb") && !File.exist?(policyfile_expanded_path)
|
57
59
|
raise PolicyfileNotFound, "Policyfile not found at path #{policyfile_expanded_path}"
|
58
60
|
end
|
59
61
|
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
|
18
|
+
autoload :FFI_Yajl, "ffi_yajl"
|
19
19
|
|
20
20
|
module ChefCLI
|
21
21
|
module ServiceExceptionInspectors
|
@@ -33,17 +33,11 @@ module ChefCLI
|
|
33
33
|
|
34
34
|
def extended_error_info
|
35
35
|
<<~END
|
36
|
-
--- REQUEST DATA ----
|
37
|
-
#{http_method} #{uri}
|
38
|
-
#{request_headers}
|
39
|
-
#{req_body}
|
40
|
-
|
41
36
|
--- RESPONSE DATA ---
|
42
37
|
#{code} #{response_message}
|
43
38
|
#{response_headers}
|
44
39
|
|
45
40
|
#{response_body}
|
46
|
-
|
47
41
|
END
|
48
42
|
end
|
49
43
|
|
@@ -90,30 +84,10 @@ module ChefCLI
|
|
90
84
|
headers_s
|
91
85
|
end
|
92
86
|
|
93
|
-
def request
|
94
|
-
exception.chef_rest_request
|
95
|
-
end
|
96
|
-
|
97
87
|
def uri
|
98
88
|
request.uri.to_s + request.path.to_s
|
99
89
|
end
|
100
90
|
|
101
|
-
def http_method
|
102
|
-
request.method
|
103
|
-
end
|
104
|
-
|
105
|
-
def request_headers
|
106
|
-
headers_s = ""
|
107
|
-
request.each_header do |key, value|
|
108
|
-
headers_s << key << ": " << value << "\n"
|
109
|
-
end
|
110
|
-
headers_s
|
111
|
-
end
|
112
|
-
|
113
|
-
def req_body
|
114
|
-
request.body
|
115
|
-
end
|
116
|
-
|
117
91
|
end
|
118
92
|
end
|
119
93
|
end
|
data/lib/chef-cli/shell_out.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Every Chef Infra installation needs a Chef Repository. This is the place where cookbooks, policyfiles, config files and other artifacts for managing systems with Chef Infra will live. We strongly recommend storing this repository in a version control system such as Git and treating it like source code.
|
4
4
|
|
5
|
-
|
5
|
+
## Repository Directories
|
6
6
|
|
7
7
|
This repository contains several directories, and each directory contains a README file that describes what it is for in greater detail, and how to use it for managing your systems with Chef.
|
8
8
|
|
@@ -11,10 +11,10 @@ This repository contains several directories, and each directory contains a READ
|
|
11
11
|
- `roles/` - Store roles in .rb or .json in the repository.
|
12
12
|
- `environments/` - Store environments in .rb or .json in the repository.
|
13
13
|
|
14
|
-
|
14
|
+
## Configuration
|
15
15
|
|
16
16
|
The config file, `.chef/config.rb` is a repository-specific configuration file for the knife command line tool. If you're using the Hosted Chef platform, you can download one for your organization from the management console. You can also generate a new config.rb by running `knife configure`. For more information about configuring Knife, see the Knife documentation at https://docs.chef.io/workstation/knife/
|
17
17
|
|
18
|
-
|
18
|
+
## Next Steps
|
19
19
|
|
20
20
|
Read the README file in each of the subdirectories for more information about what goes in those directories.
|
@@ -91,7 +91,7 @@ template "#{cookbook_dir}/test/integration/default/default_test.rb" do
|
|
91
91
|
action :create_if_missing
|
92
92
|
end
|
93
93
|
|
94
|
-
#
|
94
|
+
# ChefSpec
|
95
95
|
directory "#{cookbook_dir}/spec/unit/recipes" do
|
96
96
|
recursive true
|
97
97
|
end
|
@@ -113,7 +113,6 @@ template "#{cookbook_dir}/spec/unit/recipes/default_spec.rb" do
|
|
113
113
|
end
|
114
114
|
|
115
115
|
# Recipes
|
116
|
-
|
117
116
|
directory "#{cookbook_dir}/recipes"
|
118
117
|
|
119
118
|
template "#{cookbook_dir}/recipes/default.rb" do
|
@@ -164,4 +163,18 @@ if context.have_git
|
|
164
163
|
end
|
165
164
|
end
|
166
165
|
|
166
|
+
if context.vscode_dir
|
167
|
+
directory "#{cookbook_dir}/.vscode"
|
168
|
+
|
169
|
+
file "#{cookbook_dir}/.vscode/extensions.json" do
|
170
|
+
content <<~CONTENT
|
171
|
+
{
|
172
|
+
"recommendations": [
|
173
|
+
"chef-software.chef"
|
174
|
+
]
|
175
|
+
}
|
176
|
+
CONTENT
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
167
180
|
include_recipe '::build_cookbook' if context.enable_workflow
|
data/lib/chef-cli/version.rb
CHANGED
data/spec/test_helpers.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright:: Copyright (c)
|
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");
|
@@ -35,7 +35,7 @@ module TestHelpers
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def fixtures_path
|
38
|
-
File.expand_path(
|
38
|
+
File.expand_path(__dir__ + "/unit/fixtures/")
|
39
39
|
end
|
40
40
|
|
41
41
|
def project_root
|
data/spec/unit/cli_spec.rb
CHANGED
@@ -41,12 +41,15 @@ describe ChefCLI::CLI do
|
|
41
41
|
|
42
42
|
let(:base_help_message) do
|
43
43
|
<<~E
|
44
|
+
#{ChefCLI::Dist::WORKSTATION_HEADER}
|
45
|
+
Docs: #{ChefCLI::Dist::WORKSTATION_DOCS}
|
46
|
+
Patents: #{ChefCLI::Dist::PATENTS}
|
47
|
+
|
44
48
|
Usage:
|
45
49
|
chef -h/--help
|
46
50
|
chef -v/--version
|
47
51
|
chef command [arguments...] [options...]
|
48
52
|
|
49
|
-
|
50
53
|
Available Commands:
|
51
54
|
gem Runs the `gem` command in context of the embedded ruby
|
52
55
|
example Example subcommand for testing
|
@@ -127,7 +127,7 @@ describe ChefCLI::Command::Exec do
|
|
127
127
|
end
|
128
128
|
|
129
129
|
context "when running a exec with #{switch}" do
|
130
|
-
let(:command_options) { [
|
130
|
+
let(:command_options) { [switch] }
|
131
131
|
|
132
132
|
it "should call not call exec, but it should print the banner" do
|
133
133
|
allow(command_instance).to receive(:msg)
|
@@ -1,14 +1,11 @@
|
|
1
1
|
require "openssl"
|
2
2
|
require "net/http" unless defined?(Net::HTTP)
|
3
3
|
require "json" unless defined?(JSON)
|
4
|
-
require "pp"
|
5
4
|
require "uri"
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
SMALL_UNIVERSE_JSON_PATH = File.join(THIS_DIR, "small_universe.json")
|
11
|
-
PRUNED_UNIVERSE_PATH = File.join(THIS_DIR, "pruned_small_universe.json")
|
6
|
+
UNIVERSE_JSON_PATH = File.join(__dir__, "universe.json")
|
7
|
+
SMALL_UNIVERSE_JSON_PATH = File.join(__dir__, "small_universe.json")
|
8
|
+
PRUNED_UNIVERSE_PATH = File.join(__dir__, "pruned_small_universe.json")
|
12
9
|
|
13
10
|
COOKBOOKS_IN_SMALL_UNIVERSE = %w{apache2 application apt database mysql nginx postgresql yum}.freeze
|
14
11
|
|
@@ -106,10 +106,10 @@ describe ChefCLI::Policyfile::StorageConfig do
|
|
106
106
|
|
107
107
|
end
|
108
108
|
|
109
|
-
context "when the policyfile file name doesn't have
|
109
|
+
context "when the policyfile file name doesn't have an .rb or .lock.json extension" do
|
110
110
|
|
111
111
|
it "raises an error" do
|
112
|
-
err_string = %q{Policyfile filenames must end with `.rb' extension (you gave: `Policyfile')}
|
112
|
+
err_string = %q{Policyfile filenames must end with an `.rb' or `.lock.json' extension (you gave: `Policyfile')}
|
113
113
|
expect { storage_config.use_policyfile("Policyfile") }.to raise_error(ChefCLI::InvalidPolicyfileFilename, err_string)
|
114
114
|
end
|
115
115
|
|
@@ -77,6 +77,26 @@ describe ChefCLI::PolicyfileServices::Install do
|
|
77
77
|
|
78
78
|
end
|
79
79
|
|
80
|
+
context "When an explicit Policfyfile lock name is given and does not exist" do
|
81
|
+
|
82
|
+
let(:policyfile_rb_explicit_name) { "i_do_not_exist.lock.json" }
|
83
|
+
|
84
|
+
it "errors out" do
|
85
|
+
expect { install_service.run }.to raise_error(ChefCLI::PolicyfileNotFound, "Policyfile lock not found at path #{policyfile_rb_path}")
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
|
90
|
+
context "When an explicit Policfyfile name is given and does not exist" do
|
91
|
+
|
92
|
+
let(:policyfile_rb_explicit_name) { "i_do_not_exist.rb" }
|
93
|
+
|
94
|
+
it "errors out" do
|
95
|
+
expect { install_service.run }.to raise_error(ChefCLI::PolicyfileNotFound, "Policyfile not found at path #{policyfile_rb_path}")
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
99
|
+
|
80
100
|
context "when a Policyfile exists" do
|
81
101
|
|
82
102
|
before do
|
@@ -16,8 +16,7 @@
|
|
16
16
|
#
|
17
17
|
|
18
18
|
require "spec_helper"
|
19
|
-
require "net/http"
|
20
|
-
require "chef/monkey_patches/net_http"
|
19
|
+
require "net/http"
|
21
20
|
require "chef-cli/service_exception_inspectors/http"
|
22
21
|
|
23
22
|
describe ChefCLI::ServiceExceptionInspectors::HTTP do
|
@@ -64,7 +63,7 @@ describe ChefCLI::ServiceExceptionInspectors::HTTP do
|
|
64
63
|
end
|
65
64
|
|
66
65
|
let(:exception) do
|
67
|
-
Net::HTTPClientException.new(message, response)
|
66
|
+
Net::HTTPClientException.new(message, response)
|
68
67
|
end
|
69
68
|
|
70
69
|
subject(:inspector) { described_class.new(exception) }
|
@@ -103,23 +102,10 @@ describe ChefCLI::ServiceExceptionInspectors::HTTP do
|
|
103
102
|
|
104
103
|
end
|
105
104
|
|
106
|
-
describe "showing the
|
105
|
+
describe "showing the response in extended error info" do
|
107
106
|
|
108
107
|
let(:response_body) { "this is the response" }
|
109
108
|
|
110
|
-
it "shows the request in a format similar to HTTP messages" do
|
111
|
-
expected_request_string = <<~E
|
112
|
-
--- REQUEST DATA ----
|
113
|
-
POST /organizations/chef-oss-dev/cookbooks
|
114
|
-
content-type: application/json
|
115
|
-
accept: application/json
|
116
|
-
|
117
|
-
this is the request
|
118
|
-
|
119
|
-
E
|
120
|
-
expect(inspector.extended_error_info).to include(expected_request_string)
|
121
|
-
end
|
122
|
-
|
123
109
|
it "shows the response in a format similar to HTTP messages" do
|
124
110
|
expected_response_string = <<~E
|
125
111
|
--- RESPONSE DATA ---
|
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.35
|
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: 2021-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-cli
|