chef 15.5.17 → 15.6.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/lib/chef/application.rb +5 -5
- data/lib/chef/application/apply.rb +2 -2
- data/lib/chef/application/windows_service.rb +2 -2
- data/lib/chef/application/windows_service_manager.rb +3 -3
- data/lib/chef/cookbook_site_streaming_uploader.rb +2 -1
- data/lib/chef/deprecation/warnings.rb +2 -1
- data/lib/chef/dist.rb +12 -2
- data/lib/chef/exceptions.rb +1 -1
- data/lib/chef/guard_interpreter/default_guard_interpreter.rb +2 -0
- data/lib/chef/node/common_api.rb +1 -1
- data/lib/chef/provider/apt_repository.rb +1 -2
- data/lib/chef/provider/file.rb +4 -1
- data/lib/chef/provider/support/yum_repo.erb +1 -1
- data/lib/chef/provider/user/linux.rb +6 -1
- data/lib/chef/resource/file/verification.rb +4 -1
- data/lib/chef/shell/ext.rb +1 -1
- data/lib/chef/version.rb +1 -1
- data/lib/chef/win32/system.rb +0 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/support/shared/unit/provider/file.rb +16 -4
- data/spec/support/shared/unit/provider/useradd_based_user_provider.rb +16 -8
- data/spec/unit/node/vivid_mash_spec.rb +3 -3
- data/spec/unit/provider/apt_repository_spec.rb +10 -5
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e02fb7120c329ebf6233690e2e110b68b0291947e3adea86c70ceb66985294ec
|
4
|
+
data.tar.gz: 66e70b92fb39c17aa0f6a4603e086375c889efa627d1b4698019e864d7ccb64a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e7af12ed22f92f4ebf512820822fed9fcdd28aeb63b68da368083bc3425fe79fd230183d13ae97961ab0734e56601f3f5947cf5e272f032b761eef81fac12f1
|
7
|
+
data.tar.gz: a5c843217dd59bdfe0d8712838507b422cc89f8fadd0d1b10fae3914f60726b6d956ce0c44c4138e37a8808cac95513811d9584f698b9d32a59f0fbcf1be2ba0
|
data/Gemfile
CHANGED
@@ -46,7 +46,7 @@ end
|
|
46
46
|
|
47
47
|
# Everything except AIX
|
48
48
|
group(:ruby_prof) do
|
49
|
-
gem "ruby-prof"
|
49
|
+
gem "ruby-prof"
|
50
50
|
end
|
51
51
|
|
52
52
|
# Everything except AIX and Windows
|
data/lib/chef/application.rb
CHANGED
@@ -343,7 +343,7 @@ class Chef
|
|
343
343
|
exit 0
|
344
344
|
end
|
345
345
|
end
|
346
|
-
logger.trace "Fork successful. Waiting for new
|
346
|
+
logger.trace "Fork successful. Waiting for new #{Chef::Dist::CLIENT} pid: #{pid}"
|
347
347
|
result = Process.waitpid2(pid)
|
348
348
|
handle_child_exit(result)
|
349
349
|
logger.trace "Forked instance successfully reaped (pid: #{pid})"
|
@@ -355,9 +355,9 @@ class Chef
|
|
355
355
|
return true if status.success?
|
356
356
|
|
357
357
|
message = if status.signaled?
|
358
|
-
"Chef run process terminated by signal #{status.termsig} (#{Signal.list.invert[status.termsig]})"
|
358
|
+
"#{Chef::Dist::PRODUCT} run process terminated by signal #{status.termsig} (#{Signal.list.invert[status.termsig]})"
|
359
359
|
else
|
360
|
-
"Chef run process exited unsuccessfully (exit code #{status.exitstatus})"
|
360
|
+
"#{Chef::Dist::PRODUCT} run process exited unsuccessfully (exit code #{status.exitstatus})"
|
361
361
|
end
|
362
362
|
raise Exceptions::ChildConvergeError, message
|
363
363
|
end
|
@@ -389,8 +389,8 @@ class Chef
|
|
389
389
|
chef_stacktrace_out = "Generated at #{Time.now}\n"
|
390
390
|
chef_stacktrace_out += message
|
391
391
|
|
392
|
-
Chef::FileCache.store("
|
393
|
-
logger.fatal("Stacktrace dumped to #{Chef::FileCache.load("
|
392
|
+
Chef::FileCache.store("#{Chef::Dist::SHORT}-stacktrace.out", chef_stacktrace_out)
|
393
|
+
logger.fatal("Stacktrace dumped to #{Chef::FileCache.load("#{Chef::Dist::SHORT}-stacktrace.out", false)}")
|
394
394
|
logger.fatal("Please provide the contents of the stacktrace.out file if you file a bug report")
|
395
395
|
logger.debug(message)
|
396
396
|
true
|
@@ -32,7 +32,7 @@ require "license_acceptance/cli_flags/mixlib_cli"
|
|
32
32
|
class Chef::Application::Apply < Chef::Application
|
33
33
|
include LicenseAcceptance::CLIFlags::MixlibCLI
|
34
34
|
|
35
|
-
banner "Usage:
|
35
|
+
banner "Usage: #{Chef::Dist::APPLY} [RECIPE_FILE | -e RECIPE_TEXT | -s] [OPTIONS]"
|
36
36
|
|
37
37
|
option :execute,
|
38
38
|
short: "-e RECIPE_TEXT",
|
@@ -163,7 +163,7 @@ class Chef::Application::Apply < Chef::Application
|
|
163
163
|
else
|
164
164
|
Chef::RunContext.new(@chef_client.node, {}, @chef_client.events)
|
165
165
|
end
|
166
|
-
recipe = Chef::Recipe.new("(
|
166
|
+
recipe = Chef::Recipe.new("(#{Chef::Dist::APPLY} cookbook)", "(#{Chef::Dist::APPLY} recipe)", run_context)
|
167
167
|
[recipe, run_context]
|
168
168
|
end
|
169
169
|
|
@@ -40,7 +40,7 @@ class Chef
|
|
40
40
|
option :config_file,
|
41
41
|
short: "-c CONFIG",
|
42
42
|
long: "--config CONFIG",
|
43
|
-
default: "#{
|
43
|
+
default: "#{Chef::Config.etc_chef_dir}/client.rb",
|
44
44
|
description: "The configuration file to use for #{Chef::Dist::PRODUCT} runs."
|
45
45
|
|
46
46
|
option :log_location,
|
@@ -60,7 +60,7 @@ class Chef
|
|
60
60
|
description: "Set the number of seconds to wait between #{Chef::Dist::PRODUCT} runs.",
|
61
61
|
proc: lambda { |s| s.to_i }
|
62
62
|
|
63
|
-
DEFAULT_LOG_LOCATION ||= "#{
|
63
|
+
DEFAULT_LOG_LOCATION ||= "#{Chef::Config.c_chef_dir}/client.log".freeze
|
64
64
|
|
65
65
|
def service_init
|
66
66
|
@service_action_mutex = Mutex.new
|
@@ -41,18 +41,18 @@ class Chef
|
|
41
41
|
short: "-a ACTION",
|
42
42
|
long: "--action ACTION",
|
43
43
|
default: "status",
|
44
|
-
description: "Action to carry out on
|
44
|
+
description: "Action to carry out on #{Chef::Dist::SHORT}-service (install, uninstall, status, start, stop, pause, or resume)."
|
45
45
|
|
46
46
|
option :config_file,
|
47
47
|
short: "-c CONFIG",
|
48
48
|
long: "--config CONFIG",
|
49
|
-
default: "#{
|
49
|
+
default: "#{ChefConfig::Config.c_chef_dir}/client.rb",
|
50
50
|
description: "The configuration file to use for #{Chef::Dist::PRODUCT} runs."
|
51
51
|
|
52
52
|
option :log_location,
|
53
53
|
short: "-L LOGLOCATION",
|
54
54
|
long: "--logfile LOGLOCATION",
|
55
|
-
description: "Set the log file location for
|
55
|
+
description: "Set the log file location for #{Chef::Dist::SHORT}-service."
|
56
56
|
|
57
57
|
option :help,
|
58
58
|
short: "-h",
|
@@ -22,6 +22,7 @@ require "uri" unless defined?(URI)
|
|
22
22
|
require "net/http" unless defined?(Net::HTTP)
|
23
23
|
require "mixlib/authentication/signedheaderauth"
|
24
24
|
require "openssl" unless defined?(OpenSSL)
|
25
|
+
require_relative "dist"
|
25
26
|
|
26
27
|
class Chef
|
27
28
|
# == Chef::CookbookSiteStreamingUploader
|
@@ -36,7 +37,7 @@ class Chef
|
|
36
37
|
class << self
|
37
38
|
|
38
39
|
def create_build_dir(cookbook)
|
39
|
-
tmp_cookbook_path = Tempfile.new("
|
40
|
+
tmp_cookbook_path = Tempfile.new("#{Chef::Dist::SHORT}-#{cookbook.name}-build")
|
40
41
|
tmp_cookbook_path.close
|
41
42
|
tmp_cookbook_dir = tmp_cookbook_path.path
|
42
43
|
File.unlink(tmp_cookbook_dir)
|
@@ -21,11 +21,12 @@ class Chef
|
|
21
21
|
module Warnings
|
22
22
|
|
23
23
|
require_relative "../version"
|
24
|
+
require_relative "../dist"
|
24
25
|
|
25
26
|
def add_deprecation_warnings_for(method_names)
|
26
27
|
method_names.each do |name|
|
27
28
|
define_method(name) do |*args|
|
28
|
-
message = "Method '#{name}' of '#{self.class}' is deprecated. It will be removed in Chef #{Chef::VERSION.to_i.next}."
|
29
|
+
message = "Method '#{name}' of '#{self.class}' is deprecated. It will be removed in #{Chef::Dist::PRODUCT} #{Chef::VERSION.to_i.next}."
|
29
30
|
message << " Please update your cookbooks accordingly."
|
30
31
|
Chef.deprecated(:internal_api, message)
|
31
32
|
super(*args)
|
data/lib/chef/dist.rb
CHANGED
@@ -1,9 +1,16 @@
|
|
1
1
|
class Chef
|
2
2
|
class Dist
|
3
|
+
require "chef-config/dist"
|
4
|
+
require "chef-config/config"
|
5
|
+
|
3
6
|
# This class is not fully implemented, depending on it is not recommended!
|
4
7
|
# When referencing a product directly, like Chef (Now Chef Infra)
|
5
8
|
PRODUCT = "Chef Infra Client".freeze
|
6
9
|
|
10
|
+
# A short designation for the product, used in Windows event logs
|
11
|
+
# and some nomenclature.
|
12
|
+
SHORT = "chef".freeze
|
13
|
+
|
7
14
|
# The name of the server product
|
8
15
|
SERVER_PRODUCT = "Chef Infra Server".freeze
|
9
16
|
|
@@ -14,7 +21,7 @@ class Chef
|
|
14
21
|
AUTOMATE = "Chef Automate".freeze
|
15
22
|
|
16
23
|
# The chef executable, as in `chef gem install` or `chef generate cookbook`
|
17
|
-
EXEC =
|
24
|
+
EXEC = ChefConfig::Dist::EXEC.freeze
|
18
25
|
|
19
26
|
# product website address
|
20
27
|
WEBSITE = "https://chef.io".freeze
|
@@ -34,12 +41,15 @@ class Chef
|
|
34
41
|
# The chef-shell executable
|
35
42
|
SHELL = "chef-shell".freeze
|
36
43
|
|
44
|
+
# The chef-apply executable
|
45
|
+
APPLY = "chef-apply".freeze
|
46
|
+
|
37
47
|
# Configuration related constants
|
38
48
|
# The chef-shell configuration file
|
39
49
|
SHELL_CONF = "chef_shell.rb".freeze
|
40
50
|
|
41
51
|
# The configuration directory
|
42
|
-
CONF_DIR =
|
52
|
+
CONF_DIR = ChefConfig::Config.etc_chef_dir.freeze
|
43
53
|
|
44
54
|
# The user's configuration directory
|
45
55
|
USER_CONF_DIR = ".chef".freeze
|
data/lib/chef/exceptions.rb
CHANGED
@@ -475,7 +475,7 @@ class Chef
|
|
475
475
|
class CookbookChefVersionMismatch < RuntimeError
|
476
476
|
def initialize(chef_version, cookbook_name, cookbook_version, *constraints)
|
477
477
|
constraint_str = constraints.map { |c| c.requirement.as_list.to_s }.join(", ")
|
478
|
-
super "Cookbook '#{cookbook_name}' version '#{cookbook_version}' depends on
|
478
|
+
super "Cookbook '#{cookbook_name}' version '#{cookbook_version}' depends on #{Chef::Dist::PRODUCT} version #{constraint_str}, but the running #{Chef::Dist::PRODUCT} version is #{chef_version}"
|
479
479
|
end
|
480
480
|
end
|
481
481
|
|
@@ -23,6 +23,7 @@ class Chef
|
|
23
23
|
class GuardInterpreter
|
24
24
|
class DefaultGuardInterpreter
|
25
25
|
include Chef::Mixin::ShellOut
|
26
|
+
attr_reader :output
|
26
27
|
|
27
28
|
def initialize(command, opts)
|
28
29
|
@command = command
|
@@ -31,6 +32,7 @@ class Chef
|
|
31
32
|
|
32
33
|
def evaluate
|
33
34
|
result = shell_out(@command, default_env: false, **@command_opts)
|
35
|
+
@output = "STDOUT: #{result.stdout}\nSTDERR: #{result.stderr}\n"
|
34
36
|
Chef::Log.debug "Command failed: #{result.stderr}" unless result.status.success?
|
35
37
|
result.status.success?
|
36
38
|
# Timeout fails command rather than chef-client run, see:
|
data/lib/chef/node/common_api.rb
CHANGED
@@ -100,7 +100,7 @@ class Chef
|
|
100
100
|
|
101
101
|
# non-autovivifying reader that throws an exception if the attribute does not exist
|
102
102
|
def read!(*path)
|
103
|
-
raise Chef::Exceptions::NoSuchAttribute unless exist?(*path)
|
103
|
+
raise Chef::Exceptions::NoSuchAttribute.new(path.join ".") unless exist?(*path)
|
104
104
|
|
105
105
|
path.inject(self) do |memo, key|
|
106
106
|
memo[key]
|
@@ -321,8 +321,7 @@ class Chef
|
|
321
321
|
# @return [String] complete repo config text
|
322
322
|
def build_repo(uri, distribution, components, trusted, arch, add_src = false)
|
323
323
|
uri = make_ppa_url(uri) if is_ppa_url?(uri)
|
324
|
-
|
325
|
-
uri = '"' + uri + '"' unless uri.start_with?("'", '"')
|
324
|
+
uri = URI.escape(uri)
|
326
325
|
components = Array(components).join(" ")
|
327
326
|
options = []
|
328
327
|
options << "arch=#{arch}" if arch
|
data/lib/chef/provider/file.rb
CHANGED
@@ -341,7 +341,10 @@ class Chef
|
|
341
341
|
if tempfile
|
342
342
|
new_resource.verify.each do |v|
|
343
343
|
unless v.verify(tempfile.path)
|
344
|
-
|
344
|
+
backupfile = "#{Chef::Config[:file_cache_path]}/failed_validations/#{::File.basename(tempfile.path)}"
|
345
|
+
FileUtils.mkdir_p ::File.dirname(backupfile)
|
346
|
+
FileUtils.cp tempfile.path, backupfile
|
347
|
+
raise Chef::Exceptions::ValidationFailed.new "Proposed content for #{new_resource.path} failed verification #{new_resource.sensitive ? "[sensitive]" : "#{v}\n#{v.output}"}\nTemporary file moved to #{backupfile}"
|
345
348
|
end
|
346
349
|
end
|
347
350
|
end
|
@@ -28,7 +28,12 @@ class Chef
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def manage_user
|
31
|
-
shell_out
|
31
|
+
manage_u = shell_out("usermod", universal_options, usermod_options, new_resource.username, returns: [0, 12])
|
32
|
+
if manage_u.exitstatus == 12 && manage_u.stderr !~ /exists/
|
33
|
+
raise Chef::Exceptions::User, "Unable to modify home directory for #{new_resource.username}"
|
34
|
+
end
|
35
|
+
|
36
|
+
manage_u.error!
|
32
37
|
end
|
33
38
|
|
34
39
|
def remove_user
|
@@ -63,6 +63,7 @@ class Chef
|
|
63
63
|
|
64
64
|
class Verification
|
65
65
|
extend Chef::Mixin::DescendantsTracker
|
66
|
+
attr_reader :output
|
66
67
|
|
67
68
|
def self.provides(name)
|
68
69
|
@provides = name
|
@@ -117,7 +118,9 @@ class Chef
|
|
117
118
|
|
118
119
|
command = @command % { path: path }
|
119
120
|
interpreter = Chef::GuardInterpreter.for_resource(@parent_resource, command, @command_opts)
|
120
|
-
interpreter.evaluate
|
121
|
+
ret = interpreter.evaluate
|
122
|
+
@output = interpreter.output
|
123
|
+
ret
|
121
124
|
end
|
122
125
|
|
123
126
|
def verify_registered_verification(path, opts)
|
data/lib/chef/shell/ext.rb
CHANGED
@@ -208,7 +208,7 @@ module Shell
|
|
208
208
|
end
|
209
209
|
alias :halp :help
|
210
210
|
|
211
|
-
desc "prints information about
|
211
|
+
desc "prints information about #{Chef::Dist::PRODUCT}"
|
212
212
|
def version
|
213
213
|
puts "This is the #{Chef::Dist::SHELL}.\n" +
|
214
214
|
" #{Chef::Dist::PRODUCT} Version: #{::Chef::VERSION}\n" +
|
data/lib/chef/version.rb
CHANGED
data/lib/chef/win32/system.rb
CHANGED
File without changes
|
data/spec/spec_helper.rb
CHANGED
@@ -123,8 +123,10 @@ RSpec.configure do |config|
|
|
123
123
|
config.filter_run_excluding external: true
|
124
124
|
|
125
125
|
# Explicitly disable :should syntax
|
126
|
+
# And set max_formatted_output_length to nil to prevent RSpec from doing truncation.
|
126
127
|
config.expect_with :rspec do |c|
|
127
128
|
c.syntax = :expect
|
129
|
+
c.max_formatted_output_length = nil
|
128
130
|
end
|
129
131
|
config.mock_with :rspec do |c|
|
130
132
|
c.syntax = :expect
|
@@ -458,14 +458,24 @@ shared_examples_for Chef::Provider::File do
|
|
458
458
|
end
|
459
459
|
|
460
460
|
context "do_validate_content" do
|
461
|
-
before { setup_normal_file }
|
462
461
|
|
462
|
+
let(:tempfile_name) { "foo-bar-baz" }
|
463
|
+
let(:backupfile) { "/tmp/failed_validations/#{tempfile_name}" }
|
463
464
|
let(:tempfile) do
|
464
|
-
t = double("Tempfile", path: "/tmp
|
465
|
+
t = double("Tempfile", path: "/tmp/#{tempfile_name}", closed?: true)
|
465
466
|
allow(content).to receive(:tempfile).and_return(t)
|
466
467
|
t
|
467
468
|
end
|
468
469
|
|
470
|
+
before do
|
471
|
+
Chef::Config[:file_cache_path] = "/tmp"
|
472
|
+
allow(File).to receive(:dirname).and_return(tempfile)
|
473
|
+
allow(File).to receive(:basename).and_return(tempfile_name)
|
474
|
+
allow(FileUtils).to receive(:mkdir_p).and_return(true)
|
475
|
+
allow(FileUtils).to receive(:cp).and_return(true)
|
476
|
+
setup_normal_file
|
477
|
+
end
|
478
|
+
|
469
479
|
context "with user-supplied verifications" do
|
470
480
|
it "calls #verify on each verification with tempfile path" do
|
471
481
|
provider.new_resource.verify windows? ? "REM" : "true"
|
@@ -477,7 +487,8 @@ shared_examples_for Chef::Provider::File do
|
|
477
487
|
allow(File).to receive(:directory?).with("C:\\Windows\\system32/cmd.exe").and_return(false)
|
478
488
|
provider.new_resource.verify windows? ? "REM" : "true"
|
479
489
|
provider.new_resource.verify windows? ? "cmd.exe /c exit 1" : "false"
|
480
|
-
|
490
|
+
msg = "Proposed content for #{provider.new_resource.path} failed verification #{windows? ? "cmd.exe /c exit 1" : "false"}"
|
491
|
+
expect { provider.send(:do_validate_content) }.to raise_error(Chef::Exceptions::ValidationFailed, /#{msg}/)
|
481
492
|
end
|
482
493
|
|
483
494
|
it "does not show verification for sensitive resources" do
|
@@ -485,7 +496,8 @@ shared_examples_for Chef::Provider::File do
|
|
485
496
|
provider.new_resource.verify windows? ? "REM" : "true"
|
486
497
|
provider.new_resource.verify windows? ? "cmd.exe /c exit 1" : "false"
|
487
498
|
provider.new_resource.sensitive true
|
488
|
-
|
499
|
+
msg = "Proposed content for #{provider.new_resource.path} failed verification [sensitive]\nTemporary file moved to #{backupfile}"
|
500
|
+
expect { provider.send(:do_validate_content) }.to raise_error(Chef::Exceptions::ValidationFailed, msg)
|
489
501
|
end
|
490
502
|
end
|
491
503
|
end
|
@@ -159,7 +159,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
|
|
159
159
|
"-u", "1000",
|
160
160
|
"-d", "/Users/mud",
|
161
161
|
"-m",
|
162
|
-
"adam"
|
162
|
+
"adam"])
|
163
163
|
expect(provider).to receive(:shell_out_compacted!).with(*command).and_return(true)
|
164
164
|
provider.create_user
|
165
165
|
end
|
@@ -180,7 +180,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
|
|
180
180
|
command.concat([ "-s", "/usr/bin/zsh",
|
181
181
|
"-u", "1000",
|
182
182
|
"-r", "-m",
|
183
|
-
"adam"
|
183
|
+
"adam"])
|
184
184
|
expect(provider).to receive(:shell_out_compacted!).with(*command).and_return(true)
|
185
185
|
provider.create_user
|
186
186
|
end
|
@@ -190,10 +190,15 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
|
|
190
190
|
end
|
191
191
|
|
192
192
|
describe "when managing a user" do
|
193
|
+
let(:manage_u_status) do
|
194
|
+
double("Mixlib::ShellOut command", exitstatus: 0, stdout: @stdout, stderr: @stderr, error!: nil)
|
195
|
+
end
|
196
|
+
|
193
197
|
before(:each) do
|
194
198
|
provider.new_resource.manage_home true
|
195
199
|
provider.new_resource.home "/Users/mud"
|
196
200
|
provider.new_resource.gid "23"
|
201
|
+
@stderr = ""
|
197
202
|
end
|
198
203
|
|
199
204
|
# CHEF-3423, -m must come before the username
|
@@ -203,8 +208,9 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
|
|
203
208
|
"-g", "23",
|
204
209
|
"-d", "/Users/mud",
|
205
210
|
"-m",
|
206
|
-
"adam"
|
207
|
-
|
211
|
+
"adam"]
|
212
|
+
command.concat([ { returns: [0, 12] } ])
|
213
|
+
expect(provider).to receive(:shell_out_compacted).with(*command).and_return(manage_u_status)
|
208
214
|
provider.manage_user
|
209
215
|
end
|
210
216
|
|
@@ -214,8 +220,9 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
|
|
214
220
|
"-g", "23",
|
215
221
|
"-d", "/Users/mud",
|
216
222
|
"-m",
|
217
|
-
"adam"
|
218
|
-
|
223
|
+
"adam"]
|
224
|
+
command.concat([ { returns: [0, 12] } ])
|
225
|
+
expect(provider).to receive(:shell_out_compacted).with(*command).and_return(manage_u_status)
|
219
226
|
provider.manage_user
|
220
227
|
end
|
221
228
|
|
@@ -223,8 +230,9 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
|
|
223
230
|
expect(provider).to receive(:updating_home?).at_least(:once).and_return(false)
|
224
231
|
command = ["usermod",
|
225
232
|
"-g", "23",
|
226
|
-
"adam"
|
227
|
-
|
233
|
+
"adam"]
|
234
|
+
command.concat([ { returns: [0, 12] } ])
|
235
|
+
expect(provider).to receive(:shell_out_compacted).with(*command).and_return(manage_u_status)
|
228
236
|
provider.manage_user
|
229
237
|
end
|
230
238
|
end
|
@@ -163,15 +163,15 @@ describe Chef::Node::VividMash do
|
|
163
163
|
end
|
164
164
|
|
165
165
|
it "throws an exception when attributes do not exist" do
|
166
|
-
expect { vivid.read!("one", "five", "six") }.to raise_error(Chef::Exceptions::NoSuchAttribute)
|
166
|
+
expect { vivid.read!("one", "five", "six") }.to raise_error(Chef::Exceptions::NoSuchAttribute, "one.five.six")
|
167
167
|
end
|
168
168
|
|
169
169
|
it "throws an exception when traversing a non-container" do
|
170
|
-
expect { vivid.read!("one", "two", "three", "four") }.to raise_error(Chef::Exceptions::NoSuchAttribute)
|
170
|
+
expect { vivid.read!("one", "two", "three", "four") }.to raise_error(Chef::Exceptions::NoSuchAttribute, "one.two.three.four")
|
171
171
|
end
|
172
172
|
|
173
173
|
it "throws an exception when an array element does not exist" do
|
174
|
-
expect { vivid.read!("array", 3) }.to raise_error(Chef::Exceptions::NoSuchAttribute)
|
174
|
+
expect { vivid.read!("array", 3) }.to raise_error(Chef::Exceptions::NoSuchAttribute, "array.3")
|
175
175
|
end
|
176
176
|
end
|
177
177
|
|
@@ -226,27 +226,32 @@ C5986B4F1257FFA86632CBA746181433FBB75451
|
|
226
226
|
|
227
227
|
describe "#build_repo" do
|
228
228
|
it "creates a repository string" do
|
229
|
-
target =
|
229
|
+
target = "deb http://test/uri unstable main\n"
|
230
230
|
expect(provider.build_repo("http://test/uri", "unstable", "main", false, nil)).to eql(target)
|
231
231
|
end
|
232
232
|
|
233
|
+
it "creates a repository string with spaces" do
|
234
|
+
target = "deb http://test/uri%20with%20spaces unstable main\n"
|
235
|
+
expect(provider.build_repo("http://test/uri with spaces", "unstable", "main", false, nil)).to eql(target)
|
236
|
+
end
|
237
|
+
|
233
238
|
it "creates a repository string with no distribution" do
|
234
|
-
target =
|
239
|
+
target = "deb http://test/uri main\n"
|
235
240
|
expect(provider.build_repo("http://test/uri", nil, "main", false, nil)).to eql(target)
|
236
241
|
end
|
237
242
|
|
238
243
|
it "creates a repository string with source" do
|
239
|
-
target =
|
244
|
+
target = "deb http://test/uri unstable main\ndeb-src http://test/uri unstable main\n"
|
240
245
|
expect(provider.build_repo("http://test/uri", "unstable", "main", false, nil, true)).to eql(target)
|
241
246
|
end
|
242
247
|
|
243
248
|
it "creates a repository string with options" do
|
244
|
-
target =
|
249
|
+
target = "deb [trusted=yes] http://test/uri unstable main\n"
|
245
250
|
expect(provider.build_repo("http://test/uri", "unstable", "main", true, nil)).to eql(target)
|
246
251
|
end
|
247
252
|
|
248
253
|
it "handles a ppa repo" do
|
249
|
-
target =
|
254
|
+
target = "deb http://ppa.launchpad.net/chef/main/ubuntu unstable main\n"
|
250
255
|
expect(provider).to receive(:make_ppa_url).with("ppa:chef/main").and_return("http://ppa.launchpad.net/chef/main/ubuntu")
|
251
256
|
expect(provider.build_repo("ppa:chef/main", "unstable", "main", false, nil)).to eql(target)
|
252
257
|
end
|
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: 15.
|
4
|
+
version: 15.6.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-10 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: 15.
|
19
|
+
version: 15.6.10
|
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: 15.
|
26
|
+
version: 15.6.10
|
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: 15.
|
33
|
+
version: 15.6.10
|
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: 15.
|
40
|
+
version: 15.6.10
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: train-core
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|