chef 14.4.56 → 14.5.27

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +0 -1
  3. data/VERSION +1 -1
  4. data/lib/.DS_Store +0 -0
  5. data/lib/chef/.DS_Store +0 -0
  6. data/lib/chef/client.rb +1 -1
  7. data/lib/chef/cookbook_version.rb +2 -2
  8. data/lib/chef/mixin/powershell_out.rb +1 -1
  9. data/lib/chef/node_map.rb +4 -10
  10. data/lib/chef/provider/.DS_Store +0 -0
  11. data/lib/chef/provider/dsc_resource.rb +2 -2
  12. data/lib/chef/provider/dsc_script.rb +4 -4
  13. data/lib/chef/provider/package/powershell.rb +1 -1
  14. data/lib/chef/provider/powershell_script.rb +3 -3
  15. data/lib/chef/provider/script.rb +2 -2
  16. data/lib/chef/resource/apt_package.rb +1 -0
  17. data/lib/chef/resource/apt_repository.rb +1 -1
  18. data/lib/chef/resource/build_essential.rb +38 -38
  19. data/lib/chef/resource/chef_gem.rb +4 -1
  20. data/lib/chef/resource/chocolatey_package.rb +2 -1
  21. data/lib/chef/resource/directory.rb +6 -2
  22. data/lib/chef/resource/dmg_package.rb +1 -4
  23. data/lib/chef/resource/dnf_package.rb +20 -23
  24. data/lib/chef/resource/dpkg_package.rb +1 -3
  25. data/lib/chef/resource/dsc_resource.rb +2 -5
  26. data/lib/chef/resource/dsc_script.rb +1 -8
  27. data/lib/chef/resource/execute.rb +4 -1
  28. data/lib/chef/resource/gem_package.rb +17 -19
  29. data/lib/chef/resource/git.rb +4 -4
  30. data/lib/chef/resource/homebrew_cask.rb +2 -2
  31. data/lib/chef/resource/homebrew_tap.rb +3 -3
  32. data/lib/chef/resource/hostname.rb +4 -4
  33. data/lib/chef/resource/http_request.rb +1 -3
  34. data/lib/chef/resource/ifconfig.rb +1 -1
  35. data/lib/chef/resource/locale.rb +93 -0
  36. data/lib/chef/resource/macos_userdefaults.rb +2 -4
  37. data/lib/chef/resource/macosx_service.rb +2 -3
  38. data/lib/chef/resource/mount.rb +45 -18
  39. data/lib/chef/resource/msu_package.rb +10 -7
  40. data/lib/chef/resource/ohai.rb +2 -4
  41. data/lib/chef/resource/ohai_hint.rb +3 -3
  42. data/lib/chef/resource/openssl_dhparam.rb +5 -5
  43. data/lib/chef/resource/openssl_ec_private_key.rb +5 -5
  44. data/lib/chef/resource/openssl_ec_public_key.rb +5 -5
  45. data/lib/chef/resource/openssl_rsa_private_key.rb +6 -6
  46. data/lib/chef/resource/openssl_rsa_public_key.rb +7 -7
  47. data/lib/chef/resource/openssl_x509_certificate.rb +11 -11
  48. data/lib/chef/resource/openssl_x509_crl.rb +2 -2
  49. data/lib/chef/resource/openssl_x509_request.rb +7 -7
  50. data/lib/chef/resource/osx_profile.rb +13 -8
  51. data/lib/chef/resource/package.rb +26 -8
  52. data/lib/chef/resource/paludis_package.rb +3 -1
  53. data/lib/chef/resource/portage_package.rb +2 -1
  54. data/lib/chef/resource/powershell_package.rb +17 -9
  55. data/lib/chef/resource/powershell_package_source.rb +1 -1
  56. data/lib/chef/resource/reboot.rb +7 -2
  57. data/lib/chef/resource/rhsm_errata_level.rb +1 -3
  58. data/lib/chef/resource/route.rb +1 -1
  59. data/lib/chef/resource/scm.rb +42 -14
  60. data/lib/chef/resource/subversion.rb +7 -0
  61. data/lib/chef/resource/sudo.rb +7 -7
  62. data/lib/chef/resource/swap_file.rb +2 -2
  63. data/lib/chef/resource/sysctl.rb +1 -1
  64. data/lib/chef/resource/systemd_unit.rb +2 -1
  65. data/lib/chef/resource/windows_ad_join.rb +9 -4
  66. data/lib/chef/resource/windows_auto_run.rb +5 -5
  67. data/lib/chef/resource/windows_env.rb +1 -3
  68. data/lib/chef/resource/windows_feature_dism.rb +4 -5
  69. data/lib/chef/resource/windows_font.rb +3 -5
  70. data/lib/chef/resource/windows_package.rb +1 -2
  71. data/lib/chef/resource/windows_printer.rb +7 -9
  72. data/lib/chef/resource/windows_printer_port.rb +1 -1
  73. data/lib/chef/resource/windows_service.rb +26 -21
  74. data/lib/chef/resource/windows_shortcut.rb +4 -4
  75. data/lib/chef/resource/windows_task.rb +82 -36
  76. data/lib/chef/resource/windows_workgroup.rb +101 -0
  77. data/lib/chef/resource/yum_package.rb +30 -20
  78. data/lib/chef/resource/yum_repository.rb +134 -45
  79. data/lib/chef/resource/zypper_package.rb +8 -4
  80. data/lib/chef/resource/zypper_repository.rb +58 -20
  81. data/lib/chef/resource_inspector.rb +5 -3
  82. data/lib/chef/resources.rb +2 -0
  83. data/lib/chef/util/powershell/cmdlet.rb +1 -1
  84. data/lib/chef/version.rb +1 -1
  85. data/spec/functional/resource/dsc_resource_spec.rb +3 -3
  86. data/spec/functional/resource/powershell_script_spec.rb +2 -2
  87. data/spec/functional/win32/crypto_spec.rb +1 -1
  88. data/spec/unit/cookbook_version_file_specificity_spec.rb +20 -0
  89. data/spec/unit/node_map_spec.rb +3 -3
  90. data/spec/unit/platform/query_helpers_spec.rb +4 -4
  91. data/spec/unit/provider/dsc_resource_spec.rb +2 -2
  92. data/spec/unit/provider/dsc_script_spec.rb +1 -1
  93. data/spec/unit/resource/dsc_resource_spec.rb +1 -1
  94. data/spec/unit/resource/locale_spec.rb +60 -0
  95. data/spec/unit/resource/scm_spec.rb +0 -10
  96. data/spec/unit/resource/windows_workgroup_spec.rb +47 -0
  97. data/tasks/dependencies.rb +2 -22
  98. data/tasks/templates/prerelease.md.erb +2 -2
  99. data/tasks/templates/release.md.erb +1 -1
  100. metadata +8 -5
  101. 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 ], default: lazy { Chef::Config[:zypper_check_gpg] }
