chef 16.9.20-universal-mingw32 → 16.9.29-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +4 -1
- data/chef.gemspec +1 -1
- data/lib/chef/compliance/runner.rb +3 -1
- data/lib/chef/shell.rb +32 -1
- data/lib/chef/version.rb +1 -1
- data/spec/functional/resource/ohai_spec.rb +2 -10
- data/spec/spec_helper.rb +1 -1
- data/spec/unit/compliance/runner_spec.rb +3 -4
- 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: 6f564e93ffc06c2936ab1b862940251210177cf04ec0f53cbbb32933dd22d635
|
4
|
+
data.tar.gz: 3f625168ed2dc1f0df2caec6ecf87c541c444b425b90547a0af6404fb0c50859
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79b495255e7fe547acd85215ec25c47704b2bae4133c5c203068e886cade61a660de0902bcb86ab2f2a29868b109046566db8d76a3303be21cef98c49131a724
|
7
|
+
data.tar.gz: e87c0defd82aba56492ac2c4a71fd59a1a2a404e9d922ab5111cfa8136c15dd23853c600b850f4922d42229a8342cd209099d2b88801a756dd3986f13642c623
|
data/Gemfile
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
2
|
|
3
|
+
# pin until issues with Windows builds in 1.14.2 are resolved
|
4
|
+
gem "ffi", "=1.13.1"
|
5
|
+
|
3
6
|
# Note we do not use the gemspec DSL which restricts to the
|
4
7
|
# gemspec for the current platform and filters out other platforms
|
5
8
|
# during a bundle lock operation. We actually want dependencies from
|
@@ -50,7 +53,7 @@ end
|
|
50
53
|
|
51
54
|
group(:development, :test) do
|
52
55
|
gem "rake"
|
53
|
-
gem "rspec"
|
56
|
+
gem "rspec", "=3.9.0" # remove pin once https://github.com/chef/chef/issues/10817 is resolved
|
54
57
|
gem "webmock"
|
55
58
|
gem "fauxhai-ng" # for chef-utils gem
|
56
59
|
end
|
data/chef.gemspec
CHANGED
@@ -51,7 +51,7 @@ Gem::Specification.new do |s|
|
|
51
51
|
s.add_dependency "iniparse", "~> 1.4"
|
52
52
|
s.add_dependency "addressable"
|
53
53
|
s.add_dependency "syslog-logger", "~> 1.6"
|
54
|
-
s.add_dependency "uuidtools", "
|
54
|
+
s.add_dependency "uuidtools", ">= 2.1.5", "< 3.0"
|
55
55
|
|
56
56
|
s.add_dependency "proxifier", "~> 1.0"
|
57
57
|
|
@@ -16,7 +16,9 @@ class Chef
|
|
16
16
|
def_delegators :node, :logger
|
17
17
|
|
18
18
|
def enabled?
|
19
|
-
|
19
|
+
# Did we parse the libraries file from the audit cookbook? This class dates back to when Chef Automate was
|
20
|
+
# renamed from Chef Visibility in 2017, so should capture all modern versions of the audit cookbook.
|
21
|
+
audit_cookbook_present = defined?(::Reporter::ChefAutomate)
|
20
22
|
|
21
23
|
logger.info("#{self.class}##{__method__}: #{Inspec::Dist::PRODUCT_NAME} profiles? #{inspec_profiles.any?}")
|
22
24
|
logger.info("#{self.class}##{__method__}: audit cookbook? #{audit_cookbook_present}")
|
data/lib/chef/shell.rb
CHANGED
@@ -25,6 +25,7 @@ require "pp" unless defined?(PP)
|
|
25
25
|
require "etc" unless defined?(Etc)
|
26
26
|
require "mixlib/cli" unless defined?(Mixlib::CLI)
|
27
27
|
require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
28
|
+
require "chef-config/mixin/dot_d"
|
28
29
|
|
29
30
|
require_relative "../chef"
|
30
31
|
require_relative "version"
|
@@ -211,6 +212,7 @@ module Shell
|
|
211
212
|
|
212
213
|
class Options
|
213
214
|
include Mixlib::CLI
|
215
|
+
include ChefConfig::Mixin::DotD
|
214
216
|
|
215
217
|
def self.footer(text = nil)
|
216
218
|
@footer = text if text
|
@@ -341,15 +343,44 @@ module Shell
|
|
341
343
|
# We have to nuke ARGV to make sure irb's option parser never sees it.
|
342
344
|
# otherwise, IRB complains about command line switches it doesn't recognize.
|
343
345
|
ARGV.clear
|
346
|
+
|
347
|
+
# This code should not exist.
|
348
|
+
# We should be using Application::Client and then calling load_config_file
|
349
|
+
# which does all this properly. However this will do for now.
|
344
350
|
config[:config_file] = config_file_for_shell_mode(environment)
|
345
351
|
config_msg = config[:config_file] || "none (standalone session)"
|
346
352
|
puts "loading configuration: #{config_msg}"
|
347
|
-
|
353
|
+
|
354
|
+
# load the config (if we have one)
|
355
|
+
if !config[:config_file].nil?
|
356
|
+
if File.exist?(config[:config_file]) && File.readable?(config[:config_file])
|
357
|
+
Chef::Config.from_file(config[:config_file])
|
358
|
+
end
|
359
|
+
|
360
|
+
# even if we couldn't load that, we need to tell Chef::Config what
|
361
|
+
# the file was so it sets confdir and d_dir and such properly
|
362
|
+
Chef::Config[:config_file] = config[:config_file]
|
363
|
+
|
364
|
+
# now attempt to load any relevant dot-dirs
|
365
|
+
load_dot_d(Chef::Config[:client_d_dir]) if Chef::Config[:client_d_dir]
|
366
|
+
end
|
367
|
+
|
368
|
+
# finally merge command-line options in
|
348
369
|
Chef::Config.merge!(config)
|
349
370
|
end
|
350
371
|
|
351
372
|
private
|
352
373
|
|
374
|
+
# shamelessly lifted from application.rb
|
375
|
+
def apply_config(config_content, config_file_path)
|
376
|
+
Chef::Config.from_string(config_content, config_file_path)
|
377
|
+
rescue Exception => error
|
378
|
+
logger.fatal("Configuration error #{error.class}: #{error.message}")
|
379
|
+
filtered_trace = error.backtrace.grep(/#{Regexp.escape(config_file_path)}/)
|
380
|
+
filtered_trace.each { |line| logger.fatal(" " + line ) }
|
381
|
+
raise Chef::Exceptions::ConfigurationError.new("Aborting due to error in '#{config_file_path}': #{error}")
|
382
|
+
end
|
383
|
+
|
353
384
|
def config_file_for_shell_mode(environment)
|
354
385
|
dot_chef_dir = Chef::Util::PathHelper.home(".chef")
|
355
386
|
if config[:config_file]
|
data/lib/chef/version.rb
CHANGED
@@ -19,10 +19,6 @@
|
|
19
19
|
require "spec_helper"
|
20
20
|
|
21
21
|
describe Chef::Resource::Ohai do
|
22
|
-
let(:ohai) do
|
23
|
-
OHAI_SYSTEM
|
24
|
-
end
|
25
|
-
|
26
22
|
let(:node) { Chef::Node.new }
|
27
23
|
|
28
24
|
let(:run_context) do
|
@@ -34,13 +30,9 @@ describe Chef::Resource::Ohai do
|
|
34
30
|
|
35
31
|
shared_examples_for "reloaded :uptime" do
|
36
32
|
it "should reload :uptime" do
|
37
|
-
|
38
|
-
|
39
|
-
# Sleep for a second so the uptime gets updated.
|
40
|
-
sleep 1
|
41
|
-
|
33
|
+
expect(node[:uptime_seconds]).to be nil
|
42
34
|
ohai_resource.run_action(:reload)
|
43
|
-
expect(node[:
|
35
|
+
expect(Integer(node[:uptime_seconds])).to be_an(Integer)
|
44
36
|
end
|
45
37
|
end
|
46
38
|
|
data/spec/spec_helper.rb
CHANGED
@@ -87,7 +87,7 @@ Dir["spec/support/**/*.rb"]
|
|
87
87
|
.each { |f| require f }
|
88
88
|
|
89
89
|
OHAI_SYSTEM = Ohai::System.new
|
90
|
-
OHAI_SYSTEM.all_plugins(["platform", "hostname", "languages/powershell"])
|
90
|
+
OHAI_SYSTEM.all_plugins(["platform", "hostname", "languages/powershell", "uptime"])
|
91
91
|
|
92
92
|
test_node = Chef::Node.new
|
93
93
|
test_node.automatic["os"] = (OHAI_SYSTEM["os"] || "unknown_os").dup.freeze
|
@@ -12,29 +12,28 @@ describe Chef::Compliance::Runner do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
describe "#enabled?" do
|
15
|
+
|
15
16
|
it "is true if the node attributes have audit profiles and the audit cookbook is not present" do
|
16
17
|
node.normal["audit"]["profiles"]["ssh"] = { 'compliance': "base/ssh" }
|
17
|
-
node.automatic["recipes"] = %w{ fancy_cookbook::fanciness tacobell::nachos }
|
18
18
|
|
19
19
|
expect(runner).to be_enabled
|
20
20
|
end
|
21
21
|
|
22
22
|
it "is false if the node attributes have audit profiles and the audit cookbook is present" do
|
23
|
+
stub_const("::Reporter::ChefAutomate", true)
|
23
24
|
node.normal["audit"]["profiles"]["ssh"] = { 'compliance': "base/ssh" }
|
24
|
-
node.automatic["recipes"] = %w{ audit::default fancy_cookbook::fanciness tacobell::nachos }
|
25
25
|
|
26
26
|
expect(runner).not_to be_enabled
|
27
27
|
end
|
28
28
|
|
29
29
|
it "is false if the node attributes do not have audit profiles and the audit cookbook is not present" do
|
30
30
|
node.normal["audit"]["profiles"] = {}
|
31
|
-
node.automatic["recipes"] = %w{ fancy_cookbook::fanciness tacobell::nachos }
|
32
31
|
|
33
32
|
expect(runner).not_to be_enabled
|
34
33
|
end
|
35
34
|
|
36
35
|
it "is false if the node attributes do not have audit profiles and the audit cookbook is present" do
|
37
|
-
|
36
|
+
stub_const("::Reporter::ChefAutomate", true)
|
38
37
|
node.automatic["recipes"] = %w{ audit::default fancy_cookbook::fanciness tacobell::nachos }
|
39
38
|
|
40
39
|
expect(runner).not_to be_enabled
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 16.9.
|
4
|
+
version: 16.9.29
|
5
5
|
platform: universal-mingw32
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef-config
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 16.9.
|
19
|
+
version: 16.9.29
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 16.9.
|
26
|
+
version: 16.9.29
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: chef-utils
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 16.9.
|
33
|
+
version: 16.9.29
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 16.9.
|
40
|
+
version: 16.9.29
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: train-core
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -554,16 +554,22 @@ dependencies:
|
|
554
554
|
name: uuidtools
|
555
555
|
requirement: !ruby/object:Gem::Requirement
|
556
556
|
requirements:
|
557
|
-
- - "
|
557
|
+
- - ">="
|
558
558
|
- !ruby/object:Gem::Version
|
559
559
|
version: 2.1.5
|
560
|
+
- - "<"
|
561
|
+
- !ruby/object:Gem::Version
|
562
|
+
version: '3.0'
|
560
563
|
type: :runtime
|
561
564
|
prerelease: false
|
562
565
|
version_requirements: !ruby/object:Gem::Requirement
|
563
566
|
requirements:
|
564
|
-
- - "
|
567
|
+
- - ">="
|
565
568
|
- !ruby/object:Gem::Version
|
566
569
|
version: 2.1.5
|
570
|
+
- - "<"
|
571
|
+
- !ruby/object:Gem::Version
|
572
|
+
version: '3.0'
|
567
573
|
- !ruby/object:Gem::Dependency
|
568
574
|
name: proxifier
|
569
575
|
requirement: !ruby/object:Gem::Requirement
|