chef 18.1.29-x64-mingw-ucrt → 18.3.0-x64-mingw-ucrt

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.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/chef-universal-mingw-ucrt.gemspec +2 -2
  3. data/chef.gemspec +1 -2
  4. data/distro/powershell/chef/chef.psm1 +459 -0
  5. data/lib/chef/application/base.rb +2 -0
  6. data/lib/chef/client.rb +2 -2
  7. data/lib/chef/cookbook/synchronizer.rb +20 -2
  8. data/lib/chef/cookbook_version.rb +1 -1
  9. data/lib/chef/http/authenticator.rb +2 -2
  10. data/lib/chef/http/ssl_policies.rb +2 -2
  11. data/lib/chef/mixin/homebrew_user.rb +12 -5
  12. data/lib/chef/mixin/proxified_socket.rb +1 -1
  13. data/lib/chef/monkey_patches/net-http.rb +127 -0
  14. data/lib/chef/node/attribute_collections.rb +8 -0
  15. data/lib/chef/node/immutable_collections.rb +5 -2
  16. data/lib/chef/node/mixin/state_tracking.rb +1 -1
  17. data/lib/chef/platform/query_helpers.rb +4 -2
  18. data/lib/chef/provider/launchd.rb +1 -1
  19. data/lib/chef/provider/mount/linux.rb +1 -1
  20. data/lib/chef/provider/mount/mount.rb +5 -5
  21. data/lib/chef/provider/package/chocolatey.rb +18 -1
  22. data/lib/chef/provider/package/zypper.rb +1 -0
  23. data/lib/chef/provider/remote_file/http.rb +1 -1
  24. data/lib/chef/provider/yum_repository.rb +1 -1
  25. data/lib/chef/resource/apt_repository.rb +25 -6
  26. data/lib/chef/resource/homebrew_cask.rb +6 -7
  27. data/lib/chef/resource/homebrew_package.rb +1 -1
  28. data/lib/chef/resource/homebrew_tap.rb +5 -5
  29. data/lib/chef/resource/launchd.rb +5 -1
  30. data/lib/chef/resource/macos_userdefaults.rb +9 -5
  31. data/lib/chef/resource/selinux_login.rb +129 -0
  32. data/lib/chef/resource/selinux_user.rb +137 -0
  33. data/lib/chef/resource/windows_certificate.rb +1 -1
  34. data/lib/chef/resource/windows_security_policy.rb +2 -2
  35. data/lib/chef/resource.rb +11 -1
  36. data/lib/chef/resources.rb +2 -0
  37. data/lib/chef/version.rb +1 -1
  38. data/lib/chef/win32/security.rb +7 -1
  39. data/spec/data/trusted_certs/intermediate.pem +38 -27
  40. data/spec/data/trusted_certs/opscode.pem +33 -54
  41. data/spec/functional/resource/chocolatey_package_spec.rb +32 -20
  42. data/spec/functional/resource/execute_spec.rb +1 -1
  43. data/spec/functional/resource/macos_userdefaults_spec.rb +4 -4
  44. data/spec/functional/resource/windows_certificate_spec.rb +25 -0
  45. data/spec/unit/client_spec.rb +2 -2
  46. data/spec/unit/mixin/homebrew_user_spec.rb +30 -7
  47. data/spec/unit/node/vivid_mash_spec.rb +42 -0
  48. data/spec/unit/provider/apt_repository_spec.rb +17 -7
  49. data/spec/unit/provider/launchd_spec.rb +2 -2
  50. data/spec/unit/provider/mount/aix_spec.rb +2 -2
  51. data/spec/unit/provider/mount/linux_spec.rb +6 -5
  52. data/spec/unit/provider/mount/mount_spec.rb +8 -8
  53. data/spec/unit/provider/package/chocolatey_spec.rb +19 -3
  54. data/spec/unit/provider/package/rpm_spec.rb +2 -2
  55. data/spec/unit/provider/package/zypper_spec.rb +10 -0
  56. data/spec/unit/provider/remote_file/http_spec.rb +4 -4
  57. data/spec/unit/resource/apt_repository_spec.rb +5 -0
  58. data/spec/unit/resource/macos_user_defaults_spec.rb +4 -4
  59. data/spec/unit/resource/selinux_login_spec.rb +73 -0
  60. data/spec/unit/resource/selinux_user_spec.rb +92 -0
  61. data/spec/unit/resource_spec.rb +86 -0
  62. metadata +22 -17
  63. data/lib/chef/powershell.rb +0 -81
  64. /data/spec/functional/assets/chocolatey_feed/{test-A.1.0.nupkg → test-A.1.0.0.nupkg} +0 -0
  65. /data/spec/functional/assets/chocolatey_feed/{test-A.1.5.nupkg → test-A.1.5.0.nupkg} +0 -0
  66. /data/spec/functional/assets/chocolatey_feed/{test-A.2.0.nupkg → test-A.2.0.0.nupkg} +0 -0
  67. /data/spec/functional/assets/chocolatey_feed/{test-B.1.0.nupkg → test-B.1.0.0.nupkg} +0 -0
