chef 17.0.242 → 17.1.35
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -12
- data/Rakefile +2 -2
- data/chef.gemspec +9 -20
- data/lib/chef/chef_fs/file_pattern.rb +2 -2
- data/lib/chef/compliance/default_attributes.rb +1 -1
- data/lib/chef/compliance/reporter/automate.rb +1 -1
- data/lib/chef/compliance/runner.rb +2 -2
- data/lib/chef/cookbook/cookbook_version_loader.rb +3 -3
- data/lib/chef/cookbook/gem_installer.rb +5 -1
- data/lib/chef/dsl/declare_resource.rb +5 -10
- data/lib/chef/formatters/doc.rb +2 -1
- data/lib/chef/node.rb +1 -1
- data/lib/chef/provider/directory.rb +6 -6
- data/lib/chef/provider/link.rb +1 -1
- data/lib/chef/provider/package/dnf/dnf_helper.py +11 -10
- data/lib/chef/provider/package/dnf/python_helper.rb +9 -8
- data/lib/chef/provider/package/yum.rb +1 -4
- data/lib/chef/provider/package/yum/python_helper.rb +15 -10
- data/lib/chef/provider/package/yum/yum_helper.py +46 -62
- data/lib/chef/provider/registry_key.rb +1 -1
- data/lib/chef/provider/service/systemd.rb +1 -1
- data/lib/chef/provider/systemd_unit.rb +1 -1
- data/lib/chef/provider/template/content.rb +1 -1
- data/lib/chef/provider/windows_script.rb +1 -1
- data/lib/chef/resource.rb +6 -7
- data/lib/chef/resource/execute.rb +2 -2
- data/lib/chef/resource/inspec_waiver_file_entry.rb +155 -0
- data/lib/chef/resource/lwrp_base.rb +17 -2
- data/lib/chef/resource/remote_file.rb +2 -2
- data/lib/chef/resource/windows_env.rb +1 -1
- data/lib/chef/resource/windows_font.rb +1 -1
- data/lib/chef/resource/windows_pagefile.rb +2 -2
- data/lib/chef/resource/windows_path.rb +2 -2
- data/lib/chef/resource/windows_security_policy.rb +5 -2
- data/lib/chef/resource/windows_task.rb +1 -1
- data/lib/chef/resource_builder.rb +8 -2
- data/lib/chef/resources.rb +1 -0
- data/lib/chef/run_lock.rb +1 -1
- data/lib/chef/runner.rb +1 -1
- data/lib/chef/shell/ext.rb +3 -3
- data/lib/chef/version.rb +1 -1
- data/lib/chef/win32/api.rb +9 -2
- data/spec/data/knife-home/.chef/plugins/knife/example_home_subcommand.rb +0 -0
- data/spec/data/knife-site-subcommands/plugins/knife/example_subcommand.rb +0 -0
- data/spec/data/knife_subcommand/test_explicit_category.rb +7 -0
- data/spec/data/knife_subcommand/test_name_mapping.rb +4 -0
- data/spec/data/knife_subcommand/test_yourself.rb +21 -0
- data/spec/functional/resource/dnf_package_spec.rb +857 -537
- data/spec/functional/resource/group_spec.rb +1 -1
- data/spec/functional/resource/link_spec.rb +1 -1
- data/spec/functional/resource/remote_file_spec.rb +1 -1
- data/spec/functional/resource/windows_env_spec.rb +2 -2
- data/spec/functional/resource/yum_package_spec.rb +495 -428
- data/spec/integration/client/client_spec.rb +0 -20
- data/spec/integration/recipes/unified_mode_spec.rb +70 -0
- data/spec/spec_helper.rb +3 -0
- data/spec/support/chef_helpers.rb +1 -1
- data/spec/support/shared/functional/execute_resource.rb +1 -1
- data/spec/support/shared/functional/knife.rb +37 -0
- data/spec/support/shared/integration/knife_support.rb +192 -0
- data/spec/support/shared/unit/knife_shared.rb +39 -0
- data/spec/support/shared/unit/provider/file.rb +1 -1
- data/spec/unit/chef_fs/file_system/repository/directory_spec.rb +1 -1
- data/spec/unit/compliance/runner_spec.rb +1 -1
- data/spec/unit/provider/link_spec.rb +1 -1
- data/spec/unit/provider/package/dnf/python_helper_spec.rb +1 -0
- data/spec/unit/provider/package/yum/python_helper_spec.rb +1 -0
- data/spec/unit/provider/service/systemd_service_spec.rb +2 -2
- data/spec/unit/provider/systemd_unit_spec.rb +2 -2
- data/spec/unit/resource/inspec_waiver_file_entry_spec.rb +80 -0
- data/tasks/rspec.rb +4 -9
- metadata +16 -160
- data/lib/chef/provider/package/yum/simplejson/LICENSE.txt +0 -79
- data/lib/chef/provider/package/yum/simplejson/__init__.py +0 -318
- data/lib/chef/provider/package/yum/simplejson/__init__.pyc +0 -0
- data/lib/chef/provider/package/yum/simplejson/decoder.py +0 -354
- data/lib/chef/provider/package/yum/simplejson/decoder.pyc +0 -0
- data/lib/chef/provider/package/yum/simplejson/encoder.py +0 -440
- data/lib/chef/provider/package/yum/simplejson/encoder.pyc +0 -0
- data/lib/chef/provider/package/yum/simplejson/scanner.py +0 -65
- data/lib/chef/provider/package/yum/simplejson/scanner.pyc +0 -0
- data/lib/chef/provider/package/yum/simplejson/tool.py +0 -37
@@ -26,6 +26,7 @@ require_relative "../exceptions"
|
|
26
26
|
require_relative "../mixin/convert_to_class_name"
|
27
27
|
require_relative "../mixin/from_file"
|
28
28
|
require_relative "../mixin/params_validate" # for DelayedEvaluator
|
29
|
+
require_relative "../version"
|
29
30
|
|
30
31
|
class Chef
|
31
32
|
class Resource
|
@@ -53,8 +54,8 @@ class Chef
|
|
53
54
|
resource_class.run_context = run_context
|
54
55
|
resource_class.class_from_file(filename)
|
55
56
|
|
56
|
-
|
57
|
-
Chef.deprecated :unified_mode, "The #{resource_name} resource in the #{cookbook_name} cookbook should declare `unified_mode true`"
|
57
|
+
if !resource_class.unified_mode && !deprecated_class(resource_class)
|
58
|
+
Chef.deprecated :unified_mode, "The #{resource_class.resource_name} resource in the #{cookbook_name} cookbook should declare `unified_mode true`", filename
|
58
59
|
end
|
59
60
|
|
60
61
|
# Make a useful string for the class (rather than <Class:312894723894>)
|
@@ -121,6 +122,20 @@ class Chef
|
|
121
122
|
|
122
123
|
superclass.respond_to?(m) ? superclass.send(m) : default
|
123
124
|
end
|
125
|
+
|
126
|
+
# Return true if the resource has been deprecated on this version.
|
127
|
+
#
|
128
|
+
# XXX: for now we only look at chef_version_for_provides, reversing the
|
129
|
+
# resource node_map to determine if the resource provides anything which is
|
130
|
+
# wired up is difficult.
|
131
|
+
#
|
132
|
+
def deprecated_class(resource_class)
|
133
|
+
if resource_class.chef_version_for_provides && Chef::VERSION !~ resource_class.chef_version_for_provides
|
134
|
+
return true
|
135
|
+
end
|
136
|
+
|
137
|
+
false
|
138
|
+
end
|
124
139
|
end
|
125
140
|
end
|
126
141
|
end
|
@@ -142,13 +142,13 @@ class Chef
|
|
142
142
|
end
|
143
143
|
|
144
144
|
# if domain is provided in both username and domain
|
145
|
-
if specified_user && ((specified_user.include?
|
145
|
+
if specified_user && ((specified_user.include? "\\") || (specified_user.include? "@")) && specified_domain
|
146
146
|
raise ArgumentError, "The domain is provided twice. Username: `#{specified_user}`, Domain: `#{specified_domain}`. Please specify domain only once."
|
147
147
|
end
|
148
148
|
|
149
149
|
if ! specified_user.nil? && specified_domain.nil?
|
150
150
|
# Splitting username of format: Domain\Username
|
151
|
-
domain_and_user = user.split(
|
151
|
+
domain_and_user = user.split("\\")
|
152
152
|
|
153
153
|
if domain_and_user.length == 2
|
154
154
|
domain = domain_and_user[0]
|
@@ -186,7 +186,7 @@ class Chef
|
|
186
186
|
if environment_variables && environment_variables.length > 0
|
187
187
|
environment_variables.each do |env|
|
188
188
|
@env_obj = env.wmi_ole_object
|
189
|
-
return @env_obj if @env_obj.username.split(
|
189
|
+
return @env_obj if @env_obj.username.split("\\").last.casecmp(new_resource.user) == 0
|
190
190
|
end
|
191
191
|
end
|
192
192
|
@env_obj = nil
|
@@ -43,7 +43,7 @@ class Chef
|
|
43
43
|
|
44
44
|
property :source, String,
|
45
45
|
description: "A local filesystem path or URI that is used to source the font file.",
|
46
|
-
coerce: proc { |x| /^.:.*/.match?(x) ? x.tr(
|
46
|
+
coerce: proc { |x| /^.:.*/.match?(x) ? x.tr("\\", "/").gsub("//", "/") : x }
|
47
47
|
|
48
48
|
action :install, description: "Install a font to the system fonts directory" do
|
49
49
|
if font_exists?
|
@@ -56,7 +56,7 @@ class Chef
|
|
56
56
|
DOC
|
57
57
|
|
58
58
|
property :path, String,
|
59
|
-
coerce: proc { |x| x.tr("/",
|
59
|
+
coerce: proc { |x| x.tr("/", "\\") },
|
60
60
|
description: "An optional property to set the pagefile name if it differs from the resource block's name.",
|
61
61
|
name_property: true
|
62
62
|
|
@@ -220,7 +220,7 @@ class Chef
|
|
220
220
|
end
|
221
221
|
|
222
222
|
def get_setting_id(pagefile)
|
223
|
-
split_path = pagefile.split(
|
223
|
+
split_path = pagefile.split("\\")
|
224
224
|
"#{split_path[1]} @ #{split_path[0]}"
|
225
225
|
end
|
226
226
|
|
@@ -72,7 +72,7 @@ class Chef
|
|
72
72
|
env "path" do
|
73
73
|
action :modify
|
74
74
|
delim ::File::PATH_SEPARATOR
|
75
|
-
value path.tr("/",
|
75
|
+
value path.tr("/", "\\")
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
@@ -84,7 +84,7 @@ class Chef
|
|
84
84
|
env "path" do
|
85
85
|
action :delete
|
86
86
|
delim ::File::PATH_SEPARATOR
|
87
|
-
value path.tr("/",
|
87
|
+
value path.tr("/", "\\")
|
88
88
|
end
|
89
89
|
end
|
90
90
|
end
|
@@ -28,6 +28,7 @@ class Chef
|
|
28
28
|
|
29
29
|
# The valid policy_names options found here
|
30
30
|
# https://github.com/ChrisAWalker/cSecurityOptions under 'AccountSettings'
|
31
|
+
# This needs to be revisited - the list at the link above is non-exhaustive and is missing a couple of items
|
31
32
|
policy_names = %w{LockoutDuration
|
32
33
|
MaximumPasswordAge
|
33
34
|
MinimumPasswordAge
|
@@ -36,6 +37,8 @@ class Chef
|
|
36
37
|
PasswordHistorySize
|
37
38
|
LockoutBadCount
|
38
39
|
ResetLockoutCount
|
40
|
+
AuditPolicyChange
|
41
|
+
LockoutDuration
|
39
42
|
RequireLogonToChangePassword
|
40
43
|
ForceLogoffWhenHourExpire
|
41
44
|
NewAdministratorName
|
@@ -115,13 +118,13 @@ class Chef
|
|
115
118
|
policy_line = "#{security_option} = \"#{security_value}\""
|
116
119
|
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")
|
117
120
|
file.close
|
118
|
-
file_path = file.path.tr("/",
|
121
|
+
file_path = file.path.tr("/", "\\")
|
119
122
|
cmd = "C:\\Windows\\System32\\secedit /configure /db C:\\windows\\security\\new.sdb /cfg #{file_path} /areas SECURITYPOLICY"
|
120
123
|
else
|
121
124
|
policy_line = "#{security_option} = #{security_value}"
|
122
125
|
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")
|
123
126
|
file.close
|
124
|
-
file_path = file.path.tr("/",
|
127
|
+
file_path = file.path.tr("/", "\\")
|
125
128
|
cmd = "C:\\Windows\\System32\\secedit /configure /db C:\\windows\\security\\new.sdb /cfg #{file_path} /areas SECURITYPOLICY"
|
126
129
|
end
|
127
130
|
shell_out!(cmd)
|
@@ -549,7 +549,7 @@ class Chef
|
|
549
549
|
if @current_resource.exists
|
550
550
|
task.get_task(new_resource.task_name)
|
551
551
|
@current_resource.task = task
|
552
|
-
pathed_task_name = new_resource.task_name.start_with?(
|
552
|
+
pathed_task_name = new_resource.task_name.start_with?("\\") ? new_resource.task_name : "\\#{new_resource.task_name}"
|
553
553
|
@current_resource.task_name(pathed_task_name)
|
554
554
|
end
|
555
555
|
@current_resource
|
@@ -29,9 +29,10 @@ class Chef
|
|
29
29
|
attr_reader :recipe_name
|
30
30
|
attr_reader :enclosing_provider
|
31
31
|
attr_reader :resource
|
32
|
+
attr_reader :new_resource
|
32
33
|
|
33
34
|
# FIXME (ruby-2.1 syntax): most of these are mandatory
|
34
|
-
def initialize(type: nil, name: nil, created_at: nil, params: nil, run_context: nil, cookbook_name: nil, recipe_name: nil, enclosing_provider: nil)
|
35
|
+
def initialize(type: nil, name: nil, created_at: nil, params: nil, run_context: nil, cookbook_name: nil, recipe_name: nil, enclosing_provider: nil, new_resource: nil)
|
35
36
|
@type = type
|
36
37
|
@name = name
|
37
38
|
@created_at = created_at
|
@@ -40,6 +41,7 @@ class Chef
|
|
40
41
|
@cookbook_name = cookbook_name
|
41
42
|
@recipe_name = recipe_name
|
42
43
|
@enclosing_provider = enclosing_provider
|
44
|
+
@new_resource = new_resource
|
43
45
|
end
|
44
46
|
|
45
47
|
def build(&block)
|
@@ -64,7 +66,11 @@ class Chef
|
|
64
66
|
if block_given?
|
65
67
|
resource.resource_initializing = true
|
66
68
|
begin
|
67
|
-
|
69
|
+
if new_resource.nil?
|
70
|
+
resource.instance_exec(&block)
|
71
|
+
else
|
72
|
+
resource.instance_exec(new_resource, &block)
|
73
|
+
end
|
68
74
|
ensure
|
69
75
|
resource.resource_initializing = false
|
70
76
|
end
|
data/lib/chef/resources.rb
CHANGED
@@ -65,6 +65,7 @@ require_relative "resource/homebrew_package"
|
|
65
65
|
require_relative "resource/homebrew_tap"
|
66
66
|
require_relative "resource/homebrew_update"
|
67
67
|
require_relative "resource/ifconfig"
|
68
|
+
require_relative "resource/inspec_waiver_file_entry"
|
68
69
|
require_relative "resource/kernel_module"
|
69
70
|
require_relative "resource/ksh"
|
70
71
|
require_relative "resource/launchd"
|
data/lib/chef/run_lock.rb
CHANGED
@@ -173,7 +173,7 @@ class Chef
|
|
173
173
|
# Mutex name is case-sensitive contrary to other things in
|
174
174
|
# windows. "\" is the only invalid character.
|
175
175
|
def acquire_win32_mutex
|
176
|
-
@mutex = Chef::ReservedNames::Win32::Mutex.new("Global\\#{runlock_file.tr(
|
176
|
+
@mutex = Chef::ReservedNames::Win32::Mutex.new("Global\\#{runlock_file.tr("\\", "/").downcase}")
|
177
177
|
mutex.test
|
178
178
|
end
|
179
179
|
|
data/lib/chef/runner.rb
CHANGED
data/lib/chef/shell/ext.rb
CHANGED
@@ -198,9 +198,9 @@ module Shell
|
|
198
198
|
prints a detailed explanation of the command if available, or the
|
199
199
|
description if no explanation is available.
|
200
200
|
E
|
201
|
-
def help(
|
202
|
-
if
|
203
|
-
explain_command(
|
201
|
+
def help(command = nil)
|
202
|
+
if command
|
203
|
+
explain_command(command)
|
204
204
|
else
|
205
205
|
puts help_banner
|
206
206
|
end
|
data/lib/chef/version.rb
CHANGED
data/lib/chef/win32/api.rb
CHANGED
@@ -43,6 +43,8 @@ class Chef
|
|
43
43
|
|
44
44
|
host.ffi_convention :stdcall
|
45
45
|
|
46
|
+
win64 = ENV["PROCESSOR_ARCHITECTURE"] == "AMD64"
|
47
|
+
|
46
48
|
# Windows-specific type defs (ms-help://MS.MSDNQTR.v90.en/winprog/winprog/windows_data_types.htm):
|
47
49
|
host.typedef :ushort, :ATOM # Atom ~= Symbol: Atom table stores strings and corresponding identifiers. Application
|
48
50
|
# places a string in an atom table and receives a 16-bit integer, called an atom, that
|
@@ -120,10 +122,15 @@ class Chef
|
|
120
122
|
host.typedef :int32, :LONG32 # 32-bit signed integer. The range is -2,147,483,648 through +...647 decimal.
|
121
123
|
host.typedef :int64, :LONG64 # 64-bit signed integer. The range is –9,223,372,036,854,775,808 through +...807
|
122
124
|
host.typedef :int64, :LONGLONG # 64-bit signed integer. The range is –9,223,372,036,854,775,808 through +...807
|
123
|
-
host.typedef :long, :LONG_PTR # Signed long type for pointer precision. Use when casting a pointer to a long to
|
124
125
|
# perform pointer arithmetic. BaseTsd.h:
|
125
126
|
# if defined(_WIN64) host.typedef __int64 LONG_PTR; #else host.typedef long LONG_PTR;
|
126
|
-
|
127
|
+
if win64
|
128
|
+
host.typedef :int64, :LONG_PTR # Signed long type for pointer precision. Use when casting a pointer to a long to
|
129
|
+
host.typedef :int64, :LPARAM # Message parameter. WinDef.h as follows: #host.typedef LONG_PTR LPARAM;
|
130
|
+
else
|
131
|
+
host.typedef :long, :LONG_PTR # Signed long type for pointer precision. Use when casting a pointer to a long to
|
132
|
+
host.typedef :long, :LPARAM # Message parameter. WinDef.h as follows: #host.typedef LONG_PTR LPARAM;
|
133
|
+
end
|
127
134
|
host.typedef :pointer, :LPBOOL # Pointer to a BOOL. WinDef.h as follows: #host.typedef BOOL far *LPBOOL;
|
128
135
|
host.typedef :pointer, :LPBYTE # Pointer to a BYTE. WinDef.h as follows: #host.typedef BYTE far *LPBYTE;
|
129
136
|
host.typedef :pointer, :LPCOLORREF # Pointer to a COLORREF value. WinDef.h as follows: #host.typedef DWORD *LPCOLORREF;
|
File without changes
|
File without changes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module KnifeSpecs
|
2
|
+
class TestYourself < Chef::Knife
|
3
|
+
|
4
|
+
class << self
|
5
|
+
attr_reader :test_deps_loaded
|
6
|
+
end
|
7
|
+
|
8
|
+
deps do
|
9
|
+
@test_deps_loaded = true
|
10
|
+
end
|
11
|
+
|
12
|
+
option :scro, :short => '-s SCRO', :long => '--scro SCRO', :description => 'a configurable setting'
|
13
|
+
|
14
|
+
attr_reader :ran
|
15
|
+
|
16
|
+
def run
|
17
|
+
@ran = true
|
18
|
+
self # return self so tests can poke at me
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -18,12 +18,10 @@
|
|
18
18
|
require "spec_helper"
|
19
19
|
require "chef/mixin/shell_out"
|
20
20
|
|
21
|
-
#
|
22
|
-
|
23
|
-
# are consistently timing out in BuildKite. Once we've addressed this (see issue chef/11414)
|
24
|
-
# we will re-add the platform.
|
25
|
-
exclude_test = !(%w{rhel amazon}.include?(ohai[:platform_family]) && File.exist?("/usr/bin/dnf"))
|
21
|
+
# test on any fedora-ish platform with dnf
|
22
|
+
exclude_test = !(%w{rhel amazon fedora}.include?(OHAI_SYSTEM[:platform_family]) && File.exist?("/usr/bin/dnf"))
|
26
23
|
describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
24
|
+
include RecipeDSLHelper
|
27
25
|
include Chef::Mixin::ShellOut
|
28
26
|
|
29
27
|
# NOTE: every single test here either needs to explicitly call flush_cache or needs to explicitly
|
@@ -33,7 +31,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
33
31
|
def flush_cache
|
34
32
|
# needed on at least fc23/fc24 sometimes to deal with the dnf cache getting out of sync with the rpm db
|
35
33
|
FileUtils.rm_f "/var/cache/dnf/@System.solv"
|
36
|
-
Chef::
|
34
|
+
Chef::Provider::Package::Dnf::PythonHelper.instance.reap
|
37
35
|
end
|
38
36
|
|
39
37
|
def preinstall(*rpms)
|
@@ -43,11 +41,17 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
43
41
|
flush_cache
|
44
42
|
end
|
45
43
|
|
44
|
+
def expect_matching_installed_version(version)
|
45
|
+
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(version)
|
46
|
+
end
|
47
|
+
|
46
48
|
before(:all) do
|
47
49
|
shell_out!("dnf -y install dnf-plugins-core")
|
48
50
|
end
|
49
51
|
|
50
52
|
before(:each) do
|
53
|
+
# force errors to fail and not retry
|
54
|
+
ENV["DNF_HELPER_NO_RETRIES"] = "true"
|
51
55
|
File.open("/etc/yum.repos.d/chef-dnf-localtesting.repo", "w+") do |f|
|
52
56
|
f.write <<~EOF
|
53
57
|
[chef-dnf-localtesting]
|
@@ -57,6 +61,7 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
57
61
|
gpgcheck=0
|
58
62
|
EOF
|
59
63
|
end
|
64
|
+
# ensure we don't have any stray chef_rpms installed
|
60
65
|
shell_out!("rpm -qa --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' | grep chef_rpm | xargs -r rpm -e")
|
61
66
|
# next line is useful cleanup if you happen to have been testing both yum + dnf func tests on the same box and
|
62
67
|
# have some yum garbage left around
|
@@ -68,64 +73,71 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
68
73
|
FileUtils.rm_f "/etc/yum.repos.d/chef-dnf-localtesting.repo"
|
69
74
|
end
|
70
75
|
|
71
|
-
let(:
|
72
|
-
Chef::RunContext.new(Chef::Node.new, {}, Chef::EventDispatch::Dispatcher.new)
|
73
|
-
end
|
74
|
-
|
75
|
-
let(:package_name) { "chef_rpm" }
|
76
|
-
let(:dnf_package) { Chef::Resource::DnfPackage.new(package_name, run_context) }
|
76
|
+
let(:default_options) { "--nogpgcheck --disablerepo=* --enablerepo=chef-dnf-localtesting" }
|
77
77
|
|
78
78
|
def pkg_arch
|
79
|
-
|
79
|
+
OHAI_SYSTEM[:kernel][:machine]
|
80
80
|
end
|
81
81
|
|
82
82
|
describe ":install" do
|
83
83
|
context "vanilla use case" do
|
84
|
-
let(:package_name) { "chef_rpm" }
|
85
|
-
|
86
84
|
it "installs if the package is not installed" do
|
87
85
|
flush_cache
|
88
|
-
dnf_package
|
89
|
-
|
86
|
+
dnf_package "chef_rpm" do
|
87
|
+
options default_options
|
88
|
+
action :install
|
89
|
+
end.should_be_updated
|
90
90
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
91
91
|
end
|
92
92
|
|
93
93
|
it "does not install if the package is installed" do
|
94
94
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
95
|
-
dnf_package
|
96
|
-
|
95
|
+
dnf_package "chef_rpm" do
|
96
|
+
options default_options
|
97
|
+
action :install
|
98
|
+
end.should_not_be_updated
|
97
99
|
end
|
98
100
|
|
99
101
|
it "does not install twice" do
|
100
102
|
flush_cache
|
101
|
-
dnf_package
|
102
|
-
|
103
|
+
dnf_package "chef_rpm" do
|
104
|
+
options default_options
|
105
|
+
action :install
|
106
|
+
end.should_be_updated
|
103
107
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
104
|
-
dnf_package
|
105
|
-
|
108
|
+
dnf_package "chef_rpm" do
|
109
|
+
options default_options
|
110
|
+
action :install
|
111
|
+
end.should_not_be_updated
|
106
112
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
107
113
|
end
|
108
114
|
|
109
115
|
it "does not install if the prior version package is installed" do
|
110
116
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
111
|
-
dnf_package
|
112
|
-
|
117
|
+
dnf_package "chef_rpm" do
|
118
|
+
options default_options
|
119
|
+
action :install
|
120
|
+
end.should_not_be_updated
|
113
121
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
114
122
|
end
|
115
123
|
|
116
124
|
it "does not install if the i686 package is installed", :intel_64bit do
|
117
125
|
skip "FIXME: do nothing, or install the #{pkg_arch} version?"
|
118
126
|
preinstall("chef_rpm-1.10-1.i686.rpm")
|
119
|
-
dnf_package
|
120
|
-
|
127
|
+
dnf_package "chef_rpm" do
|
128
|
+
options default_options
|
129
|
+
action :install
|
130
|
+
end.should_not_be_updated
|
121
131
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.i686$")
|
122
132
|
end
|
123
133
|
|
124
134
|
it "does not install if the prior version i686 package is installed", :intel_64bit do
|
125
135
|
skip "FIXME: do nothing, or install the #{pkg_arch} version?"
|
126
136
|
preinstall("chef_rpm-1.2-1.i686.rpm")
|
127
|
-
dnf_package
|
128
|
-
|
137
|
+
dnf_package "chef_rpm" do
|
138
|
+
options default_options
|
139
|
+
action :install
|
140
|
+
end.should_not_be_updated
|
129
141
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.i686$")
|
130
142
|
end
|
131
143
|
end
|
@@ -134,72 +146,81 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
134
146
|
%w{1.10 1* 1.10-1 1*-1 1.10-* 1*-* 0:1.10 0:1* 0:1.10-1 0:1*-1 *:1.10-* *:1*-*}.each do |vstring|
|
135
147
|
it "installs the rpm when #{vstring} is in the package_name" do
|
136
148
|
flush_cache
|
137
|
-
dnf_package
|
138
|
-
|
139
|
-
|
149
|
+
dnf_package "chef_rpm-#{vstring}" do
|
150
|
+
options default_options
|
151
|
+
action :install
|
152
|
+
end.should_be_updated
|
140
153
|
end
|
141
154
|
|
142
155
|
it "is idempotent when #{vstring} is in the package_name" do
|
143
156
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
144
|
-
dnf_package
|
145
|
-
|
146
|
-
|
157
|
+
dnf_package "chef_rpm-#{vstring}" do
|
158
|
+
options default_options
|
159
|
+
action :install
|
160
|
+
end.should_not_be_updated
|
147
161
|
end
|
148
162
|
|
149
163
|
it "installs the rpm when #{vstring} is in the version property" do
|
150
164
|
flush_cache
|
151
|
-
dnf_package
|
152
|
-
|
153
|
-
|
154
|
-
|
165
|
+
dnf_package "chef_rpm" do
|
166
|
+
options default_options
|
167
|
+
version vstring
|
168
|
+
action :install
|
169
|
+
end.should_be_updated
|
155
170
|
end
|
156
171
|
|
157
172
|
it "is idempotent when #{vstring} is in the version property" do
|
158
173
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
159
|
-
dnf_package
|
160
|
-
|
161
|
-
|
162
|
-
|
174
|
+
dnf_package "chef_rpm" do
|
175
|
+
options default_options
|
176
|
+
version vstring
|
177
|
+
action :install
|
178
|
+
end.should_not_be_updated
|
163
179
|
end
|
164
180
|
|
165
181
|
it "upgrades the rpm when #{vstring} is in the package_name" do
|
166
182
|
flush_cache
|
167
|
-
dnf_package
|
168
|
-
|
169
|
-
|
183
|
+
dnf_package "chef_rpm-#{vstring}" do
|
184
|
+
options default_options
|
185
|
+
action :upgrade
|
186
|
+
end.should_be_updated
|
170
187
|
end
|
171
188
|
|
172
189
|
it "is idempotent when #{vstring} is in the package_name" do
|
173
190
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
174
|
-
dnf_package
|
175
|
-
|
176
|
-
|
191
|
+
dnf_package "chef_rpm-#{vstring}" do
|
192
|
+
options default_options
|
193
|
+
action :upgrade
|
194
|
+
end.should_not_be_updated
|
177
195
|
end
|
178
196
|
|
179
197
|
it "upgrades the rpm when #{vstring} is in the version property" do
|
180
198
|
flush_cache
|
181
|
-
dnf_package
|
182
|
-
|
183
|
-
|
184
|
-
|
199
|
+
dnf_package "chef_rpm" do
|
200
|
+
options default_options
|
201
|
+
version vstring
|
202
|
+
action :upgrade
|
203
|
+
end.should_be_updated
|
185
204
|
end
|
186
205
|
|
187
206
|
it "is idempotent when #{vstring} is in the version property" do
|
188
207
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
189
|
-
dnf_package
|
190
|
-
|
191
|
-
|
192
|
-
|
208
|
+
dnf_package "chef_rpm" do
|
209
|
+
options default_options
|
210
|
+
version vstring
|
211
|
+
action :upgrade
|
212
|
+
end.should_not_be_updated
|
193
213
|
end
|
194
214
|
end
|
195
215
|
|
196
216
|
%w{1.2 1* 1.2-1 1*-1 1.2-* 1*-* 0:1.2 0:1* 0:1.2-1 0:1*-1 *:1.2-* *:1*-*}.each do |vstring|
|
197
217
|
it "is idempotent when #{vstring} is in the version property and there is a candidate version" do
|
198
218
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
199
|
-
dnf_package
|
200
|
-
|
201
|
-
|
202
|
-
|
219
|
+
dnf_package "chef_rpm" do
|
220
|
+
options default_options
|
221
|
+
version vstring
|
222
|
+
action :install
|
223
|
+
end.should_not_be_updated
|
203
224
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
204
225
|
end
|
205
226
|
end
|
@@ -207,10 +228,11 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
207
228
|
%w{1.2 1.2-1 1.2-* 0:1.2 0:1.2-1 *:1.2-*}.each do |vstring|
|
208
229
|
it "is idempotent when #{vstring} is in the version property on upgrade and it doesn't match the candidate version" do
|
209
230
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
210
|
-
dnf_package
|
211
|
-
|
212
|
-
|
213
|
-
|
231
|
+
dnf_package "chef_rpm" do
|
232
|
+
options default_options
|
233
|
+
version vstring
|
234
|
+
action :upgrade
|
235
|
+
end.should_not_be_updated
|
214
236
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
215
237
|
end
|
216
238
|
end
|
@@ -218,13 +240,17 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
218
240
|
%w{1* 1*-1 1*-* 0:1* 0:1*-1 *:1*-*}.each do |vstring|
|
219
241
|
it "upgrades when #{vstring} is in the version property on upgrade and it matches the candidate version" do
|
220
242
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
221
|
-
dnf_package
|
222
|
-
|
223
|
-
|
224
|
-
|
243
|
+
dnf_package "chef_rpm" do
|
244
|
+
options default_options
|
245
|
+
version vstring
|
246
|
+
action :upgrade
|
247
|
+
end.should_be_updated
|
225
248
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
226
|
-
dnf_package
|
227
|
-
|
249
|
+
dnf_package "chef_rpm" do
|
250
|
+
options default_options
|
251
|
+
version vstring
|
252
|
+
action :upgrade
|
253
|
+
end.should_not_be_updated
|
228
254
|
end
|
229
255
|
end
|
230
256
|
end
|
@@ -232,82 +258,106 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
232
258
|
context "with versions or globs in the name" do
|
233
259
|
it "works with a version" do
|
234
260
|
flush_cache
|
235
|
-
dnf_package
|
236
|
-
|
237
|
-
|
261
|
+
dnf_package "chef_rpm-1.10" do
|
262
|
+
options default_options
|
263
|
+
action :install
|
264
|
+
end.should_be_updated
|
238
265
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
239
|
-
dnf_package.
|
240
|
-
|
266
|
+
dnf_package "chef_rpm-1.10" do
|
267
|
+
options default_options
|
268
|
+
action :install
|
269
|
+
end.should_not_be_updated
|
241
270
|
end
|
242
271
|
|
243
272
|
it "works with an older version" do
|
244
273
|
flush_cache
|
245
|
-
dnf_package
|
246
|
-
|
247
|
-
|
274
|
+
dnf_package "chef_rpm-1.2" do
|
275
|
+
options default_options
|
276
|
+
action :install
|
277
|
+
end.should_be_updated
|
248
278
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
249
|
-
dnf_package.
|
250
|
-
|
279
|
+
dnf_package "chef_rpm-1.2" do
|
280
|
+
options default_options
|
281
|
+
action :install
|
282
|
+
end.should_not_be_updated
|
251
283
|
end
|
252
284
|
|
253
285
|
it "works with an evra" do
|
254
286
|
flush_cache
|
255
|
-
dnf_package
|
256
|
-
|
257
|
-
|
287
|
+
dnf_package "chef_rpm-0:1.2-1.#{pkg_arch}" do
|
288
|
+
options default_options
|
289
|
+
action :install
|
290
|
+
end.should_be_updated
|
258
291
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
259
|
-
dnf_package.
|
260
|
-
|
292
|
+
dnf_package "chef_rpm-0:1.2-1.#{pkg_arch}" do
|
293
|
+
options default_options
|
294
|
+
action :install
|
295
|
+
end.should_not_be_updated
|
261
296
|
end
|
262
297
|
|
263
298
|
it "works with version and release" do
|
264
299
|
flush_cache
|
265
|
-
dnf_package
|
266
|
-
|
267
|
-
|
300
|
+
dnf_package "chef_rpm-1.2-1" do
|
301
|
+
options default_options
|
302
|
+
action :install
|
303
|
+
end.should_be_updated
|
268
304
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
269
|
-
dnf_package.
|
270
|
-
|
305
|
+
dnf_package "chef_rpm-1.2-1" do
|
306
|
+
options default_options
|
307
|
+
action :install
|
308
|
+
end.should_not_be_updated
|
271
309
|
end
|
272
310
|
|
273
311
|
it "works with a version glob" do
|
274
312
|
flush_cache
|
275
|
-
dnf_package
|
276
|
-
|
277
|
-
|
313
|
+
dnf_package "chef_rpm-1*" do
|
314
|
+
options default_options
|
315
|
+
action :install
|
316
|
+
end.should_be_updated
|
278
317
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
279
|
-
dnf_package
|
280
|
-
|
318
|
+
dnf_package "chef_rpm-1*" do
|
319
|
+
options default_options
|
320
|
+
action :install
|
321
|
+
end.should_not_be_updated
|
281
322
|
end
|
282
323
|
|
283
324
|
it "works with a name glob + version glob" do
|
284
325
|
flush_cache
|
285
|
-
dnf_package
|
286
|
-
|
287
|
-
|
326
|
+
dnf_package "chef_rp*-1*" do
|
327
|
+
options default_options
|
328
|
+
action :install
|
329
|
+
end.should_be_updated
|
288
330
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
289
|
-
dnf_package
|
290
|
-
|
331
|
+
dnf_package "chef_rp*-1*" do
|
332
|
+
options default_options
|
333
|
+
action :install
|
334
|
+
end.should_not_be_updated
|
291
335
|
end
|
292
336
|
|
293
337
|
it "upgrades when the installed version does not match the version string" do
|
294
338
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
295
|
-
dnf_package
|
296
|
-
|
297
|
-
|
339
|
+
dnf_package "chef_rpm-1.10" do
|
340
|
+
options default_options
|
341
|
+
action :install
|
342
|
+
end.should_be_updated
|
298
343
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}")
|
299
|
-
dnf_package.
|
300
|
-
|
344
|
+
dnf_package "chef_rpm-1.10" do
|
345
|
+
options default_options
|
346
|
+
action :install
|
347
|
+
end.should_not_be_updated
|
301
348
|
end
|
302
349
|
|
303
350
|
it "downgrades when the installed version is higher than the package_name version" do
|
304
351
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
305
|
-
dnf_package
|
306
|
-
|
307
|
-
|
352
|
+
dnf_package "chef_rpm-1.2" do
|
353
|
+
options default_options
|
354
|
+
action :install
|
355
|
+
end.should_be_updated
|
308
356
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
309
|
-
dnf_package.
|
310
|
-
|
357
|
+
dnf_package "chef_rpm-1.2" do
|
358
|
+
options default_options
|
359
|
+
action :install
|
360
|
+
end.should_not_be_updated
|
311
361
|
end
|
312
362
|
end
|
313
363
|
|
@@ -315,68 +365,92 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
315
365
|
context "with version property" do
|
316
366
|
it "matches the full version" do
|
317
367
|
flush_cache
|
318
|
-
dnf_package
|
319
|
-
|
320
|
-
|
321
|
-
|
368
|
+
dnf_package "chef_rpm" do
|
369
|
+
options default_options
|
370
|
+
version "1.10"
|
371
|
+
action :install
|
372
|
+
end.should_be_updated
|
322
373
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
323
|
-
dnf_package
|
324
|
-
|
374
|
+
dnf_package "chef_rpm" do
|
375
|
+
options default_options
|
376
|
+
version "1.10"
|
377
|
+
action :install
|
378
|
+
end.should_not_be_updated
|
325
379
|
end
|
326
380
|
|
327
381
|
it "matches with a glob" do
|
328
382
|
flush_cache
|
329
|
-
dnf_package
|
330
|
-
|
331
|
-
|
332
|
-
|
383
|
+
dnf_package "chef_rpm" do
|
384
|
+
options default_options
|
385
|
+
version "1*"
|
386
|
+
action :install
|
387
|
+
end.should_be_updated
|
333
388
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
334
|
-
dnf_package
|
335
|
-
|
389
|
+
dnf_package "chef_rpm" do
|
390
|
+
options default_options
|
391
|
+
version "1*"
|
392
|
+
action :install
|
393
|
+
end.should_not_be_updated
|
336
394
|
end
|
337
395
|
|
338
396
|
it "matches the vr" do
|
339
397
|
flush_cache
|
340
|
-
dnf_package
|
341
|
-
|
342
|
-
|
343
|
-
|
398
|
+
dnf_package "chef_rpm" do
|
399
|
+
options default_options
|
400
|
+
version "1.10-1"
|
401
|
+
action :install
|
402
|
+
end.should_be_updated
|
344
403
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
345
|
-
dnf_package
|
346
|
-
|
404
|
+
dnf_package "chef_rpm" do
|
405
|
+
options default_options
|
406
|
+
version "1.10-1"
|
407
|
+
action :install
|
408
|
+
end.should_not_be_updated
|
347
409
|
end
|
348
410
|
|
349
411
|
it "matches the evr" do
|
350
412
|
flush_cache
|
351
|
-
dnf_package
|
352
|
-
|
353
|
-
|
354
|
-
|
413
|
+
dnf_package "chef_rpm" do
|
414
|
+
options default_options
|
415
|
+
version "0:1.10-1"
|
416
|
+
action :install
|
417
|
+
end.should_be_updated
|
355
418
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
356
|
-
dnf_package
|
357
|
-
|
419
|
+
dnf_package "chef_rpm" do
|
420
|
+
options default_options
|
421
|
+
version "0:1.10-1"
|
422
|
+
action :install
|
423
|
+
end.should_not_be_updated
|
358
424
|
end
|
359
425
|
|
360
426
|
it "matches with a vr glob", :rhel_gte_8 do
|
361
427
|
flush_cache
|
362
|
-
dnf_package
|
363
|
-
|
364
|
-
|
365
|
-
|
428
|
+
dnf_package "chef_rpm" do
|
429
|
+
options default_options
|
430
|
+
version "1.10-1*"
|
431
|
+
action :install
|
432
|
+
end.should_be_updated
|
366
433
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
367
|
-
dnf_package
|
368
|
-
|
434
|
+
dnf_package "chef_rpm" do
|
435
|
+
options default_options
|
436
|
+
version "1.10-1*"
|
437
|
+
action :install
|
438
|
+
end.should_not_be_updated
|
369
439
|
end
|
370
440
|
|
371
441
|
it "matches with an evr glob", :rhel_gte_8 do
|
372
442
|
flush_cache
|
373
|
-
dnf_package
|
374
|
-
|
375
|
-
|
376
|
-
|
443
|
+
dnf_package "chef_rpm" do
|
444
|
+
options default_options
|
445
|
+
version "0:1.10-1*"
|
446
|
+
action :install
|
447
|
+
end.should_be_updated
|
377
448
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
378
|
-
dnf_package
|
379
|
-
|
449
|
+
dnf_package "chef_rpm" do
|
450
|
+
options default_options
|
451
|
+
version "0:1.10-1*"
|
452
|
+
action :install
|
453
|
+
end.should_not_be_updated
|
380
454
|
end
|
381
455
|
end
|
382
456
|
|
@@ -384,274 +458,345 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
384
458
|
it "downgrades the package when allow_downgrade" do
|
385
459
|
flush_cache
|
386
460
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
387
|
-
dnf_package
|
388
|
-
|
389
|
-
|
390
|
-
|
461
|
+
dnf_package "chef_rpm" do
|
462
|
+
options default_options
|
463
|
+
version "1.2-1"
|
464
|
+
action :install
|
465
|
+
end.should_be_updated
|
391
466
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
392
|
-
dnf_package
|
393
|
-
|
467
|
+
dnf_package "chef_rpm" do
|
468
|
+
options default_options
|
469
|
+
version "1.2-1"
|
470
|
+
action :install
|
471
|
+
end.should_not_be_updated
|
394
472
|
end
|
395
473
|
end
|
396
474
|
|
397
475
|
context "with arches", :intel_64bit do
|
398
476
|
it "installs with 64-bit arch in the name" do
|
399
477
|
flush_cache
|
400
|
-
dnf_package
|
401
|
-
|
402
|
-
|
478
|
+
dnf_package "chef_rpm.#{pkg_arch}" do
|
479
|
+
options default_options
|
480
|
+
action :install
|
481
|
+
end.should_be_updated
|
403
482
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
404
|
-
dnf_package
|
405
|
-
|
483
|
+
dnf_package "chef_rpm.#{pkg_arch}" do
|
484
|
+
options default_options
|
485
|
+
action :install
|
486
|
+
end.should_not_be_updated
|
406
487
|
end
|
407
488
|
|
408
489
|
it "installs with 32-bit arch in the name" do
|
409
490
|
flush_cache
|
410
|
-
dnf_package
|
411
|
-
|
412
|
-
|
491
|
+
dnf_package "chef_rpm.i686" do
|
492
|
+
options default_options
|
493
|
+
action :install
|
494
|
+
end.should_be_updated
|
413
495
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.i686$")
|
414
|
-
dnf_package.
|
415
|
-
|
496
|
+
dnf_package "chef_rpm.i686" do
|
497
|
+
options default_options
|
498
|
+
action :install
|
499
|
+
end.should_not_be_updated
|
416
500
|
end
|
417
501
|
|
418
502
|
it "installs with 64-bit arch in the property" do
|
419
503
|
flush_cache
|
420
|
-
dnf_package
|
421
|
-
|
422
|
-
|
423
|
-
|
504
|
+
dnf_package "chef_rpm" do
|
505
|
+
options default_options
|
506
|
+
arch pkg_arch
|
507
|
+
action :install
|
508
|
+
end.should_be_updated
|
424
509
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
425
|
-
dnf_package
|
426
|
-
|
510
|
+
dnf_package "chef_rpm" do
|
511
|
+
options default_options
|
512
|
+
arch pkg_arch
|
513
|
+
action :install
|
514
|
+
end.should_not_be_updated
|
427
515
|
end
|
428
516
|
|
429
517
|
it "installs with 32-bit arch in the property" do
|
430
518
|
flush_cache
|
431
|
-
dnf_package
|
432
|
-
|
433
|
-
|
434
|
-
|
519
|
+
dnf_package "chef_rpm" do
|
520
|
+
options default_options
|
521
|
+
arch "i686"
|
522
|
+
action :install
|
523
|
+
end.should_be_updated
|
435
524
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.i686$")
|
436
|
-
dnf_package
|
437
|
-
|
525
|
+
dnf_package "chef_rpm" do
|
526
|
+
options default_options
|
527
|
+
arch "i686"
|
528
|
+
action :install
|
529
|
+
end.should_not_be_updated
|
438
530
|
end
|
439
531
|
|
440
532
|
it "installs when the 32-bit arch is in the name and the version is in the property" do
|
441
533
|
flush_cache
|
442
|
-
dnf_package
|
443
|
-
|
444
|
-
|
445
|
-
|
534
|
+
dnf_package "chef_rpm.i686" do
|
535
|
+
options default_options
|
536
|
+
version "1.10-1"
|
537
|
+
action :install
|
538
|
+
end.should_be_updated
|
446
539
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.i686$")
|
447
|
-
dnf_package.
|
448
|
-
|
540
|
+
dnf_package "chef_rpm.i686" do
|
541
|
+
options default_options
|
542
|
+
version "1.10-1"
|
543
|
+
action :install
|
544
|
+
end.should_not_be_updated
|
449
545
|
end
|
450
546
|
|
451
547
|
it "installs when the 64-bit arch is in the name and the version is in the property" do
|
452
548
|
flush_cache
|
453
|
-
dnf_package
|
454
|
-
|
455
|
-
|
456
|
-
|
549
|
+
dnf_package "chef_rpm.#{pkg_arch}" do
|
550
|
+
options default_options
|
551
|
+
version "1.10-1"
|
552
|
+
action :install
|
553
|
+
end.should_be_updated
|
457
554
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
458
|
-
dnf_package
|
459
|
-
|
555
|
+
dnf_package "chef_rpm.#{pkg_arch}" do
|
556
|
+
options default_options
|
557
|
+
version "1.10-1"
|
558
|
+
action :install
|
559
|
+
end.should_not_be_updated
|
460
560
|
end
|
461
561
|
end
|
462
562
|
|
463
563
|
context "with constraints" do
|
464
564
|
it "with nothing installed, it installs the latest version" do
|
465
565
|
flush_cache
|
466
|
-
dnf_package
|
467
|
-
|
468
|
-
|
566
|
+
dnf_package "chef_rpm >= 1.2" do
|
567
|
+
options default_options
|
568
|
+
action :install
|
569
|
+
end.should_be_updated
|
469
570
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
470
|
-
dnf_package.
|
471
|
-
|
571
|
+
dnf_package "chef_rpm >= 1.2" do
|
572
|
+
options default_options
|
573
|
+
action :install
|
574
|
+
end.should_not_be_updated
|
472
575
|
end
|
473
576
|
|
474
577
|
it "when it is met, it does nothing" do
|
475
578
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
476
|
-
dnf_package
|
477
|
-
|
478
|
-
|
579
|
+
dnf_package "chef_rpm >= 1.2" do
|
580
|
+
options default_options
|
581
|
+
action :install
|
582
|
+
end.should_not_be_updated
|
479
583
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
480
584
|
end
|
481
585
|
|
482
586
|
it "when it is met, it does nothing" do
|
483
587
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
484
|
-
dnf_package
|
485
|
-
|
486
|
-
|
588
|
+
dnf_package "chef_rpm >= 1.2" do
|
589
|
+
options default_options
|
590
|
+
action :install
|
591
|
+
end.should_not_be_updated
|
487
592
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
488
593
|
end
|
489
594
|
|
490
595
|
it "with nothing installed, it installs the latest version" do
|
491
596
|
flush_cache
|
492
|
-
dnf_package
|
493
|
-
|
494
|
-
|
597
|
+
dnf_package "chef_rpm > 1.2" do
|
598
|
+
options default_options
|
599
|
+
action :install
|
600
|
+
end.should_be_updated
|
495
601
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
496
|
-
dnf_package.
|
497
|
-
|
602
|
+
dnf_package "chef_rpm > 1.2" do
|
603
|
+
options default_options
|
604
|
+
action :install
|
605
|
+
end.should_not_be_updated
|
498
606
|
end
|
499
607
|
|
500
608
|
it "when it is not met by an installed rpm, it upgrades" do
|
501
609
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
502
|
-
dnf_package
|
503
|
-
|
504
|
-
|
610
|
+
dnf_package "chef_rpm > 1.2" do
|
611
|
+
options default_options
|
612
|
+
action :install
|
613
|
+
end.should_be_updated
|
505
614
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
506
|
-
dnf_package.
|
507
|
-
|
615
|
+
dnf_package "chef_rpm > 1.2" do
|
616
|
+
options default_options
|
617
|
+
action :install
|
618
|
+
end.should_not_be_updated
|
508
619
|
end
|
509
620
|
|
510
621
|
it "with an equality constraint, when it is not met by an installed rpm, it upgrades" do
|
511
622
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
512
|
-
dnf_package
|
513
|
-
|
514
|
-
|
623
|
+
dnf_package "chef_rpm = 1.10" do
|
624
|
+
options default_options
|
625
|
+
action :install
|
626
|
+
end.should_be_updated
|
515
627
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
516
|
-
dnf_package.
|
517
|
-
|
628
|
+
dnf_package "chef_rpm = 1.10" do
|
629
|
+
options default_options
|
630
|
+
action :install
|
631
|
+
end.should_not_be_updated
|
518
632
|
end
|
519
633
|
|
520
634
|
it "with an equality constraint, when it is met by an installed rpm, it does nothing" do
|
521
635
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
522
|
-
dnf_package
|
523
|
-
|
524
|
-
|
636
|
+
dnf_package "chef_rpm = 1.2" do
|
637
|
+
options default_options
|
638
|
+
action :install
|
639
|
+
end.should_not_be_updated
|
525
640
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
526
641
|
end
|
527
642
|
|
528
643
|
it "when it is met by an installed rpm, it does nothing" do
|
529
644
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
530
|
-
dnf_package
|
531
|
-
|
532
|
-
|
645
|
+
dnf_package "chef_rpm > 1.2" do
|
646
|
+
options default_options
|
647
|
+
action :install
|
648
|
+
end.should_not_be_updated
|
533
649
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
534
650
|
end
|
535
651
|
|
536
652
|
it "when there is no solution to the contraint" do
|
537
653
|
flush_cache
|
538
|
-
|
539
|
-
|
654
|
+
expect {
|
655
|
+
dnf_package "chef_rpm > 2.0"
|
656
|
+
}.to raise_error(Chef::Exceptions::Package, /No candidate version available/)
|
540
657
|
end
|
541
658
|
|
542
659
|
it "when there is no solution to the contraint but an rpm is preinstalled" do
|
543
660
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
544
|
-
|
545
|
-
|
661
|
+
expect {
|
662
|
+
dnf_package "chef_rpm > 2.0"
|
663
|
+
}.to raise_error(Chef::Exceptions::Package, /No candidate version available/)
|
546
664
|
end
|
547
665
|
|
548
666
|
it "with a less than constraint, when nothing is installed, it installs" do
|
549
667
|
flush_cache
|
550
|
-
dnf_package
|
551
|
-
|
552
|
-
|
668
|
+
dnf_package "chef_rpm < 1.10" do
|
669
|
+
options default_options
|
670
|
+
action :install
|
671
|
+
end.should_be_updated
|
553
672
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
554
|
-
dnf_package.
|
555
|
-
|
673
|
+
dnf_package "chef_rpm < 1.10" do
|
674
|
+
options default_options
|
675
|
+
action :install
|
676
|
+
end.should_not_be_updated
|
556
677
|
end
|
557
678
|
|
558
679
|
it "with a less than constraint, when the install version matches, it does nothing" do
|
559
680
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
560
|
-
dnf_package
|
561
|
-
|
562
|
-
|
681
|
+
dnf_package "chef_rpm < 1.10" do
|
682
|
+
options default_options
|
683
|
+
action :install
|
684
|
+
end.should_not_be_updated
|
563
685
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
564
686
|
end
|
565
687
|
|
566
688
|
it "with a less than constraint, when the install version fails, it should downgrade" do
|
567
689
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
568
|
-
dnf_package
|
569
|
-
|
570
|
-
|
690
|
+
dnf_package "chef_rpm < 1.10" do
|
691
|
+
options default_options
|
692
|
+
action :install
|
693
|
+
end.should_be_updated
|
571
694
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
572
|
-
dnf_package.
|
573
|
-
|
695
|
+
dnf_package "chef_rpm < 1.10" do
|
696
|
+
options default_options
|
697
|
+
action :install
|
698
|
+
end.should_not_be_updated
|
574
699
|
end
|
575
700
|
end
|
576
701
|
|
577
702
|
context "with source arguments" do
|
578
703
|
it "raises an exception when the package does not exist" do
|
579
704
|
flush_cache
|
580
|
-
|
581
|
-
|
705
|
+
expect {
|
706
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/this-file-better-not-exist.rpm"
|
707
|
+
}.to raise_error(Chef::Exceptions::Package, /No candidate version available/)
|
582
708
|
end
|
583
709
|
|
584
710
|
it "does not raise a hard exception in why-run mode when the package does not exist" do
|
585
711
|
Chef::Config[:why_run] = true
|
586
712
|
flush_cache
|
587
|
-
dnf_package
|
588
|
-
|
589
|
-
|
713
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/this-file-better-not-exist.rpm" do
|
714
|
+
options default_options
|
715
|
+
action :install
|
716
|
+
end
|
590
717
|
end
|
591
718
|
|
592
719
|
it "installs the package when using the source argument" do
|
593
720
|
flush_cache
|
594
|
-
dnf_package
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
721
|
+
dnf_package "something" do
|
722
|
+
source("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
723
|
+
options default_options
|
724
|
+
package_name "somethingelse"
|
725
|
+
name "something"
|
726
|
+
action :install
|
727
|
+
end.should_be_updated
|
599
728
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
600
|
-
dnf_package
|
601
|
-
|
729
|
+
dnf_package "something" do
|
730
|
+
source("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
731
|
+
options default_options
|
732
|
+
package_name "somethingelse"
|
733
|
+
name "something"
|
734
|
+
action :install
|
735
|
+
end.should_not_be_updated
|
602
736
|
end
|
603
737
|
|
604
738
|
it "installs the package when the name is a path to a file" do
|
605
739
|
flush_cache
|
606
|
-
dnf_package
|
607
|
-
|
608
|
-
|
740
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
741
|
+
options default_options
|
742
|
+
action :install
|
743
|
+
end.should_be_updated
|
609
744
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
610
|
-
dnf_package.
|
611
|
-
|
745
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
746
|
+
options default_options
|
747
|
+
action :install
|
748
|
+
end.should_not_be_updated
|
612
749
|
end
|
613
750
|
|
614
751
|
it "downgrade on a local file with allow_downgrade true works" do
|
615
752
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
616
|
-
dnf_package
|
617
|
-
|
618
|
-
|
619
|
-
|
753
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
754
|
+
options default_options
|
755
|
+
version "1.2-1"
|
756
|
+
action :install
|
757
|
+
end.should_be_updated
|
620
758
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
621
|
-
dnf_package.
|
622
|
-
|
759
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
760
|
+
options default_options
|
761
|
+
version "1.2-1"
|
762
|
+
action :install
|
763
|
+
end.should_not_be_updated
|
623
764
|
end
|
624
765
|
|
625
766
|
it "does not downgrade the package with :install" do
|
626
767
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
627
|
-
dnf_package
|
628
|
-
|
629
|
-
|
768
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
769
|
+
options default_options
|
770
|
+
action :install
|
771
|
+
end.should_not_be_updated
|
630
772
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
631
773
|
end
|
632
774
|
|
633
775
|
it "does not upgrade the package with :install" do
|
634
776
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
635
|
-
dnf_package
|
636
|
-
|
637
|
-
|
777
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.10-1.#{pkg_arch}.rpm" do
|
778
|
+
options default_options
|
779
|
+
action :install
|
780
|
+
end.should_not_be_updated
|
638
781
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
639
782
|
end
|
640
783
|
|
641
784
|
it "is idempotent when the package is already installed" do
|
642
785
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
643
|
-
dnf_package
|
644
|
-
|
645
|
-
|
786
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
787
|
+
options default_options
|
788
|
+
action :install
|
789
|
+
end.should_not_be_updated
|
646
790
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
647
791
|
end
|
648
792
|
|
649
793
|
it "is idempotent when the package is already installed and there is a version string" do
|
650
794
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
651
|
-
dnf_package
|
652
|
-
|
653
|
-
|
654
|
-
|
795
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
796
|
+
options default_options
|
797
|
+
version "1.2-1"
|
798
|
+
action :install
|
799
|
+
end.should_not_be_updated
|
655
800
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
656
801
|
end
|
657
802
|
end
|
@@ -660,142 +805,183 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
660
805
|
it "works when a package is installed" do
|
661
806
|
FileUtils.rm_f "/etc/yum.repos.d/chef-dnf-localtesting.repo"
|
662
807
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
663
|
-
dnf_package
|
664
|
-
|
808
|
+
dnf_package "chef_rpm" do
|
809
|
+
options "--nogpgcheck --disablerepo=*"
|
810
|
+
action :install
|
811
|
+
end.should_not_be_updated
|
665
812
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
666
813
|
end
|
667
814
|
|
668
815
|
it "works with a local source" do
|
669
816
|
FileUtils.rm_f "/etc/yum.repos.d/chef-dnf-localtesting.repo"
|
670
817
|
flush_cache
|
671
|
-
dnf_package
|
672
|
-
|
673
|
-
|
818
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
819
|
+
options "--nogpgcheck --disablerepo=*"
|
820
|
+
action :install
|
821
|
+
end.should_be_updated
|
674
822
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
675
|
-
dnf_package.
|
676
|
-
|
823
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
824
|
+
options "--nogpgcheck --disablerepo=*"
|
825
|
+
action :install
|
826
|
+
end.should_not_be_updated
|
677
827
|
end
|
678
828
|
end
|
679
829
|
|
680
830
|
context "multipackage with arches", :intel_64bit do
|
681
831
|
it "installs two rpms" do
|
682
832
|
flush_cache
|
683
|
-
dnf_package
|
684
|
-
|
685
|
-
|
833
|
+
dnf_package [ "chef_rpm.#{pkg_arch}", "chef_rpm.i686" ] do
|
834
|
+
options default_options
|
835
|
+
action :install
|
836
|
+
end.should_be_updated
|
686
837
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.#{pkg_arch}$/)
|
687
838
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.i686$/)
|
688
|
-
dnf_package.
|
689
|
-
|
839
|
+
dnf_package [ "chef_rpm.#{pkg_arch}", "chef_rpm.i686" ] do
|
840
|
+
options default_options
|
841
|
+
action :install
|
842
|
+
end.should_not_be_updated
|
690
843
|
end
|
691
844
|
|
692
845
|
it "does nothing if both are installed" do
|
693
846
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm", "chef_rpm-1.10-1.i686.rpm")
|
694
847
|
flush_cache
|
695
|
-
dnf_package
|
696
|
-
|
697
|
-
|
848
|
+
dnf_package [ "chef_rpm.#{pkg_arch}", "chef_rpm.i686" ] do
|
849
|
+
options default_options
|
850
|
+
action :install
|
851
|
+
end.should_not_be_updated
|
698
852
|
end
|
699
853
|
|
700
854
|
it "installs the second rpm if the first is installed" do
|
701
855
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
702
|
-
dnf_package
|
703
|
-
|
704
|
-
|
856
|
+
dnf_package [ "chef_rpm.#{pkg_arch}", "chef_rpm.i686" ] do
|
857
|
+
options default_options
|
858
|
+
action :install
|
859
|
+
end.should_be_updated
|
705
860
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.#{pkg_arch}$/)
|
706
861
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.i686$/)
|
707
|
-
dnf_package.
|
708
|
-
|
862
|
+
dnf_package [ "chef_rpm.#{pkg_arch}", "chef_rpm.i686" ] do
|
863
|
+
options default_options
|
864
|
+
action :install
|
865
|
+
end.should_not_be_updated
|
709
866
|
end
|
710
867
|
|
711
868
|
it "installs the first rpm if the second is installed" do
|
712
869
|
preinstall("chef_rpm-1.10-1.i686.rpm")
|
713
|
-
dnf_package
|
714
|
-
|
715
|
-
|
870
|
+
dnf_package [ "chef_rpm.#{pkg_arch}", "chef_rpm.i686" ] do
|
871
|
+
options default_options
|
872
|
+
action :install
|
873
|
+
end.should_be_updated
|
716
874
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.#{pkg_arch}$/)
|
717
875
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.i686$/)
|
718
|
-
dnf_package.
|
719
|
-
|
876
|
+
dnf_package [ "chef_rpm.#{pkg_arch}", "chef_rpm.i686" ] do
|
877
|
+
options default_options
|
878
|
+
action :install
|
879
|
+
end.should_not_be_updated
|
720
880
|
end
|
721
881
|
|
722
882
|
# unlikely to work consistently correct, okay to deprecate the arch-array in favor of the arch in the name
|
723
883
|
it "installs two rpms with multi-arch" do
|
724
884
|
flush_cache
|
725
|
-
dnf_package
|
726
|
-
|
727
|
-
|
728
|
-
|
885
|
+
dnf_package %w{chef_rpm chef_rpm} do
|
886
|
+
options default_options
|
887
|
+
arch [pkg_arch, "i686"]
|
888
|
+
action :install
|
889
|
+
end.should_be_updated
|
729
890
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.#{pkg_arch}$/)
|
730
891
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.i686$/)
|
731
|
-
dnf_package
|
732
|
-
|
892
|
+
dnf_package %w{chef_rpm chef_rpm} do
|
893
|
+
options default_options
|
894
|
+
arch [pkg_arch, "i686"]
|
895
|
+
action :install
|
896
|
+
end.should_not_be_updated
|
733
897
|
end
|
734
898
|
|
735
899
|
# unlikely to work consistently correct, okay to deprecate the arch-array in favor of the arch in the name
|
736
900
|
it "installs the second rpm if the first is installed (muti-arch)" do
|
737
901
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
738
|
-
dnf_package
|
739
|
-
|
740
|
-
|
741
|
-
|
902
|
+
dnf_package %w{chef_rpm chef_rpm} do
|
903
|
+
options default_options
|
904
|
+
arch [pkg_arch, "i686"]
|
905
|
+
action :install
|
906
|
+
end.should_be_updated
|
742
907
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.#{pkg_arch}$/)
|
743
908
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.i686$/)
|
744
|
-
dnf_package
|
745
|
-
|
909
|
+
dnf_package %w{chef_rpm chef_rpm} do
|
910
|
+
options default_options
|
911
|
+
action :install
|
912
|
+
end.should_not_be_updated
|
746
913
|
end
|
747
914
|
|
748
915
|
# unlikely to work consistently correct, okay to deprecate the arch-array in favor of the arch in the name
|
749
916
|
it "installs the first rpm if the second is installed (muti-arch)" do
|
750
917
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
751
|
-
dnf_package
|
752
|
-
|
753
|
-
|
754
|
-
|
918
|
+
dnf_package %w{chef_rpm chef_rpm} do
|
919
|
+
options default_options
|
920
|
+
arch [pkg_arch, "i686"]
|
921
|
+
action :install
|
922
|
+
end.should_be_updated
|
755
923
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.#{pkg_arch}$/)
|
756
924
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.i686$/)
|
757
|
-
dnf_package
|
758
|
-
|
925
|
+
dnf_package %w{chef_rpm chef_rpm} do
|
926
|
+
options default_options
|
927
|
+
action :install
|
928
|
+
end.should_not_be_updated
|
759
929
|
end
|
760
930
|
|
761
931
|
# unlikely to work consistently correct, okay to deprecate the arch-array in favor of the arch in the name
|
762
932
|
it "does nothing if both are installed (muti-arch)" do
|
763
933
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm", "chef_rpm-1.10-1.i686.rpm")
|
764
|
-
dnf_package
|
765
|
-
|
766
|
-
|
767
|
-
|
934
|
+
dnf_package %w{chef_rpm chef_rpm} do
|
935
|
+
options default_options
|
936
|
+
arch [pkg_arch, "i686"]
|
937
|
+
action :install
|
938
|
+
end.should_not_be_updated
|
768
939
|
end
|
769
940
|
end
|
770
941
|
|
771
942
|
context "repo controls" do
|
772
943
|
it "should fail with the repo disabled" do
|
773
944
|
flush_cache
|
774
|
-
|
775
|
-
|
945
|
+
expect {
|
946
|
+
dnf_package "chef_rpm" do
|
947
|
+
options "--nogpgcheck --disablerepo=chef-dnf-localtesting"
|
948
|
+
action :install
|
949
|
+
end
|
950
|
+
}.to raise_error(Chef::Exceptions::Package, /No candidate version available/)
|
776
951
|
end
|
777
952
|
|
778
953
|
it "should work with disablerepo first" do
|
779
954
|
flush_cache
|
780
|
-
dnf_package
|
781
|
-
|
782
|
-
|
955
|
+
dnf_package "chef_rpm" do
|
956
|
+
options ["--nogpgcheck", "--disablerepo=*", "--enablerepo=chef-dnf-localtesting"]
|
957
|
+
action :install
|
958
|
+
end.should_be_updated
|
783
959
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
784
|
-
dnf_package
|
785
|
-
|
960
|
+
dnf_package "chef_rpm" do
|
961
|
+
options ["--nogpgcheck", "--disablerepo=*", "--enablerepo=chef-dnf-localtesting"]
|
962
|
+
action :install
|
963
|
+
end.should_not_be_updated
|
786
964
|
end
|
787
965
|
|
788
966
|
it "should work to enable a disabled repo" do
|
789
967
|
shell_out!("dnf config-manager --set-disabled chef-dnf-localtesting")
|
790
968
|
flush_cache
|
791
|
-
expect {
|
969
|
+
expect {
|
970
|
+
dnf_package "chef_rpm" do
|
971
|
+
options "--nogpgcheck"
|
972
|
+
action :install
|
973
|
+
end
|
974
|
+
}.to raise_error(Chef::Exceptions::Package, /No candidate version available/)
|
792
975
|
flush_cache
|
793
|
-
dnf_package
|
794
|
-
|
795
|
-
|
976
|
+
dnf_package "chef_rpm" do
|
977
|
+
options "--nogpgcheck --enablerepo=chef-dnf-localtesting"
|
978
|
+
action :install
|
979
|
+
end.should_be_updated
|
796
980
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
797
|
-
dnf_package
|
798
|
-
|
981
|
+
dnf_package "chef_rpm" do
|
982
|
+
options "--nogpgcheck --enablerepo=chef-dnf-localtesting"
|
983
|
+
action :install
|
984
|
+
end.should_not_be_updated
|
799
985
|
end
|
800
986
|
|
801
987
|
it "when an idempotent install action is run, does not leave repos disabled" do
|
@@ -805,19 +991,22 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
805
991
|
# accomplishes both those goals (it would be easier if we had other rpms in this repo, but with
|
806
992
|
# one rpm we need to do this).
|
807
993
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
808
|
-
dnf_package
|
809
|
-
|
810
|
-
|
994
|
+
dnf_package "chef_rpm" do
|
995
|
+
options "--nogpgcheck --disablerepo=chef-dnf-localtesting"
|
996
|
+
action :upgrade
|
997
|
+
end.should_not_be_updated
|
811
998
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
812
999
|
# now we're still using the same cache in the dnf_helper.py cache and we test to see if the
|
813
1000
|
# repo that we temporarily disabled is enabled on this pass.
|
814
|
-
dnf_package
|
815
|
-
|
816
|
-
|
817
|
-
|
1001
|
+
dnf_package "chef_rpm-1.10-1.#{pkg_arch}" do
|
1002
|
+
options "--nogpgcheck"
|
1003
|
+
action :install
|
1004
|
+
end.should_be_updated
|
818
1005
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
819
|
-
dnf_package.
|
820
|
-
|
1006
|
+
dnf_package "chef_rpm-1.10-1.#{pkg_arch}" do
|
1007
|
+
options "--nogpgcheck"
|
1008
|
+
action :install
|
1009
|
+
end.should_not_be_updated
|
821
1010
|
end
|
822
1011
|
end
|
823
1012
|
end
|
@@ -826,76 +1015,102 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
826
1015
|
context "downgrades" do
|
827
1016
|
it "just work with DNF" do
|
828
1017
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
829
|
-
dnf_package
|
830
|
-
|
831
|
-
|
1018
|
+
dnf_package "chef_rpm" do
|
1019
|
+
options default_options
|
1020
|
+
version "1.2"
|
1021
|
+
action :install
|
1022
|
+
end.should_be_updated
|
832
1023
|
expect(shell_out("rpm -q chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}")
|
833
|
-
dnf_package
|
834
|
-
|
1024
|
+
dnf_package "chef_rpm" do
|
1025
|
+
options default_options
|
1026
|
+
version "1.2"
|
1027
|
+
action :install
|
1028
|
+
end.should_not_be_updated
|
835
1029
|
end
|
836
1030
|
|
837
1031
|
it "throws a deprecation warning with allow_downgrade" do
|
838
1032
|
Chef::Config[:treat_deprecation_warnings_as_errors] = false
|
839
|
-
expect(Chef).to receive(:deprecated).with(:dnf_package_allow_downgrade, /^the allow_downgrade property on the dnf_package provider is not used/)
|
1033
|
+
expect(Chef).to receive(:deprecated).at_least(:once).with(:dnf_package_allow_downgrade, /^the allow_downgrade property on the dnf_package provider is not used/)
|
840
1034
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
841
|
-
dnf_package
|
842
|
-
|
843
|
-
|
844
|
-
|
1035
|
+
dnf_package "chef_rpm" do
|
1036
|
+
options default_options
|
1037
|
+
version "1.2"
|
1038
|
+
allow_downgrade true
|
1039
|
+
action :install
|
1040
|
+
end.should_be_updated
|
845
1041
|
expect(shell_out("rpm -q chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}")
|
846
|
-
dnf_package
|
847
|
-
|
1042
|
+
dnf_package "chef_rpm" do
|
1043
|
+
options default_options
|
1044
|
+
version "1.2"
|
1045
|
+
allow_downgrade true
|
1046
|
+
action :install
|
1047
|
+
end.should_not_be_updated
|
848
1048
|
end
|
849
1049
|
end
|
850
1050
|
|
851
1051
|
context "with source arguments" do
|
852
1052
|
it "installs the package when using the source argument" do
|
853
1053
|
flush_cache
|
854
|
-
dnf_package
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
1054
|
+
dnf_package "something" do
|
1055
|
+
options default_options
|
1056
|
+
package_name "somethingelse"
|
1057
|
+
source("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
1058
|
+
action :upgrade
|
1059
|
+
end.should_be_updated
|
859
1060
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
860
|
-
dnf_package
|
861
|
-
|
1061
|
+
dnf_package "something" do
|
1062
|
+
options default_options
|
1063
|
+
package_name "somethingelse"
|
1064
|
+
source("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
1065
|
+
action :upgrade
|
1066
|
+
end.should_not_be_updated
|
862
1067
|
end
|
863
1068
|
|
864
1069
|
it "installs the package when the name is a path to a file" do
|
865
1070
|
flush_cache
|
866
|
-
dnf_package
|
867
|
-
|
868
|
-
|
1071
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
1072
|
+
options default_options
|
1073
|
+
action :upgrade
|
1074
|
+
end.should_be_updated
|
869
1075
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
870
|
-
dnf_package.
|
871
|
-
|
1076
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
1077
|
+
options default_options
|
1078
|
+
action :upgrade
|
1079
|
+
end.should_not_be_updated
|
872
1080
|
end
|
873
1081
|
|
874
1082
|
it "downgrades the package when allow_downgrade is true" do
|
875
1083
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
876
|
-
dnf_package
|
877
|
-
|
878
|
-
|
1084
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
1085
|
+
options default_options
|
1086
|
+
action :upgrade
|
1087
|
+
end.should_be_updated
|
879
1088
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
880
|
-
dnf_package.
|
881
|
-
|
1089
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
1090
|
+
options default_options
|
1091
|
+
action :upgrade
|
1092
|
+
end.should_not_be_updated
|
882
1093
|
end
|
883
1094
|
|
884
1095
|
it "upgrades the package" do
|
885
1096
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
886
|
-
dnf_package
|
887
|
-
|
888
|
-
|
1097
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.10-1.#{pkg_arch}.rpm" do
|
1098
|
+
options default_options
|
1099
|
+
action :upgrade
|
1100
|
+
end.should_be_updated
|
889
1101
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
890
|
-
dnf_package.
|
891
|
-
|
1102
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.10-1.#{pkg_arch}.rpm" do
|
1103
|
+
options default_options
|
1104
|
+
action :upgrade
|
1105
|
+
end.should_not_be_updated
|
892
1106
|
end
|
893
1107
|
|
894
1108
|
it "is idempotent when the package is already installed" do
|
895
1109
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
896
|
-
dnf_package
|
897
|
-
|
898
|
-
|
1110
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
1111
|
+
options default_options
|
1112
|
+
action :upgrade
|
1113
|
+
end.should_not_be_updated
|
899
1114
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
900
1115
|
end
|
901
1116
|
end
|
@@ -904,295 +1119,382 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
904
1119
|
it "works when a package is installed" do
|
905
1120
|
FileUtils.rm_f "/etc/yum.repos.d/chef-dnf-localtesting.repo"
|
906
1121
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
907
|
-
dnf_package
|
908
|
-
|
909
|
-
|
1122
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
1123
|
+
options "--nogpgcheck --disablerepo=*"
|
1124
|
+
action :upgrade
|
1125
|
+
end.should_not_be_updated
|
910
1126
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
911
1127
|
end
|
912
1128
|
|
913
1129
|
it "works with a local source" do
|
914
1130
|
FileUtils.rm_f "/etc/yum.repos.d/chef-dnf-localtesting.repo"
|
915
1131
|
flush_cache
|
916
|
-
dnf_package
|
917
|
-
|
918
|
-
|
1132
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
1133
|
+
options "--nogpgcheck --disablerepo=*"
|
1134
|
+
action :upgrade
|
1135
|
+
end.should_be_updated
|
919
1136
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
920
|
-
dnf_package.
|
921
|
-
|
1137
|
+
dnf_package "#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm" do
|
1138
|
+
options default_options
|
1139
|
+
action :upgrade
|
1140
|
+
end.should_not_be_updated
|
922
1141
|
end
|
923
1142
|
end
|
924
1143
|
|
925
1144
|
context "version pinning" do
|
926
1145
|
it "with a full version pin it installs a later package" do
|
927
1146
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
928
|
-
dnf_package
|
929
|
-
|
930
|
-
|
931
|
-
|
1147
|
+
dnf_package "chef_rpm" do
|
1148
|
+
options default_options
|
1149
|
+
version "1.10-1"
|
1150
|
+
action :upgrade
|
1151
|
+
end.should_be_updated
|
932
1152
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
933
|
-
dnf_package
|
934
|
-
|
1153
|
+
dnf_package "chef_rpm" do
|
1154
|
+
options default_options
|
1155
|
+
version "1.10-1"
|
1156
|
+
action :upgrade
|
1157
|
+
end.should_not_be_updated
|
935
1158
|
end
|
936
1159
|
|
937
1160
|
it "with a full version pin in the name it downgrades the package" do
|
938
1161
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
939
|
-
dnf_package
|
940
|
-
|
941
|
-
|
942
|
-
|
1162
|
+
dnf_package "chef_rpm" do
|
1163
|
+
options default_options
|
1164
|
+
version "1.2-1"
|
1165
|
+
action :upgrade
|
1166
|
+
end.should_be_updated
|
943
1167
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
944
|
-
dnf_package
|
945
|
-
|
1168
|
+
dnf_package "chef_rpm" do
|
1169
|
+
options default_options
|
1170
|
+
version "1.2-1"
|
1171
|
+
action :upgrade
|
1172
|
+
end.should_not_be_updated
|
946
1173
|
end
|
947
1174
|
|
948
1175
|
it "with a partial (no release) version pin it installs a later package" do
|
949
1176
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
950
|
-
dnf_package
|
951
|
-
|
952
|
-
|
953
|
-
|
1177
|
+
dnf_package "chef_rpm" do
|
1178
|
+
options default_options
|
1179
|
+
version "1.10"
|
1180
|
+
action :upgrade
|
1181
|
+
end.should_be_updated
|
954
1182
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
955
|
-
dnf_package
|
956
|
-
|
1183
|
+
dnf_package "chef_rpm" do
|
1184
|
+
options default_options
|
1185
|
+
version "1.10"
|
1186
|
+
action :upgrade
|
1187
|
+
end.should_not_be_updated
|
957
1188
|
end
|
958
1189
|
|
959
1190
|
it "with a partial (no release) version pin in the name it downgrades the package" do
|
960
1191
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
961
|
-
dnf_package
|
962
|
-
|
963
|
-
|
964
|
-
|
1192
|
+
dnf_package "chef_rpm" do
|
1193
|
+
options default_options
|
1194
|
+
version("1.2")
|
1195
|
+
action :upgrade
|
1196
|
+
end.should_be_updated
|
965
1197
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
966
|
-
dnf_package
|
967
|
-
|
1198
|
+
dnf_package "chef_rpm" do
|
1199
|
+
options default_options
|
1200
|
+
version("1.2")
|
1201
|
+
action :upgrade
|
1202
|
+
end.should_not_be_updated
|
968
1203
|
end
|
969
1204
|
|
970
1205
|
it "with a full version pin it installs a later package" do
|
971
1206
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
972
|
-
dnf_package
|
973
|
-
|
974
|
-
|
1207
|
+
dnf_package "chef_rpm-1.10-1" do
|
1208
|
+
options default_options
|
1209
|
+
action :upgrade
|
1210
|
+
end.should_be_updated
|
975
1211
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
976
|
-
dnf_package.
|
977
|
-
|
1212
|
+
dnf_package "chef_rpm-1.10-1" do
|
1213
|
+
options default_options
|
1214
|
+
action :upgrade
|
1215
|
+
end.should_not_be_updated
|
978
1216
|
end
|
979
1217
|
|
980
1218
|
it "with a full version pin in the name it downgrades the package" do
|
981
1219
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
982
|
-
dnf_package
|
983
|
-
|
984
|
-
|
1220
|
+
dnf_package "chef_rpm-1.2-1" do
|
1221
|
+
options default_options
|
1222
|
+
action :upgrade
|
1223
|
+
end.should_be_updated
|
985
1224
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
986
|
-
dnf_package.
|
987
|
-
|
1225
|
+
dnf_package "chef_rpm-1.2-1" do
|
1226
|
+
options default_options
|
1227
|
+
action :upgrade
|
1228
|
+
end.should_not_be_updated
|
988
1229
|
end
|
989
1230
|
|
990
1231
|
it "with a partial (no release) version pin it installs a later package" do
|
991
1232
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
992
|
-
dnf_package
|
993
|
-
|
994
|
-
|
1233
|
+
dnf_package "chef_rpm-1.10" do
|
1234
|
+
options default_options
|
1235
|
+
action :upgrade
|
1236
|
+
end.should_be_updated
|
995
1237
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
996
|
-
dnf_package.
|
997
|
-
|
1238
|
+
dnf_package "chef_rpm-1.10" do
|
1239
|
+
options default_options
|
1240
|
+
action :upgrade
|
1241
|
+
end.should_not_be_updated
|
998
1242
|
end
|
999
1243
|
|
1000
1244
|
it "with a partial (no release) version pin in the name it downgrades the package" do
|
1001
1245
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
1002
|
-
dnf_package
|
1003
|
-
|
1004
|
-
|
1246
|
+
dnf_package "chef_rpm-1.2" do
|
1247
|
+
options default_options
|
1248
|
+
action :upgrade
|
1249
|
+
end.should_be_updated
|
1005
1250
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
1006
|
-
dnf_package.
|
1007
|
-
|
1251
|
+
dnf_package "chef_rpm-1.2" do
|
1252
|
+
options default_options
|
1253
|
+
action :upgrade
|
1254
|
+
end.should_not_be_updated
|
1008
1255
|
end
|
1009
1256
|
|
1010
1257
|
it "with a prco equality pin in the name it upgrades a prior package" do
|
1011
1258
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
1012
|
-
dnf_package
|
1013
|
-
|
1014
|
-
|
1259
|
+
dnf_package "chef_rpm = 1.10" do
|
1260
|
+
options default_options
|
1261
|
+
action :upgrade
|
1262
|
+
end.should_be_updated
|
1015
1263
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
1016
|
-
dnf_package.
|
1017
|
-
|
1264
|
+
dnf_package "chef_rpm = 1.10" do
|
1265
|
+
options default_options
|
1266
|
+
action :upgrade
|
1267
|
+
end.should_not_be_updated
|
1018
1268
|
end
|
1019
1269
|
|
1020
1270
|
it "with a prco equality pin in the name it downgrades a later package" do
|
1021
1271
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
1022
|
-
dnf_package
|
1023
|
-
|
1024
|
-
|
1272
|
+
dnf_package "chef_rpm = 1.2" do
|
1273
|
+
options default_options
|
1274
|
+
action :upgrade
|
1275
|
+
end.should_be_updated
|
1025
1276
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
1026
|
-
dnf_package.
|
1027
|
-
|
1277
|
+
dnf_package "chef_rpm = 1.2" do
|
1278
|
+
options default_options
|
1279
|
+
action :upgrade
|
1280
|
+
end.should_not_be_updated
|
1028
1281
|
end
|
1029
1282
|
|
1030
1283
|
it "with a > pin in the name and no rpm installed it installs" do
|
1031
1284
|
flush_cache
|
1032
|
-
dnf_package
|
1033
|
-
|
1034
|
-
|
1285
|
+
dnf_package "chef_rpm > 1.2" do
|
1286
|
+
options default_options
|
1287
|
+
action :upgrade
|
1288
|
+
end.should_be_updated
|
1035
1289
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
1036
|
-
dnf_package.
|
1037
|
-
|
1290
|
+
dnf_package "chef_rpm > 1.2" do
|
1291
|
+
options default_options
|
1292
|
+
action :upgrade
|
1293
|
+
end.should_not_be_updated
|
1038
1294
|
end
|
1039
1295
|
|
1040
1296
|
it "with a < pin in the name and no rpm installed it installs" do
|
1041
1297
|
flush_cache
|
1042
|
-
dnf_package
|
1043
|
-
|
1044
|
-
|
1298
|
+
dnf_package "chef_rpm < 1.10" do
|
1299
|
+
options default_options
|
1300
|
+
action :upgrade
|
1301
|
+
end.should_be_updated
|
1045
1302
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
1046
|
-
dnf_package.
|
1047
|
-
|
1303
|
+
dnf_package "chef_rpm < 1.10" do
|
1304
|
+
options default_options
|
1305
|
+
action :upgrade
|
1306
|
+
end.should_not_be_updated
|
1048
1307
|
end
|
1049
1308
|
|
1050
1309
|
it "with a > pin in the name and matching rpm installed it does nothing" do
|
1051
1310
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
1052
|
-
dnf_package
|
1053
|
-
|
1054
|
-
|
1311
|
+
dnf_package "chef_rpm > 1.2" do
|
1312
|
+
options default_options
|
1313
|
+
action :upgrade
|
1314
|
+
end.should_not_be_updated
|
1055
1315
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
1056
1316
|
end
|
1057
1317
|
|
1058
1318
|
it "with a < pin in the name and no rpm installed it installs" do
|
1059
1319
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
1060
|
-
dnf_package
|
1061
|
-
|
1062
|
-
|
1320
|
+
dnf_package "chef_rpm < 1.10" do
|
1321
|
+
options default_options
|
1322
|
+
action :upgrade
|
1323
|
+
end.should_not_be_updated
|
1063
1324
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
1064
1325
|
end
|
1065
1326
|
|
1066
1327
|
it "with a > pin in the name and non-matching rpm installed it upgrades" do
|
1067
1328
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
1068
|
-
dnf_package
|
1069
|
-
|
1070
|
-
|
1329
|
+
dnf_package "chef_rpm > 1.2" do
|
1330
|
+
options default_options
|
1331
|
+
action :upgrade
|
1332
|
+
end.should_be_updated
|
1071
1333
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
1072
|
-
dnf_package.
|
1073
|
-
|
1334
|
+
dnf_package "chef_rpm > 1.2" do
|
1335
|
+
options default_options
|
1336
|
+
action :upgrade
|
1337
|
+
end.should_not_be_updated
|
1074
1338
|
end
|
1075
1339
|
|
1076
1340
|
it "with a < pin in the name and non-matching rpm installed it downgrades" do
|
1077
1341
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
1078
|
-
dnf_package
|
1079
|
-
|
1080
|
-
|
1342
|
+
dnf_package "chef_rpm < 1.10" do
|
1343
|
+
options default_options
|
1344
|
+
action :upgrade
|
1345
|
+
end.should_be_updated
|
1081
1346
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
1082
|
-
dnf_package.
|
1083
|
-
|
1347
|
+
dnf_package "chef_rpm < 1.10" do
|
1348
|
+
options default_options
|
1349
|
+
action :upgrade
|
1350
|
+
end.should_not_be_updated
|
1084
1351
|
end
|
1085
1352
|
end
|
1086
1353
|
end
|
1087
1354
|
|
1088
1355
|
describe ":remove" do
|
1089
1356
|
context "vanilla use case" do
|
1090
|
-
let(:package_name) { "chef_rpm" }
|
1091
1357
|
it "does nothing if the package is not installed" do
|
1092
1358
|
flush_cache
|
1093
|
-
dnf_package
|
1094
|
-
|
1359
|
+
dnf_package "chef_rpm" do
|
1360
|
+
options default_options
|
1361
|
+
action :remove
|
1362
|
+
end.should_not_be_updated
|
1095
1363
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
|
1096
1364
|
end
|
1097
1365
|
|
1098
1366
|
it "removes the package if the package is installed" do
|
1099
1367
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
1100
|
-
dnf_package
|
1101
|
-
|
1368
|
+
dnf_package "chef_rpm" do
|
1369
|
+
options default_options
|
1370
|
+
action :remove
|
1371
|
+
end.should_be_updated
|
1102
1372
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
|
1103
1373
|
end
|
1104
1374
|
|
1105
1375
|
it "does not remove the package twice" do
|
1106
1376
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
1107
|
-
dnf_package
|
1108
|
-
|
1377
|
+
dnf_package "chef_rpm" do
|
1378
|
+
options default_options
|
1379
|
+
action :remove
|
1380
|
+
end.should_be_updated
|
1109
1381
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
|
1110
|
-
dnf_package
|
1111
|
-
|
1382
|
+
dnf_package "chef_rpm" do
|
1383
|
+
options default_options
|
1384
|
+
action :remove
|
1385
|
+
end.should_not_be_updated
|
1112
1386
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
|
1113
1387
|
end
|
1114
1388
|
|
1115
1389
|
it "removes the package if the prior version package is installed" do
|
1116
1390
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
1117
|
-
dnf_package
|
1118
|
-
|
1391
|
+
dnf_package "chef_rpm" do
|
1392
|
+
options default_options
|
1393
|
+
action :remove
|
1394
|
+
end.should_be_updated
|
1119
1395
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
|
1120
|
-
dnf_package
|
1121
|
-
|
1396
|
+
dnf_package "chef_rpm" do
|
1397
|
+
options default_options
|
1398
|
+
action :remove
|
1399
|
+
end.should_not_be_updated
|
1122
1400
|
end
|
1123
1401
|
|
1124
1402
|
it "removes the package if the i686 package is installed", :intel_64bit do
|
1125
1403
|
skip "FIXME: should this be fixed or is the current behavior correct?"
|
1126
1404
|
preinstall("chef_rpm-1.10-1.i686.rpm")
|
1127
|
-
dnf_package
|
1128
|
-
|
1405
|
+
dnf_package "chef_rpm" do
|
1406
|
+
options default_options
|
1407
|
+
action :remove
|
1408
|
+
end.should_be_updated
|
1129
1409
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
|
1130
|
-
dnf_package
|
1131
|
-
|
1410
|
+
dnf_package "chef_rpm" do
|
1411
|
+
options default_options
|
1412
|
+
action :remove
|
1413
|
+
end.should_not_be_updated
|
1132
1414
|
end
|
1133
1415
|
|
1134
1416
|
it "removes the package if the prior version i686 package is installed", :intel_64bit do
|
1135
1417
|
skip "FIXME: should this be fixed or is the current behavior correct?"
|
1136
1418
|
preinstall("chef_rpm-1.2-1.i686.rpm")
|
1137
|
-
dnf_package
|
1138
|
-
|
1419
|
+
dnf_package "chef_rpm" do
|
1420
|
+
options default_options
|
1421
|
+
action :remove
|
1422
|
+
end.should_be_updated
|
1139
1423
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
|
1140
|
-
dnf_package
|
1141
|
-
|
1424
|
+
dnf_package "chef_rpm" do
|
1425
|
+
options default_options
|
1426
|
+
action :remove
|
1427
|
+
end.should_not_be_updated
|
1142
1428
|
end
|
1143
1429
|
end
|
1144
1430
|
|
1145
1431
|
context "with 64-bit arch", :intel_64bit do
|
1146
|
-
let(:package_name) { "chef_rpm.#{pkg_arch}" }
|
1147
1432
|
it "does nothing if the package is not installed" do
|
1148
1433
|
flush_cache
|
1149
|
-
dnf_package
|
1150
|
-
|
1434
|
+
dnf_package "chef_rpm.#{pkg_arch}" do
|
1435
|
+
options default_options
|
1436
|
+
action :remove
|
1437
|
+
end.should_not_be_updated
|
1151
1438
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
|
1152
1439
|
end
|
1153
1440
|
|
1154
1441
|
it "removes the package if the package is installed" do
|
1155
1442
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
1156
|
-
dnf_package
|
1157
|
-
|
1443
|
+
dnf_package "chef_rpm.#{pkg_arch}" do
|
1444
|
+
options default_options
|
1445
|
+
action :remove
|
1446
|
+
end.should_be_updated
|
1158
1447
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
|
1159
|
-
dnf_package
|
1160
|
-
|
1448
|
+
dnf_package "chef_rpm.#{pkg_arch}" do
|
1449
|
+
options default_options
|
1450
|
+
action :remove
|
1451
|
+
end.should_not_be_updated
|
1161
1452
|
end
|
1162
1453
|
|
1163
1454
|
it "removes the package if the prior version package is installed" do
|
1164
1455
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
1165
|
-
dnf_package
|
1166
|
-
|
1456
|
+
dnf_package "chef_rpm.#{pkg_arch}" do
|
1457
|
+
options default_options
|
1458
|
+
action :remove
|
1459
|
+
end.should_be_updated
|
1167
1460
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
|
1168
|
-
dnf_package
|
1169
|
-
|
1461
|
+
dnf_package "chef_rpm.#{pkg_arch}" do
|
1462
|
+
options default_options
|
1463
|
+
action :remove
|
1464
|
+
end.should_not_be_updated
|
1170
1465
|
end
|
1171
1466
|
|
1172
1467
|
it "does nothing if the i686 package is installed" do
|
1173
1468
|
preinstall("chef_rpm-1.10-1.i686.rpm")
|
1174
|
-
dnf_package
|
1175
|
-
|
1469
|
+
dnf_package "chef_rpm.#{pkg_arch}" do
|
1470
|
+
options default_options
|
1471
|
+
action :remove
|
1472
|
+
end.should_not_be_updated
|
1176
1473
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.i686$")
|
1177
1474
|
end
|
1178
1475
|
|
1179
1476
|
it "does nothing if the prior version i686 package is installed" do
|
1180
1477
|
preinstall("chef_rpm-1.2-1.i686.rpm")
|
1181
|
-
dnf_package
|
1182
|
-
|
1478
|
+
dnf_package "chef_rpm.#{pkg_arch}" do
|
1479
|
+
options default_options
|
1480
|
+
action :remove
|
1481
|
+
end.should_not_be_updated
|
1183
1482
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.i686$")
|
1184
1483
|
end
|
1185
1484
|
end
|
1186
1485
|
|
1187
1486
|
context "with 32-bit arch", :intel_64bit do
|
1188
|
-
let(:package_name) { "chef_rpm.i686" }
|
1189
1487
|
it "removes only the 32-bit arch if both are installed" do
|
1190
1488
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm", "chef_rpm-1.10-1.i686.rpm")
|
1191
|
-
dnf_package.
|
1192
|
-
|
1489
|
+
dnf_package "chef_rpm.i686" do
|
1490
|
+
options default_options
|
1491
|
+
action :remove
|
1492
|
+
end.should_be_updated
|
1193
1493
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
1194
|
-
dnf_package.
|
1195
|
-
|
1494
|
+
dnf_package "chef_rpm.i686" do
|
1495
|
+
options default_options
|
1496
|
+
action :remove
|
1497
|
+
end.should_not_be_updated
|
1196
1498
|
end
|
1197
1499
|
end
|
1198
1500
|
|
@@ -1200,11 +1502,15 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
1200
1502
|
it "works when a package is installed" do
|
1201
1503
|
FileUtils.rm_f "/etc/yum.repos.d/chef-dnf-localtesting.repo"
|
1202
1504
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
1203
|
-
dnf_package
|
1204
|
-
|
1505
|
+
dnf_package "chef_rpm" do
|
1506
|
+
options "--nogpgcheck --disablerepo=*"
|
1507
|
+
action :remove
|
1508
|
+
end.should_be_updated
|
1205
1509
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
|
1206
|
-
dnf_package
|
1207
|
-
|
1510
|
+
dnf_package "chef_rpm" do
|
1511
|
+
options "--nogpgcheck --disablerepo=*"
|
1512
|
+
action :remove
|
1513
|
+
end.should_not_be_updated
|
1208
1514
|
end
|
1209
1515
|
end
|
1210
1516
|
end
|
@@ -1220,61 +1526,75 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
1220
1526
|
|
1221
1527
|
it "locks an rpm" do
|
1222
1528
|
flush_cache
|
1223
|
-
dnf_package
|
1224
|
-
|
1225
|
-
|
1529
|
+
dnf_package "chef_rpm" do
|
1530
|
+
options default_options
|
1531
|
+
action :lock
|
1532
|
+
end.should_be_updated
|
1226
1533
|
expect(shell_out("dnf versionlock list").stdout.chomp).to match("^chef_rpm-0:")
|
1227
|
-
dnf_package
|
1228
|
-
|
1534
|
+
dnf_package "chef_rpm" do
|
1535
|
+
options default_options
|
1536
|
+
action :lock
|
1537
|
+
end.should_not_be_updated
|
1229
1538
|
end
|
1230
1539
|
|
1231
1540
|
it "does not lock if its already locked" do
|
1232
1541
|
flush_cache
|
1233
1542
|
shell_out!("dnf versionlock add chef_rpm")
|
1234
|
-
dnf_package
|
1235
|
-
|
1236
|
-
|
1543
|
+
dnf_package "chef_rpm" do
|
1544
|
+
options default_options
|
1545
|
+
action :lock
|
1546
|
+
end.should_not_be_updated
|
1237
1547
|
expect(shell_out("dnf versionlock list").stdout.chomp).to match("^chef_rpm-0:")
|
1238
1548
|
end
|
1239
1549
|
|
1240
1550
|
it "unlocks an rpm" do
|
1241
1551
|
flush_cache
|
1242
1552
|
shell_out!("dnf versionlock add chef_rpm")
|
1243
|
-
dnf_package
|
1244
|
-
|
1245
|
-
|
1553
|
+
dnf_package "chef_rpm" do
|
1554
|
+
options default_options
|
1555
|
+
action :unlock
|
1556
|
+
end.should_be_updated
|
1246
1557
|
expect(shell_out("dnf versionlock list").stdout.chomp).not_to match("^chef_rpm-0:")
|
1247
|
-
dnf_package
|
1248
|
-
|
1558
|
+
dnf_package "chef_rpm" do
|
1559
|
+
options default_options
|
1560
|
+
action :unlock
|
1561
|
+
end.should_not_be_updated
|
1249
1562
|
end
|
1250
1563
|
|
1251
1564
|
it "does not unlock an already locked rpm" do
|
1252
1565
|
flush_cache
|
1253
|
-
dnf_package
|
1254
|
-
|
1255
|
-
|
1566
|
+
dnf_package "chef_rpm" do
|
1567
|
+
options default_options
|
1568
|
+
action :unlock
|
1569
|
+
end.should_not_be_updated
|
1256
1570
|
expect(shell_out("dnf versionlock list").stdout.chomp).not_to match("^chef_rpm-0:")
|
1257
1571
|
end
|
1258
1572
|
|
1259
1573
|
it "check that we can lock based on provides" do
|
1260
1574
|
flush_cache
|
1261
|
-
dnf_package
|
1262
|
-
|
1263
|
-
|
1575
|
+
dnf_package "chef_rpm_provides" do
|
1576
|
+
options default_options
|
1577
|
+
action :lock
|
1578
|
+
end.should_be_updated
|
1264
1579
|
expect(shell_out("dnf versionlock list").stdout.chomp).to match("^chef_rpm-0:")
|
1265
|
-
dnf_package
|
1266
|
-
|
1580
|
+
dnf_package "chef_rpm_provides" do
|
1581
|
+
options default_options
|
1582
|
+
action :lock
|
1583
|
+
end.should_not_be_updated
|
1267
1584
|
end
|
1268
1585
|
|
1269
1586
|
it "check that we can unlock based on provides" do
|
1270
1587
|
flush_cache
|
1271
1588
|
shell_out!("dnf versionlock add chef_rpm")
|
1272
|
-
dnf_package
|
1273
|
-
|
1274
|
-
|
1589
|
+
dnf_package "chef_rpm_provides" do
|
1590
|
+
options default_options
|
1591
|
+
action :unlock
|
1592
|
+
end.should_be_updated
|
1275
1593
|
expect(shell_out("dnf versionlock list").stdout.chomp).not_to match("^chef_rpm-0:")
|
1276
|
-
dnf_package
|
1277
|
-
|
1594
|
+
dnf_package "chef_rpm_provides" do
|
1595
|
+
options default_options
|
1596
|
+
action :unlock
|
1597
|
+
end.should_not_be_updated
|
1278
1598
|
end
|
1279
1599
|
end
|
1280
1600
|
end
|