32
- property :allow_downgrade, [ TrueClass, FalseClass ], default: false
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
- property :type, String, default: "NONE"
41
- property :enabled, [TrueClass, FalseClass], default: true
42
- property :autorefresh, [TrueClass, FalseClass], default: true
43
- property :gpgcheck, [TrueClass, FalseClass], default: true
44
- property :gpgkey, String
45
- property :baseurl, String
46
- property :mirrorlist, String
47
- property :path, String
48
- property :priority, Integer, default: 99
49
- property :keeppackages, [TrueClass, FalseClass], default: false
50
- property :mode, default: "0644"
51
- property :refresh_cache, [TrueClass, FalseClass], default: true
52
- property :source, String
53
- property :cookbook, String
54
- property :gpgautoimportkeys, [TrueClass, FalseClass], default: true
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
- # @param complete [TrueClass, FalseClass] Whether to show properties defined in the base Resource class
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
- puts Chef::JSONCompat.to_json_pretty(output)
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
@@ -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, "Powershell Cmdlet failed: #{result.stderr}"
93
+ raise Chef::Exceptions::PowershellCmdletException, "PowerShell Cmdlet failed: #{result.stderr}"
94
94
  end
95
95
 
96
96
  result
@@ -23,7 +23,7 @@ require "chef/version_string"
23
23
 
24
24
  class Chef
25
25
  CHEF_ROOT = File.expand_path("../..", __FILE__)
26
- VERSION = Chef::VersionString.new("14.4.56")
26
+ VERSION = Chef::VersionString.new("14.5.27")
27
27
  end
28
28
 
29
29
  #
@@ -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 Powershell does not support Invoke-DscResource"
37
- context "when Powershell supports Invoke-DscResource" do
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 Powershell >= 5.0.10018.0"
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("Powershell resource functional test", @run_context)
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 Powershell gives no
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("Powershell resource functional test", @run_context)
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"
@@ -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, /resource foo/)
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, /resource foo/)
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, /provider foo/)
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 powershell is not present" do
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 Powershell #{version}" do
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 Powershell #{version}" do
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 Powershell #{version}" do
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 Powershell does not support Invoke-DscResource" do
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 Powershell supports Invoke-DscResource" do
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 Powershell is not present" do
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)
@@ -93,7 +93,7 @@ describe Chef::Resource::DscResource do
93
93
  end
94
94
  end
95
95
 
96
- context "Powershell DSL methods" do
96
+ context "PowerShell DSL methods" do
97
97
  it "responds to :ps_credential" do
98
98
  expect(dsc_test_resource.respond_to?(:ps_credential)).to be true
99
99
  end
@@ -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