@@ -0,0 +1,129 @@
1
+ #
2
+ # Licensed under the Apache License, Version 2.0 (the "License");
3
+ # you may not use this file except in compliance with the License.
4
+ # You may obtain a copy of the License at
5
+ #
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+ #
8
+ # Unless required by applicable law or agreed to in writing, software
9
+ # distributed under the License is distributed on an "AS IS" BASIS,
10
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ # See the License for the specific language governing permissions and
12
+ # limitations under the License.
13
+
14
+ require_relative "../resource"
15
+ require_relative "selinux/common_helpers"
16
+
17
+ class Chef
18
+ class Resource
19
+ class SelinuxLogin < Chef::Resource
20
+ unified_mode true
21
+
22
+ provides :selinux_login
23
+
24
+ description "Use the **selinux_login** resource to add, update, or remove SELinux user to OS login mappings."
25
+ introduced "18.1"
26
+ examples <<~DOC
27
+ **Manage test OS user mapping with a range of s0 and associated SELinux user test_u**:
28
+
29
+ ```ruby
30
+ selinux_login 'test' do
31
+ user 'test_u'
32
+ range 's0'
33
+ end
34
+ ```
35
+ DOC
36
+
37
+ property :login, String,
38
+ name_property: true,
39
+ description: "An optional property to set the OS user login value if it differs from the resource block's name."
40
+
41
+ property :user, String,
42
+ description: "SELinux user to be mapped."
43
+
44
+ property :range, String,
45
+ description: "MLS/MCS security range for the SELinux user."
46
+
47
+ load_current_value do |new_resource|
48
+ logins = shell_out!("semanage login -l").stdout.split("\n")
49
+
50
+ current_login = logins.grep(/^#{Regexp.escape(new_resource.login)}\s+/) do |l|
51
+ l.match(/^(?<login>[^\s]+)\s+(?<user>[^\s]+)\s+(?<range>[^\s]+)/)
52
+ # match returns [<Match 'data'>] or [], shift converts that to <Match 'data'> or nil
53
+ end.shift
54
+
55
+ current_value_does_not_exist! unless current_login
56
+
57
+ # Existing resources should maintain their current configuration unless otherwise specified
58
+ new_resource.user ||= current_login[:user]
59
+ new_resource.range ||= current_login[:range]
60
+
61
+ user current_login[:user]
62
+ range current_login[:range]
63
+ end
64
+
65
+ action_class do
66
+ include Chef::SELinux::CommonHelpers
67
+
68
+ def semanage_login_args
69
+ # Generate arguments for semanage login -a or -m
70
+ args = ""
71
+
72
+ args += " -s #{new_resource.user}" if new_resource.user
73
+ args += " -r #{new_resource.range}" if new_resource.range
74
+
75
+ args
76
+ end
77
+ end
78
+
79
+ action :manage, description: "Sets the SELinux login mapping to the desired settings regardless of previous state." do
80
+ run_action(:add)
81
+ run_action(:modify)
82
+ end
83
+
84
+ # Create if doesn't exist, do not touch if user already exists
85
+ action :add, description: "Creates the SELinux login mapping if not previously created." do
86
+ raise "The user property must be populated to create a new SELinux login" if new_resource.user.to_s.empty?
87
+
88
+ if selinux_disabled?
89
+ Chef::Log.warn("Unable to add SELinux login #{new_resource.login} as SELinux is disabled")
90
+ return
91
+ end
92
+
93
+ unless current_resource
94
+ converge_if_changed do
95
+ shell_out!("semanage login -a#{semanage_login_args} #{new_resource.login}")
96
+ end
97
+ end
98
+ end
99
+
100
+ # Only modify port if it exists & doesn't have the correct context already
101
+ action :modify, description: "Updates the SELinux login mapping if previously created." do
102
+ if selinux_disabled?
103
+ Chef::Log.warn("Unable to modify SELinux login #{new_resource.login} as SELinux is disabled")
104
+ return
105
+ end
106
+
107
+ if current_resource
108
+ converge_if_changed do
109
+ shell_out!("semanage login -m#{semanage_login_args} #{new_resource.login}")
110
+ end
111
+ end
112
+ end
113
+
114
+ # Delete if exists
115
+ action :delete, description: "Removes the SELinux login mapping if previously created." do
116
+ if selinux_disabled?
117
+ Chef::Log.warn("Unable to delete SELinux login #{new_resource.login} as SELinux is disabled")
118
+ return
119
+ end
120
+
121
+ if current_resource
122
+ converge_by "deleting SELinux login #{new_resource.login}" do
123
+ shell_out!("semanage login -d #{new_resource.login}")
124
+ end
125
+ end
126
+ end
127
+ end
128
+ end
129
+ end
@@ -0,0 +1,137 @@
1
+ #
2
+ # Licensed under the Apache License, Version 2.0 (the "License");
3
+ # you may not use this file except in compliance with the License.
4
+ # You may obtain a copy of the License at
5
+ #
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+ #
8
+ # Unless required by applicable law or agreed to in writing, software
9
+ # distributed under the License is distributed on an "AS IS" BASIS,
10
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ # See the License for the specific language governing permissions and
12
+ # limitations under the License.
13
+
14
+ require_relative "../resource"
15
+ require_relative "selinux/common_helpers"
16
+
17
+ class Chef
18
+ class Resource
19
+ class SelinuxUser < Chef::Resource
20
+ unified_mode true
21
+
22
+ provides :selinux_user
23
+
24
+ description "Use the **selinux_user** resource to add, update, or remove SELinux users."
25
+ introduced "18.1"
26
+ examples <<~DOC
27
+ **Manage test_u SELinux user with a level and range of s0 and roles sysadm_r and staff_r**:
28
+
29
+ ```ruby
30
+ selinux_user 'test_u' do
31
+ level 's0'
32
+ range 's0'
33
+ roles %w(sysadm_r staff_r)
34
+ end
35
+ ```
36
+ DOC
37
+
38
+ property :user, String,
39
+ name_property: true,
40
+ description: "An optional property to set the SELinux user value if it differs from the resource block's name."
41
+
42
+ property :level, String,
43
+ description: "MLS/MCS security level for the SELinux user."
44
+
45
+ property :range, String,
46
+ description: "MLS/MCS security range for the SELinux user."
47
+
48
+ property :roles, Array,
49
+ description: "Associated SELinux roles for the user.",
50
+ coerce: proc { |r| Array(r).sort }
51
+
52
+ load_current_value do |new_resource|
53
+ users = shell_out!("semanage user -l").stdout.split("\n")
54
+
55
+ current_user = users.grep(/^#{Regexp.escape(new_resource.user)}\s+/) do |u|
56
+ u.match(/^(?<user>[^\s]+)\s+(?<prefix>[^\s]+)\s+(?<level>[^\s]+)\s+(?<range>[^\s]+)\s+(?<roles>.*)$/)
57
+ # match returns [<Match 'data'>] or [], shift converts that to <Match 'data'> or nil
58
+ end.shift
59
+
60
+ current_value_does_not_exist! unless current_user
61
+
62
+ # Existing resources should maintain their current configuration unless otherwise specified
63
+ new_resource.level ||= current_user[:level]
64
+ new_resource.range ||= current_user[:range]
65
+ new_resource.roles ||= current_user[:roles].to_s.split.sort
66
+
67
+ level current_user[:level]
68
+ range current_user[:range]
69
+ roles current_user[:roles].to_s.split.sort
70
+ end
71
+
72
+ action_class do
73
+ include Chef::SELinux::CommonHelpers
74
+
75
+ def semanage_user_args
76
+ # Generate arguments for semanage user -a or -m
77
+ args = ""
78
+
79
+ args += " -L #{new_resource.level}" if new_resource.level
80
+ args += " -r #{new_resource.range}" if new_resource.range
81
+ args += " -R '#{new_resource.roles.join(" ")}'" unless new_resource.roles.to_a.empty?
82
+
83
+ args
84
+ end
85
+ end
86
+
87
+ action :manage, description: "Sets the SELinux user to the desired settings regardless of previous state." do
88
+ run_action(:add)
89
+ run_action(:modify)
90
+ end
91
+
92
+ # Create if doesn't exist, do not touch if user already exists
93
+ action :add, description: "Creates the SELinux user if not previously created." do
94
+ raise "The roles property must be populated to create a new SELinux user" if new_resource.roles.to_a.empty?
95
+
96
+ if selinux_disabled?
97
+ Chef::Log.warn("Unable to add SELinux user #{new_resource.user} as SELinux is disabled")
98
+ return
99
+ end
100
+
101
+ unless current_resource
102
+ converge_if_changed do
103
+ shell_out!("semanage user -a#{semanage_user_args} #{new_resource.user}")
104
+ end
105
+ end
106
+ end
107
+
108
+ # Only modify port if it exists & doesn't have the correct context already
109
+ action :modify, description: "Updates the SELinux user if previously created." do
110
+ if selinux_disabled?
111
+ Chef::Log.warn("Unable to modify SELinux user #{new_resource.user} as SELinux is disabled")
112
+ return
113
+ end
114
+
115
+ if current_resource
116
+ converge_if_changed do
117
+ shell_out!("semanage user -m#{semanage_user_args} #{new_resource.user}")
118
+ end
119
+ end
120
+ end
121
+
122
+ # Delete if exists
123
+ action :delete, description: "Removes the SELinux user if previously created." do
124
+ if selinux_disabled?
125
+ Chef::Log.warn("Unable to delete SELinux user #{new_resource.user} as SELinux is disabled")
126
+ return
127
+ end
128
+
129
+ if current_resource
130
+ converge_by "deleting SELinux user #{new_resource.user}" do
131
+ shell_out!("semanage user -d #{new_resource.user}")
132
+ end
133
+ end
134
+ end
135
+ end
136
+ end
137
+ end
@@ -440,7 +440,7 @@ class Chef
440
440
  def export_cert(cert_obj, output_path:, store_name:, store_location:, pfx_password:)
441
441
  # Delete the cert if it exists on disk already.
442
442
  # We want to ensure we're not randomly loading an old stinky cert.
443
- if ::File.exists?(output_path)
443
+ if ::File.exist?(output_path)
444
444
  ::File.delete(output_path)
445
445
  end
446
446
 
@@ -118,13 +118,13 @@ class Chef
118
118
  file.write("[Unicode]\r\nUnicode=yes\r\n[System Access]\r\n#{policy_line}\r\n[Version]\r\nsignature=\"$CHICAGO$\"\r\nRevision=1\r\n")
119
119
  file.close
120
120
  file_path = file.path.tr("/", "\\")
121
- cmd = "C:\\Windows\\System32\\secedit /configure /db C:\\windows\\security\\new.sdb /cfg #{file_path} /areas SECURITYPOLICY"
121
+ cmd = "C:\\Windows\\System32\\secedit /configure /db C:\\windows\\security\\new.sdb /cfg \"#{file_path}\" /areas SECURITYPOLICY"
122
122
  else
123
123
  policy_line = "#{security_option} = #{security_value}"
124
124
  file.write("[Unicode]\r\nUnicode=yes\r\n[System Access]\r\n#{policy_line}\r\n[Version]\r\nsignature=\"$CHICAGO$\"\r\nRevision=1\r\n")
125
125
  file.close
126
126
  file_path = file.path.tr("/", "\\")
127
- cmd = "C:\\Windows\\System32\\secedit /configure /db C:\\windows\\security\\new.sdb /cfg #{file_path} /areas SECURITYPOLICY"
127
+ cmd = "C:\\Windows\\System32\\secedit /configure /db C:\\windows\\security\\new.sdb /cfg \"#{file_path}\" /areas SECURITYPOLICY"
128
128
  end
129
129
  shell_out!(cmd)
130
130
  file.unlink
data/lib/chef/resource.rb CHANGED
@@ -1508,7 +1508,17 @@ class Chef
1508
1508
  dirname = ::File.dirname(partial)
1509
1509
  basename = ::File.basename(partial, ".rb")
1510
1510
  basename = basename[1..] if basename.start_with?("_")
1511
- class_eval IO.read(::File.expand_path("#{dirname}/_#{basename}.rb", ::File.dirname(caller_locations.first.path)))
1511
+
1512
+ # Support recursive `use`
1513
+ callers = caller_locations
1514
+ used_from = if callers.first.label == "use"
1515
+ callers.detect { |caller| caller.label == "class_from_file" }.path
1516
+ else
1517
+ callers.first.path
1518
+ end
1519
+
1520
+ fullpath = ::File.expand_path("#{dirname}/_#{basename}.rb", ::File.dirname(used_from))
1521
+ class_eval IO.read(fullpath)
1512
1522
  end
1513
1523
  end
1514
1524
 
@@ -127,10 +127,12 @@ require_relative "resource/script"
127
127
  require_relative "resource/selinux_boolean"
128
128
  require_relative "resource/selinux_fcontext"
129
129
  require_relative "resource/selinux_install"
130
+ require_relative "resource/selinux_login"
130
131
  require_relative "resource/selinux_module"
131
132
  require_relative "resource/selinux_permissive"
132
133
  require_relative "resource/selinux_port"
133
134
  require_relative "resource/selinux_state"
135
+ require_relative "resource/selinux_user"
134
136
  require_relative "resource/service"
135
137
  require_relative "resource/sudo"
136
138
  require_relative "resource/sysctl"
data/lib/chef/version.rb CHANGED
@@ -23,7 +23,7 @@ require_relative "version_string"
23
23
 
24
24
  class Chef
25
25
  CHEF_ROOT = File.expand_path("..", __dir__)
26
- VERSION = Chef::VersionString.new("18.1.29")
26
+ VERSION = Chef::VersionString.new("18.3.0")
27
27
  end
28
28
 
29
29
  #
@@ -721,7 +721,13 @@ class Chef
721
721
  unless LogonUserW(username, domain, password, logon_type, logon_provider, token)
722
722
  Chef::ReservedNames::Win32::Error.raise!
723
723
  end
724
- Token.new(Handle.new(token.read_pointer))
724
+
725
+ # originally this was .read_pointer, but that is interpreted as a non-primitive
726
+ # class (FFI::Pointer) and causes an ArgumentError (Invalid Memory Object) when
727
+ # compared to GetCurrentProcess(), which returns a HANDLE (void *). Since a
728
+ # HANDLE is not a pointer to allocated memory that Ruby C extensions can understand,
729
+ # the Invalid Memory Object error is raised.
730
+ Token.new(Handle.new(token.read_ulong))
725
731
  end
726
732
 
727
733
  def self.test_and_raise_lsa_nt_status(result)
@@ -1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hAHQAZQBkACAAaABlAHIAZQBp
28
+ AG4AIABiAHkAIAByAGUAZgBlAHIAZQBuAGMAZQAuMB0GA1UdDgQWBBTnAiOAAE/Y
29
+ 17yUC9k/dDlJMjyKeTAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYunpyGd823IDzAN
30
+ BgkqhkiG9w0BAQsFAAOCAQEATtSJJ7n9HYd3fg8oBZDxCi/JOz69k5yQxq/6kVGH
31
+ MlRr6MrBcVFcmY61+uBiGZmmB5p8Eyfb5QKihBLZFfYKRFfENI9tcx861qABPd7j
32
+ guRFa7LrJf2AXh05kL5bQvbOkWDj+aBWDEgQzjNoe82Tq/Bqy09YD7l7XRsEgZ6n
33
+ IuJXSSfukpMIvmkIUwI6Ll3IGfRQgE4C2bBdkbSTh/mWloFVQI5m7YLYuyhf7Uxh
34
+ 7QZYKBlTEUS8RyApsgRs2IlUmTt122d4LB6SeMZVPVgSETJuvUMMTTTbe8ZC2+y+
35
+ q5thTAaS447fISpQVwTAYKI11SSeZjcJSc/V+GWz4OJuwg==
57
36
  -----END CERTIFICATE-----
@@ -22,8 +22,16 @@ describe Chef::Resource::ChocolateyPackage, :windows_only, :choco_installed do
22
22
  include Chef::Mixin::ShellOut
23
23
 
24
24
  let(:package_name) { "test-A" }
25
- let(:package_list) { proc { shell_out!("choco list -lo -r #{Array(package_name).join(" ")}").stdout.chomp } }
26
25
  let(:package_source) { File.join(CHEF_SPEC_ASSETS, "chocolatey_feed") }
26
+ let(:package_list) do
27
+ if Chef::Provider::Package::Chocolatey.query_command == "list"
28
+ # using result of query_command because that indicates which "search" command to use
29
+ # which coincides with the package list output
30
+ proc { shell_out!("choco search -lo #{Array(package_name).join(" ")}").stdout.chomp }
31
+ else
32
+ proc { shell_out!("choco list #{Array(package_name).join(" ")}").stdout.chomp }
33
+ end
34
+ end
27
35
 
28
36
  let(:run_context) do
29
37
  Chef::RunContext.new(Chef::Node.new, {}, Chef::EventDispatch::Dispatcher.new)
@@ -54,12 +62,16 @@ describe Chef::Resource::ChocolateyPackage, :windows_only, :choco_installed do
54
62
  ENV["Path"] = ENV.delete("Path")
55
63
  end
56
64
 
65
+ after(:each) do
66
+ described_class.instance_variable_set(:@get_choco_version, nil)
67
+ end
68
+
57
69
  context "installing a package" do
58
70
  after { remove_package }
59
71
 
60
72
  it "installs the latest version" do
61
73
  subject.run_action(:install)
62
- expect(package_list.call).to eq("#{package_name}|2.0")
74
+ expect(package_list.call).to match(/^#{package_name}|2.0.0$/)
63
75
  end
64
76
 
65
77
  it "does not install if already installed" do
@@ -69,19 +81,19 @@ describe Chef::Resource::ChocolateyPackage, :windows_only, :choco_installed do
69
81
  end
70
82
 
71
83
  it "installs version given" do
72
- subject.version "1.0"
84
+ subject.version "1.0.0"
73
85
  subject.run_action(:install)
74
- expect(package_list.call).to eq("#{package_name}|1.0")
86
+ expect(package_list.call).to match(/^#{package_name}|1.0.0$/)
75
87
  end
76
88
 
77
89
  it "installs new version if one is already installed" do
78
- subject.version "1.0"
90
+ subject.version "1.0.0"
79
91
  subject.run_action(:install)
80
- expect(package_list.call).to eq("#{package_name}|1.0")
92
+ expect(package_list.call).to match(/^#{package_name}|1.0.0$/)
81
93
 
82
- subject.version "2.0"
94
+ subject.version "2.0.0"
83
95
  subject.run_action(:install)
84
- expect(package_list.call).to eq("#{package_name}|2.0")
96
+ expect(package_list.call).to match(/^#{package_name}|2.0.0$/)
85
97
  end
86
98
 
87
99
  context "installing multiple packages" do
@@ -89,7 +101,7 @@ describe Chef::Resource::ChocolateyPackage, :windows_only, :choco_installed do
89
101
 
90
102
  it "installs both packages" do
91
103
  subject.run_action(:install)
92
- expect(package_list.call).to eq("test-A|2.0\r\ntest-B|1.0")
104
+ expect(package_list.call).to match(/^test-A|2.0.0\r\ntest-B|1.0.0$/)
93
105
  end
94
106
  end
95
107
 
@@ -101,13 +113,13 @@ describe Chef::Resource::ChocolateyPackage, :windows_only, :choco_installed do
101
113
  it "installs with an option as a string" do
102
114
  subject.options "--force --confirm"
103
115
  subject.run_action(:install)
104
- expect(package_list.call).to eq("#{package_name}|2.0")
116
+ expect(package_list.call).to match(/^#{package_name}|2.0.0$/)
105
117
  end
106
118
 
107
119
  it "installs with multiple options as a string" do
108
120
  subject.options "--force --confirm"
109
121
  subject.run_action(:install)
110
- expect(package_list.call).to eq("#{package_name}|2.0")
122
+ expect(package_list.call).to match(/^#{package_name}|2.0.0$/)
111
123
  end
112
124
 
113
125
  context "when multiple options passed as string" do
@@ -137,7 +149,7 @@ describe Chef::Resource::ChocolateyPackage, :windows_only, :choco_installed do
137
149
  it "installs with multiple options as an array" do
138
150
  subject.options [ "--force", "--confirm" ]
139
151
  subject.run_action(:install)
140
- expect(package_list.call).to eq("#{package_name}|2.0")
152
+ expect(package_list.call).to match(/^#{package_name}|2.0.0$/)
141
153
  end
142
154
  end
143
155
 
@@ -145,24 +157,24 @@ describe Chef::Resource::ChocolateyPackage, :windows_only, :choco_installed do
145
157
  after { remove_package }
146
158
 
147
159
  it "upgrades to a specific version" do
148
- subject.version "1.0"
160
+ subject.version "1.0.0"
149
161
  subject.run_action(:install)
150
- expect(package_list.call).to eq("#{package_name}|1.0")
162
+ expect(package_list.call).to match(/^#{package_name}|1.0.0$/)
151
163
 
152
- subject.version "1.5"
164
+ subject.version "1.5.0"
153
165
  subject.run_action(:upgrade)
154
- expect(package_list.call).to eq("#{package_name}|1.5")
166
+ expect(package_list.call).to match(/^#{package_name}|1.5.0$/)
155
167
  end
156
168
 
157
169
  it "upgrades to the latest version if no version given" do
158
- subject.version "1.0"
170
+ subject.version "1.0.0"
159
171
  subject.run_action(:install)
160
- expect(package_list.call).to eq("#{package_name}|1.0")
172
+ expect(package_list.call).to match(/^#{package_name}|1.0.0$/)
161
173
 
162
174
  subject2 = Chef::Resource::ChocolateyPackage.new("test-A", run_context)
163
175
  subject2.source package_source
164
176
  subject2.run_action(:upgrade)
165
- expect(package_list.call).to eq("#{package_name}|2.0")
177
+ expect(package_list.call).to match(/^#{package_name}|2.0.0$/)
166
178
  end
167
179
  end
168
180
 
@@ -170,7 +182,7 @@ describe Chef::Resource::ChocolateyPackage, :windows_only, :choco_installed do
170
182
  it "removes an installed package" do
171
183
  subject.run_action(:install)
172
184
  remove_package
173
- expect(package_list.call).to eq("")
185
+ expect(package_list.call).to match(/0 packages installed/)
174
186
  end
175
187
  end
176
188
 
@@ -62,7 +62,7 @@ describe Chef::Resource::Execute do
62
62
  end
63
63
 
64
64
  describe "when parent resource sets :cwd" do
65
- let(:guard) { %{ruby -e 'exit 1 unless File.exists?("./nested.json")'} }
65
+ let(:guard) { %{ruby -e 'exit 1 unless File.exist?("./nested.json")'} }
66
66
 
67
67
  it "guard inherits :cwd from resource and runs" do
68
68
  resource.cwd CHEF_SPEC_DATA