chef-cli 3.0.30 → 3.0.36
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/lib/chef-cli/cli.rb +3 -3
- data/lib/chef-cli/command/env.rb +6 -3
- 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/dist.rb +7 -2
- data/lib/chef-cli/helpers.rb +4 -1
- 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/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/install.rb +1 -1
- data/lib/chef-cli/policyfile_services/push.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 +4 -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/skeletons/code_generator/recipes/cookbook_file.rb +6 -4
- data/lib/chef-cli/version.rb +1 -1
- data/lib/kitchen/provisioner/chef_zero_capture.rb +0 -1
- data/spec/unit/cli_spec.rb +3 -3
- data/spec/unit/command/env_spec.rb +1 -1
- data/spec/unit/command/generator_commands/cookbook_file_spec.rb +9 -0
- data/spec/unit/service_exception_inspectors/http_spec.rb +3 -17
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75b5fd57e86db29bb68a615fdf19d525619d825cf5569fc19f01af72ac64c355
|
4
|
+
data.tar.gz: 7659576815fb41138d60c1aba5996eddba6ea6229f4900a4177bbf969e567d80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00da7122004fa0123b09833996c1a5ac0abba1c891f508c7b06bad885db4872c4a718493f91a101779e3628183793437ffb52cbc5c71740ae318ce5fa6823ab3
|
7
|
+
data.tar.gz: 800b5fd86118674375ed4d97f0084889a4d03594fabbb54d948db5e84eeb5b7b1123e6a742e16571a4ce965284866cf1db705ad609ec6e8d400549ea98b48d2b
|
data/lib/chef-cli/cli.rb
CHANGED
@@ -33,9 +33,9 @@ module ChefCLI
|
|
33
33
|
include Chef::Mixin::ShellOut
|
34
34
|
|
35
35
|
banner(<<~BANNER)
|
36
|
-
|
37
|
-
Docs:
|
38
|
-
Patents:
|
36
|
+
#{ChefCLI::Dist::WORKSTATION_HEADER}
|
37
|
+
Docs: #{ChefCLI::Dist::WORKSTATION_DOCS}
|
38
|
+
Patents: #{ChefCLI::Dist::PATENTS}
|
39
39
|
|
40
40
|
Usage:
|
41
41
|
#{ChefCLI::Dist::EXEC} -h/--help
|
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
|
@@ -40,7 +43,7 @@ module ChefCLI
|
|
40
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
|
|
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/helpers.rb
CHANGED
@@ -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
|
@@ -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
|
@@ -1,7 +1,10 @@
|
|
1
1
|
context = ChefCLI::Generator.context
|
2
2
|
cookbook_dir = File.join(context.cookbook_root, context.cookbook_name)
|
3
|
-
|
4
|
-
|
3
|
+
new_file_basename = File.basename(context.new_file_basename)
|
4
|
+
relative_path = File.dirname(context.new_file_basename)
|
5
|
+
relative_path.slice! "."
|
6
|
+
files_dir = File.join(cookbook_dir, 'files', relative_path)
|
7
|
+
cookbook_file_path = File.join(files_dir, new_file_basename)
|
5
8
|
|
6
9
|
directory files_dir do
|
7
10
|
recursive true
|
@@ -19,5 +22,4 @@ else
|
|
19
22
|
source 'cookbook_file.erb'
|
20
23
|
helpers(ChefCLI::Generator::TemplateHelper)
|
21
24
|
end
|
22
|
-
|
23
|
-
end
|
25
|
+
end
|
data/lib/chef-cli/version.rb
CHANGED
data/spec/unit/cli_spec.rb
CHANGED
@@ -41,9 +41,9 @@ describe ChefCLI::CLI do
|
|
41
41
|
|
42
42
|
let(:base_help_message) do
|
43
43
|
<<~E
|
44
|
-
|
45
|
-
Docs:
|
46
|
-
Patents:
|
44
|
+
#{ChefCLI::Dist::WORKSTATION_HEADER}
|
45
|
+
Docs: #{ChefCLI::Dist::WORKSTATION_DOCS}
|
46
|
+
Patents: #{ChefCLI::Dist::PATENTS}
|
47
47
|
|
48
48
|
Usage:
|
49
49
|
chef -h/--help
|
@@ -28,4 +28,13 @@ describe ChefCLI::Command::GeneratorCommands::CookbookFile do
|
|
28
28
|
let(:new_file_name) { "new_file.txt" }
|
29
29
|
|
30
30
|
end
|
31
|
+
|
32
|
+
include_examples "a file generator" do
|
33
|
+
|
34
|
+
let(:generator_name) { "file" }
|
35
|
+
let(:generated_files) { [ "files/file/new_file.txt" ] }
|
36
|
+
let(:new_file_name) { "file/new_file.txt" }
|
37
|
+
|
38
|
+
end
|
39
|
+
|
31
40
|
end
|
@@ -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.36
|
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-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-cli
|
@@ -102,22 +102,22 @@ dependencies:
|
|
102
102
|
name: solve
|
103
103
|
requirement: !ruby/object:Gem::Requirement
|
104
104
|
requirements:
|
105
|
-
- - ">"
|
106
|
-
- !ruby/object:Gem::Version
|
107
|
-
version: '2.0'
|
108
105
|
- - "<"
|
109
106
|
- !ruby/object:Gem::Version
|
110
107
|
version: '5.0'
|
108
|
+
- - ">"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '2.0'
|
111
111
|
type: :runtime
|
112
112
|
prerelease: false
|
113
113
|
version_requirements: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - ">"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '2.0'
|
118
115
|
- - "<"
|
119
116
|
- !ruby/object:Gem::Version
|
120
117
|
version: '5.0'
|
118
|
+
- - ">"
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '2.0'
|
121
121
|
- !ruby/object:Gem::Dependency
|
122
122
|
name: addressable
|
123
123
|
requirement: !ruby/object:Gem::Requirement
|
@@ -601,7 +601,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
601
601
|
- !ruby/object:Gem::Version
|
602
602
|
version: '0'
|
603
603
|
requirements: []
|
604
|
-
rubygems_version: 3.
|
604
|
+
rubygems_version: 3.1.4
|
605
605
|
signing_key:
|
606
606
|
specification_version: 4
|
607
607
|
summary: A streamlined development and deployment workflow for Chef platform.
|