chef 14.4.56-universal-mingw32 → 14.5.27-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +0 -1
- data/VERSION +1 -1
- data/lib/.DS_Store +0 -0
- data/lib/chef/.DS_Store +0 -0
- data/lib/chef/client.rb +1 -1
- data/lib/chef/cookbook_version.rb +2 -2
- data/lib/chef/mixin/powershell_out.rb +1 -1
- data/lib/chef/node_map.rb +4 -10
- data/lib/chef/provider/.DS_Store +0 -0
- data/lib/chef/provider/dsc_resource.rb +2 -2
- data/lib/chef/provider/dsc_script.rb +4 -4
- data/lib/chef/provider/package/powershell.rb +1 -1
- data/lib/chef/provider/powershell_script.rb +3 -3
- data/lib/chef/provider/script.rb +2 -2
- data/lib/chef/resource/apt_package.rb +1 -0
- data/lib/chef/resource/apt_repository.rb +1 -1
- data/lib/chef/resource/build_essential.rb +38 -38
- data/lib/chef/resource/chef_gem.rb +4 -1
- data/lib/chef/resource/chocolatey_package.rb +2 -1
- data/lib/chef/resource/directory.rb +6 -2
- data/lib/chef/resource/dmg_package.rb +1 -4
- data/lib/chef/resource/dnf_package.rb +20 -23
- data/lib/chef/resource/dpkg_package.rb +1 -3
- data/lib/chef/resource/dsc_resource.rb +2 -5
- data/lib/chef/resource/dsc_script.rb +1 -8
- data/lib/chef/resource/execute.rb +4 -1
- data/lib/chef/resource/gem_package.rb +17 -19
- data/lib/chef/resource/git.rb +4 -4
- data/lib/chef/resource/homebrew_cask.rb +2 -2
- data/lib/chef/resource/homebrew_tap.rb +3 -3
- data/lib/chef/resource/hostname.rb +4 -4
- data/lib/chef/resource/http_request.rb +1 -3
- data/lib/chef/resource/ifconfig.rb +1 -1
- data/lib/chef/resource/locale.rb +93 -0
- data/lib/chef/resource/macos_userdefaults.rb +2 -4
- data/lib/chef/resource/macosx_service.rb +2 -3
- data/lib/chef/resource/mount.rb +45 -18
- data/lib/chef/resource/msu_package.rb +10 -7
- data/lib/chef/resource/ohai.rb +2 -4
- data/lib/chef/resource/ohai_hint.rb +3 -3
- data/lib/chef/resource/openssl_dhparam.rb +5 -5
- data/lib/chef/resource/openssl_ec_private_key.rb +5 -5
- data/lib/chef/resource/openssl_ec_public_key.rb +5 -5
- data/lib/chef/resource/openssl_rsa_private_key.rb +6 -6
- data/lib/chef/resource/openssl_rsa_public_key.rb +7 -7
- data/lib/chef/resource/openssl_x509_certificate.rb +11 -11
- data/lib/chef/resource/openssl_x509_crl.rb +2 -2
- data/lib/chef/resource/openssl_x509_request.rb +7 -7
- data/lib/chef/resource/osx_profile.rb +13 -8
- data/lib/chef/resource/package.rb +26 -8
- data/lib/chef/resource/paludis_package.rb +3 -1
- data/lib/chef/resource/portage_package.rb +2 -1
- data/lib/chef/resource/powershell_package.rb +17 -9
- data/lib/chef/resource/powershell_package_source.rb +1 -1
- data/lib/chef/resource/reboot.rb +7 -2
- data/lib/chef/resource/rhsm_errata_level.rb +1 -3
- data/lib/chef/resource/route.rb +1 -1
- data/lib/chef/resource/scm.rb +42 -14
- data/lib/chef/resource/subversion.rb +7 -0
- data/lib/chef/resource/sudo.rb +7 -7
- data/lib/chef/resource/swap_file.rb +2 -2
- data/lib/chef/resource/sysctl.rb +1 -1
- data/lib/chef/resource/systemd_unit.rb +2 -1
- data/lib/chef/resource/windows_ad_join.rb +9 -4
- data/lib/chef/resource/windows_auto_run.rb +5 -5
- data/lib/chef/resource/windows_env.rb +1 -3
- data/lib/chef/resource/windows_feature_dism.rb +4 -5
- data/lib/chef/resource/windows_font.rb +3 -5
- data/lib/chef/resource/windows_package.rb +1 -2
- data/lib/chef/resource/windows_printer.rb +7 -9
- data/lib/chef/resource/windows_printer_port.rb +1 -1
- data/lib/chef/resource/windows_service.rb +26 -21
- data/lib/chef/resource/windows_shortcut.rb +4 -4
- data/lib/chef/resource/windows_task.rb +82 -36
- data/lib/chef/resource/windows_workgroup.rb +101 -0
- data/lib/chef/resource/yum_package.rb +30 -20
- data/lib/chef/resource/yum_repository.rb +134 -45
- data/lib/chef/resource/zypper_package.rb +8 -4
- data/lib/chef/resource/zypper_repository.rb +58 -20
- data/lib/chef/resource_inspector.rb +5 -3
- data/lib/chef/resources.rb +2 -0
- data/lib/chef/util/powershell/cmdlet.rb +1 -1
- data/lib/chef/version.rb +1 -1
- data/spec/functional/resource/dsc_resource_spec.rb +3 -3
- data/spec/functional/resource/powershell_script_spec.rb +2 -2
- data/spec/functional/win32/crypto_spec.rb +1 -1
- data/spec/unit/cookbook_version_file_specificity_spec.rb +20 -0
- data/spec/unit/node_map_spec.rb +3 -3
- data/spec/unit/platform/query_helpers_spec.rb +4 -4
- data/spec/unit/provider/dsc_resource_spec.rb +2 -2
- data/spec/unit/provider/dsc_script_spec.rb +1 -1
- data/spec/unit/resource/dsc_resource_spec.rb +1 -1
- data/spec/unit/resource/locale_spec.rb +60 -0
- data/spec/unit/resource/scm_spec.rb +0 -10
- data/spec/unit/resource/windows_workgroup_spec.rb +47 -0
- data/tasks/dependencies.rb +2 -22
- data/tasks/templates/prerelease.md.erb +2 -2
- data/tasks/templates/release.md.erb +1 -1
- metadata +8 -5
- data/tasks/cbgb.rb +0 -84
@@ -25,11 +25,15 @@ class Chef
|
|
25
25
|
resource_name :zypper_package
|
26
26
|
provides :package, platform_family: "suse"
|
27
27
|
|
28
|
-
description "Use the zypper_package resource to install, upgrade, and remove"
|
29
|
-
" packages with Zypper for the SUSE Enterprise and OpenSUSE platforms."
|
28
|
+
description "Use the zypper_package resource to install, upgrade, and remove packages with Zypper for the SUSE Enterprise and OpenSUSE platforms."
|
30
29
|
|
31
|
-
property :gpg_check, [ TrueClass, FalseClass ],
|
32
|
-
|
30
|
+
property :gpg_check, [ TrueClass, FalseClass ],
|
31
|
+
description: "Verify the package's GPG signature. Can also be controlled site-wide using the ``zypper_check_gpg`` config option.",
|
32
|
+
default: lazy { Chef::Config[:zypper_check_gpg] }
|
33
|
+
|
34
|
+
property :allow_downgrade, [ TrueClass, FalseClass ],
|
35
|
+
description: "Allow downgrading a package to satisfy requested version requirements.",
|
36
|
+
default: false, introduced: "13.6"
|
33
37
|
end
|
34
38
|
end
|
35
39
|
end
|
@@ -25,33 +25,71 @@ class Chef
|
|
25
25
|
provides(:zypper_repository) { true }
|
26
26
|
provides(:zypper_repo) { true }
|
27
27
|
|
28
|
-
description "Use the zypper_repository resource to create Zypper package repositories"
|
29
|
-
" on SUSE Enterprise Linux and openSUSE systems. This resource maintains"\
|
30
|
-
" full compatibility with the zypper_repository resource in the existing"\
|
31
|
-
" zypper cookbook."
|
28
|
+
description "Use the zypper_repository resource to create Zypper package repositories on SUSE Enterprise Linux and openSUSE systems. This resource maintains full compatibility with the zypper_repository resource in the existing zypper cookbook."
|
32
29
|
introduced "13.3"
|
33
30
|
|
34
31
|
property :repo_name, String,
|
35
32
|
regex: [/^[^\/]+$/],
|
33
|
+
description: "Specifies the repository name, if it differs from the resource name.",
|
36
34
|
validation_message: "repo_name property cannot contain a forward slash '/'",
|
37
35
|
name_property: true
|
38
36
|
|
39
|
-
property :description, String
|
40
|
-
|
41
|
-
|
42
|
-
property :
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
property :
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
property :
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
property :
|
37
|
+
property :description, String,
|
38
|
+
description: "The description of the repository that will be shown by the 'zypper repos' command."
|
39
|
+
|
40
|
+
property :type, String,
|
41
|
+
description: "Specifies the repository type.",
|
42
|
+
default: "NONE"
|
43
|
+
|
44
|
+
property :enabled, [TrueClass, FalseClass],
|
45
|
+
description: "Determines whether or not the repository should be enabled.",
|
46
|
+
default: true
|
47
|
+
|
48
|
+
property :autorefresh, [TrueClass, FalseClass],
|
49
|
+
description: "Determines whether or not the repository should be refreshed automatically.",
|
50
|
+
default: true
|
51
|
+
|
52
|
+
property :gpgcheck, [TrueClass, FalseClass],
|
53
|
+
description: "Determines whether or not to perform a GPG signature check on the repository.",
|
54
|
+
default: true
|
55
|
+
|
56
|
+
property :gpgkey, String,
|
57
|
+
description: "The location of the repository key to be imported."
|
58
|
+
|
59
|
+
property :baseurl, String,
|
60
|
+
description: "The base URL for the Zypper repository, such as 'http://download.opensuse.org'."
|
61
|
+
|
62
|
+
property :mirrorlist, String,
|
63
|
+
description: "The URL of the mirror list that will be used."
|
64
|
+
|
65
|
+
property :path, String,
|
66
|
+
description: "The relative path from the repository's base URL."
|
67
|
+
|
68
|
+
property :priority, Integer,
|
69
|
+
description: "Determines the priority of the Zypper repository. ",
|
70
|
+
default: 99
|
71
|
+
|
72
|
+
property :keeppackages, [TrueClass, FalseClass],
|
73
|
+
description: "Determines whether or not packages should be saved.",
|
74
|
+
default: false
|
75
|
+
|
76
|
+
property :mode, [String, Integer],
|
77
|
+
description: "The file mode of the repository file.",
|
78
|
+
default: "0644"
|
79
|
+
|
80
|
+
property :refresh_cache, [TrueClass, FalseClass],
|
81
|
+
description: "Determines whether or not the package cache should be refreshed.",
|
82
|
+
default: true
|
83
|
+
|
84
|
+
property :source, String,
|
85
|
+
description: "The name of the template for the repository file. Only necessary if you're not using the built in template."
|
86
|
+
|
87
|
+
property :cookbook, String,
|
88
|
+
description: "The cookbook to source the repository template file from. Only necessary if you're not using the built in template."
|
89
|
+
|
90
|
+
property :gpgautoimportkeys, [TrueClass, FalseClass],
|
91
|
+
description: "Automatically import the specified key when setting up the repository.",
|
92
|
+
default: true
|
55
93
|
|
56
94
|
default_action :create
|
57
95
|
allowed_actions :create, :remove, :add, :refresh
|
@@ -56,6 +56,7 @@ module ResourceInspector
|
|
56
56
|
acc << { name: n, description: opts[:description],
|
57
57
|
introduced: opts[:introduced], is: opts[:is],
|
58
58
|
deprecated: opts[:deprecated] || false,
|
59
|
+
required: opts[:required] || false,
|
59
60
|
default: get_default(opts[:default]),
|
60
61
|
name_property: opts[:name_property] || false }
|
61
62
|
end
|
@@ -81,7 +82,8 @@ module ResourceInspector
|
|
81
82
|
# otherwise, if we have a path then extract all the resources from the cookbook
|
82
83
|
# or else do a list of built in resources
|
83
84
|
#
|
84
|
-
#
|
85
|
+
# @param complete [TrueClass, FalseClass] Whether to show properties defined in the base Resource class
|
86
|
+
# @return [String] JSON formatting of all resources
|
85
87
|
def self.inspect(arguments = [], complete: false)
|
86
88
|
output = if arguments.empty?
|
87
89
|
ObjectSpace.each_object(Class).select { |k| k < Chef::Resource }.each_with_object({}) { |klass, acc| acc[klass.resource_name] = extract_resource(klass) }
|
@@ -96,11 +98,11 @@ module ResourceInspector
|
|
96
98
|
end
|
97
99
|
end
|
98
100
|
|
99
|
-
|
101
|
+
Chef::JSONCompat.to_json_pretty(output)
|
100
102
|
end
|
101
103
|
|
102
104
|
def self.start
|
103
|
-
inspect(ARGV, complete: true)
|
105
|
+
puts inspect(ARGV, complete: true)
|
104
106
|
end
|
105
107
|
|
106
108
|
end
|
data/lib/chef/resources.rb
CHANGED
@@ -57,6 +57,7 @@ require "chef/resource/kernel_module"
|
|
57
57
|
require "chef/resource/ksh"
|
58
58
|
require "chef/resource/launchd"
|
59
59
|
require "chef/resource/link"
|
60
|
+
require "chef/resource/locale"
|
60
61
|
require "chef/resource/log"
|
61
62
|
require "chef/resource/macports_package"
|
62
63
|
require "chef/resource/macos_userdefaults"
|
@@ -139,3 +140,4 @@ require "chef/resource/windows_printer"
|
|
139
140
|
require "chef/resource/windows_printer_port"
|
140
141
|
require "chef/resource/windows_shortcut"
|
141
142
|
require "chef/resource/windows_task"
|
143
|
+
require "chef/resource/windows_workgroup"
|
@@ -90,7 +90,7 @@ class Chef
|
|
90
90
|
result = run(switches, execution_options, arguments)
|
91
91
|
|
92
92
|
if ! result.succeeded?
|
93
|
-
raise Chef::Exceptions::PowershellCmdletException, "
|
93
|
+
raise Chef::Exceptions::PowershellCmdletException, "PowerShell Cmdlet failed: #{result.stderr}"
|
94
94
|
end
|
95
95
|
|
96
96
|
result
|
data/lib/chef/version.rb
CHANGED
@@ -33,11 +33,11 @@ describe Chef::Resource::DscResource, :windows_powershell_dsc_only do
|
|
33
33
|
Chef::Resource::DscResource.new("dsc_resource_test", run_context)
|
34
34
|
end
|
35
35
|
|
36
|
-
context "when
|
37
|
-
context "when
|
36
|
+
context "when PowerShell does not support Invoke-DscResource"
|
37
|
+
context "when PowerShell supports Invoke-DscResource" do
|
38
38
|
before do
|
39
39
|
if !Chef::Platform.supports_dsc_invoke_resource?(node)
|
40
|
-
skip "Requires
|
40
|
+
skip "Requires PowerShell >= 5.0.10018.0"
|
41
41
|
elsif !Chef::Platform.supports_refresh_mode_enabled?(node) && !Chef::Platform.dsc_refresh_mode_disabled?(node)
|
42
42
|
skip "Requires LCM RefreshMode is Disabled"
|
43
43
|
end
|
@@ -42,7 +42,7 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
|
|
42
42
|
let(:valid_powershell_interpreter_flag) { "-Sta" }
|
43
43
|
|
44
44
|
let!(:resource) do
|
45
|
-
r = Chef::Resource::WindowsScript::PowershellScript.new("
|
45
|
+
r = Chef::Resource::WindowsScript::PowershellScript.new("PowerShell resource functional test", @run_context)
|
46
46
|
r.code(successful_executable_script_content)
|
47
47
|
r
|
48
48
|
end
|
@@ -154,7 +154,7 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
|
|
154
154
|
# This somewhat ambiguous case, two failures of different types,
|
155
155
|
# seems to violate the principle of returning the status of the
|
156
156
|
# last line executed -- in this case, we return the status of the
|
157
|
-
# second to last line. This happens because
|
157
|
+
# second to last line. This happens because PowerShell gives no
|
158
158
|
# way for us to determine whether the last operation was a cmdlet
|
159
159
|
# or Windows process. Because the latter gives more specific
|
160
160
|
# errors than 0 or 1, we return that instead, which is acceptable
|
@@ -36,7 +36,7 @@ describe "Chef::ReservedNames::Win32::Crypto", :windows_only do
|
|
36
36
|
|
37
37
|
it "can be decrypted by powershell" do
|
38
38
|
encrypted = Chef::ReservedNames::Win32::Crypto.encrypt(plaintext)
|
39
|
-
resource = Chef::Resource::WindowsScript::PowershellScript.new("
|
39
|
+
resource = Chef::Resource::WindowsScript::PowershellScript.new("PowerShell resource functional test", @run_context)
|
40
40
|
resource.code <<~EOF
|
41
41
|
$encrypted = '#{encrypted}' | ConvertTo-SecureString
|
42
42
|
$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($encrypted)
|
@@ -93,6 +93,13 @@ describe Chef::CookbookVersion, "file specificity" do
|
|
93
93
|
},
|
94
94
|
|
95
95
|
# directory adirectory
|
96
|
+
{
|
97
|
+
name: "files/anotherfile1.rb",
|
98
|
+
path: "files/root_directory/anotherfile1.rb.root",
|
99
|
+
checksum: "csum-root-directory",
|
100
|
+
specificity: "root_directory",
|
101
|
+
},
|
102
|
+
|
96
103
|
{
|
97
104
|
name: "files/anotherfile1.rb",
|
98
105
|
path: "files/host-examplehost.example.org/adirectory/anotherfile1.rb.host",
|
@@ -483,6 +490,19 @@ describe Chef::CookbookVersion, "file specificity" do
|
|
483
490
|
## Globbing the relative paths out of the manifest records ##
|
484
491
|
|
485
492
|
describe "when globbing for relative file paths based on filespecificity" do
|
493
|
+
it "should return a list of relative paths based on priority preference: root directory" do
|
494
|
+
node = Chef::Node.new
|
495
|
+
node.automatic_attrs[:platform] = "ubuntu"
|
496
|
+
node.automatic_attrs[:platform_version] = "9.10"
|
497
|
+
node.automatic_attrs[:fqdn] = "examplehost.example.org"
|
498
|
+
|
499
|
+
filenames = @cookbook.relative_filenames_in_preferred_directory(node, :files, "root_directory")
|
500
|
+
expect(filenames).not_to be_nil
|
501
|
+
expect(filenames.size).to eq(1)
|
502
|
+
|
503
|
+
expect(filenames.sort).to eq(["anotherfile1.rb.root"])
|
504
|
+
end
|
505
|
+
|
486
506
|
it "should return a list of relative paths based on priority preference: host" do
|
487
507
|
node = Chef::Node.new
|
488
508
|
node.automatic_attrs[:platform] = "ubuntu"
|
data/spec/unit/node_map_spec.rb
CHANGED
@@ -223,7 +223,7 @@ describe Chef::NodeMap do
|
|
223
223
|
context "while locked" do
|
224
224
|
# Uncomment the commented `expect`s in 15.0.
|
225
225
|
it "rejects setting the same key twice" do
|
226
|
-
expect(Chef).to receive(:deprecated).with(:map_collision, /
|
226
|
+
expect(Chef).to receive(:deprecated).with(:map_collision, /Resource foo/)
|
227
227
|
node_map.set(:foo, FooResource)
|
228
228
|
node_map.lock!
|
229
229
|
node_map.set(:foo, BarResource)
|
@@ -247,7 +247,7 @@ describe Chef::NodeMap do
|
|
247
247
|
end
|
248
248
|
|
249
249
|
it "rejects setting the same key twice when the first has allow_cookbook_override with a past version" do
|
250
|
-
expect(Chef).to receive(:deprecated).with(:map_collision, /
|
250
|
+
expect(Chef).to receive(:deprecated).with(:map_collision, /Resource foo/)
|
251
251
|
node_map.set(:foo, FooResource, allow_cookbook_override: "< 1")
|
252
252
|
node_map.lock!
|
253
253
|
node_map.set(:foo, BarResource)
|
@@ -263,7 +263,7 @@ describe Chef::NodeMap do
|
|
263
263
|
end
|
264
264
|
|
265
265
|
it "rejects setting the same key twice for a provider" do
|
266
|
-
expect(Chef).to receive(:deprecated).with(:map_collision, /
|
266
|
+
expect(Chef).to receive(:deprecated).with(:map_collision, /Provider foo/)
|
267
267
|
node_map.set(:foo, FooProvider)
|
268
268
|
node_map.lock!
|
269
269
|
node_map.set(:foo, BarProvider)
|
@@ -139,13 +139,13 @@ describe "Chef::Platform#supports_msi?" do
|
|
139
139
|
end
|
140
140
|
|
141
141
|
describe "Chef::Platform#supports_dsc?" do
|
142
|
-
it "returns false if
|
142
|
+
it "returns false if PowerShell is not present" do
|
143
143
|
node = Chef::Node.new
|
144
144
|
expect(Chef::Platform.supports_dsc?(node)).to be_falsey
|
145
145
|
end
|
146
146
|
|
147
147
|
["1.0", "2.0", "3.0"].each do |version|
|
148
|
-
it "returns false for
|
148
|
+
it "returns false for PowerShell #{version}" do
|
149
149
|
node = Chef::Node.new
|
150
150
|
node.automatic[:languages][:powershell][:version] = version
|
151
151
|
expect(Chef::Platform.supports_dsc?(node)).to be_falsey
|
@@ -153,7 +153,7 @@ describe "Chef::Platform#supports_dsc?" do
|
|
153
153
|
end
|
154
154
|
|
155
155
|
["4.0", "5.0"].each do |version|
|
156
|
-
it "returns true for
|
156
|
+
it "returns true for PowerShell #{version}" do
|
157
157
|
node = Chef::Node.new
|
158
158
|
node.automatic[:languages][:powershell][:version] = version
|
159
159
|
expect(Chef::Platform.supports_dsc?(node)).to be_truthy
|
@@ -168,7 +168,7 @@ describe "Chef::Platform#supports_dsc_invoke_resource?" do
|
|
168
168
|
end
|
169
169
|
|
170
170
|
["1.0", "2.0", "3.0", "4.0", "5.0.10017.9"].each do |version|
|
171
|
-
it "returns false for
|
171
|
+
it "returns false for PowerShell #{version}" do
|
172
172
|
node = Chef::Node.new
|
173
173
|
node.automatic[:languages][:powershell][:version] = version
|
174
174
|
expect(Chef::Platform.supports_dsc_invoke_resource?(node)).to be_falsey
|
@@ -27,7 +27,7 @@ describe Chef::Provider::DscResource do
|
|
27
27
|
Chef::Provider::DscResource.new(resource, run_context)
|
28
28
|
end
|
29
29
|
|
30
|
-
context "when
|
30
|
+
context "when PowerShell does not support Invoke-DscResource" do
|
31
31
|
let (:node) do
|
32
32
|
node = Chef::Node.new
|
33
33
|
node.automatic[:languages][:powershell][:version] = "4.0"
|
@@ -40,7 +40,7 @@ describe Chef::Provider::DscResource do
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
context "when
|
43
|
+
context "when PowerShell supports Invoke-DscResource" do
|
44
44
|
|
45
45
|
context "when RefreshMode is not set to Disabled" do
|
46
46
|
context "and the WMF 5 is a preview release" do
|
@@ -162,7 +162,7 @@ describe Chef::Provider::DscScript do
|
|
162
162
|
end
|
163
163
|
end
|
164
164
|
|
165
|
-
it "raises an exception if
|
165
|
+
it "raises an exception if PowerShell is not present" do
|
166
166
|
expect do
|
167
167
|
provider.run_action(:run)
|
168
168
|
end.to raise_error(Chef::Exceptions::ProviderNotFound)
|
@@ -0,0 +1,60 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Vincent AUBERT (<vincentaubert88@gmail.com>)
|
3
|
+
# Copyright:: Copyright 2008-2018, Chef Software Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require "spec_helper"
|
20
|
+
|
21
|
+
describe Chef::Resource::Locale do
|
22
|
+
|
23
|
+
let(:resource) { Chef::Resource::Locale.new("fakey_fakerton") }
|
24
|
+
|
25
|
+
it "has a name of locale" do
|
26
|
+
expect(resource.resource_name).to eq(:locale)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "the lang property is equal to en_US.utf8" do
|
30
|
+
expect(resource.lang).to eql("en_US.utf8")
|
31
|
+
end
|
32
|
+
|
33
|
+
it "the lc_all property is equal to en_US.utf8" do
|
34
|
+
expect(resource.lc_all).to eql("en_US.utf8")
|
35
|
+
end
|
36
|
+
|
37
|
+
it "sets the default action as :update" do
|
38
|
+
expect(resource.action).to eql([:update])
|
39
|
+
end
|
40
|
+
|
41
|
+
it "supports :update action" do
|
42
|
+
expect { resource.action :update }.not_to raise_error
|
43
|
+
end
|
44
|
+
|
45
|
+
describe "when the language is not the default one" do
|
46
|
+
let(:resource) { Chef::Resource::Locale.new("fakey_fakerton") }
|
47
|
+
before do
|
48
|
+
resource.lang("fr_FR.utf8")
|
49
|
+
resource.lc_all("fr_FR.utf8")
|
50
|
+
end
|
51
|
+
|
52
|
+
it "the lang property is equal to fr_FR.utf8" do
|
53
|
+
expect(resource.lang).to eql("fr_FR.utf8")
|
54
|
+
end
|
55
|
+
|
56
|
+
it "the lc_all property is equal to fr_FR.utf8" do
|
57
|
+
expect(resource.lc_all).to eql("fr_FR.utf8")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -78,16 +78,6 @@ describe Chef::Resource::Scm do
|
|
78
78
|
expect(resource.group).to eq(23)
|
79
79
|
end
|
80
80
|
|
81
|
-
it "has a svn_username String property" do
|
82
|
-
resource.svn_username "moartestsplz"
|
83
|
-
expect(resource.svn_username).to eql("moartestsplz")
|
84
|
-
end
|
85
|
-
|
86
|
-
it "has a svn_password String property" do
|
87
|
-
resource.svn_password "taftplz"
|
88
|
-
expect(resource.svn_password).to eql("taftplz")
|
89
|
-
end
|
90
|
-
|
91
81
|
it "takes the depth as an integer for shallow clones" do
|
92
82
|
resource.depth 5
|
93
83
|
expect(resource.depth).to eq(5)
|
@@ -0,0 +1,47 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright 2018, Chef Software, Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require "spec_helper"
|
19
|
+
|
20
|
+
describe Chef::Resource::WindowsWorkgroup do
|
21
|
+
let(:resource) { Chef::Resource::WindowsWorkgroup.new("example") }
|
22
|
+
|
23
|
+
it "sets resource name as :windows_workgroup" do
|
24
|
+
expect(resource.resource_name).to eql(:windows_workgroup)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "the workgroup_name property is the name_property" do
|
28
|
+
expect(resource.workgroup_name).to eql("example")
|
29
|
+
end
|
30
|
+
|
31
|
+
it "sets the default action as :join" do
|
32
|
+
expect(resource.action).to eql([:join])
|
33
|
+
end
|
34
|
+
|
35
|
+
it "supports :join action" do
|
36
|
+
expect { resource.action :join }.not_to raise_error
|
37
|
+
end
|
38
|
+
|
39
|
+
it "accepts :immediate, :reboot_now, :request_reboot, :delayed, or :never values for 'reboot' property" do
|
40
|
+
expect { resource.reboot :immediate }.not_to raise_error
|
41
|
+
expect { resource.reboot :delayed }.not_to raise_error
|
42
|
+
expect { resource.reboot :reboot_now }.not_to raise_error
|
43
|
+
expect { resource.reboot :request_reboot }.not_to raise_error
|
44
|
+
expect { resource.reboot :never }.not_to raise_error
|
45
|
+
expect { resource.reboot :nopenope }.to raise_error(ArgumentError)
|
46
|
+
end
|
47
|
+
end
|