chef 16.8.14 → 16.9.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -3
- data/README.md +1 -1
- data/chef.gemspec +10 -1
- data/lib/chef/compliance/default_attributes.rb +5 -1
- data/lib/chef/compliance/fetcher/automate.rb +2 -2
- data/lib/chef/compliance/fetcher/chef_server.rb +2 -2
- data/lib/chef/compliance/reporter/automate.rb +1 -2
- data/lib/chef/compliance/reporter/chef_server_automate.rb +2 -2
- data/lib/chef/compliance/runner.rb +7 -2
- data/lib/chef/http/ssl_policies.rb +27 -14
- data/lib/chef/knife/core/formatting_options.rb +49 -0
- data/lib/chef/knife/core/node_presenter.rb +0 -25
- data/lib/chef/knife/core/status_presenter.rb +1 -26
- data/lib/chef/knife/core/windows_bootstrap_context.rb +1 -1
- data/lib/chef/knife/node_show.rb +2 -1
- data/lib/chef/knife/search.rb +2 -1
- data/lib/chef/knife/status.rb +8 -11
- data/lib/chef/policy_builder/policyfile.rb +1 -1
- data/lib/chef/provider/package.rb +53 -19
- data/lib/chef/provider/package/dnf.rb +39 -12
- data/lib/chef/provider/package/dnf/dnf_helper.py +18 -5
- data/lib/chef/provider/package/dnf/python_helper.rb +6 -6
- data/lib/chef/provider/yum_repository.rb +2 -2
- data/lib/chef/resource/chef_gem.rb +2 -2
- data/lib/chef/resource/cron/cron_d.rb +1 -0
- data/lib/chef/resource/file.rb +1 -1
- data/lib/chef/resource/gem_package.rb +2 -2
- data/lib/chef/resource/homebrew_cask.rb +3 -3
- data/lib/chef/resource/http_request.rb +1 -1
- data/lib/chef/resource/locale.rb +1 -1
- data/lib/chef/resource/mdadm.rb +2 -2
- data/lib/chef/resource/osx_profile.rb +7 -7
- data/lib/chef/resource/remote_directory.rb +1 -1
- data/lib/chef/resource/ruby.rb +1 -5
- data/lib/chef/resource/ruby_block.rb +1 -1
- data/lib/chef/resource/user/windows_user.rb +5 -0
- data/lib/chef/resource/windows_certificate.rb +2 -12
- data/lib/chef/resource/yum_repository.rb +5 -0
- data/lib/chef/version.rb +1 -1
- data/spec/data/rubygems.org/latest_specs.4.8.gz +0 -0
- data/spec/data/rubygems.org/nonexistent_gem +0 -0
- data/spec/data/rubygems.org/sexp_processor +0 -0
- data/spec/data/rubygems.org/sexp_processor-4.15.1.gemspec.rz +0 -0
- data/spec/data/ssl/binary/chef-rspec-der.cert +0 -0
- data/spec/data/ssl/binary/chef-rspec-der.key +0 -0
- data/spec/functional/resource/dnf_package_spec.rb +319 -16
- data/spec/functional/resource/windows_certificate_spec.rb +204 -384
- data/spec/unit/compliance/runner_spec.rb +28 -0
- data/spec/unit/http/ssl_policies_spec.rb +106 -78
- data/spec/unit/knife/bootstrap_spec.rb +5 -17
- data/spec/unit/knife/core/status_presenter_spec.rb +54 -0
- data/spec/unit/mixin/openssl_helper_spec.rb +0 -7
- data/spec/unit/provider/package/rubygems_spec.rb +39 -7
- data/spec/unit/resource/user/windows_user_spec.rb +36 -0
- metadata +24 -12
- data/spec/data/trusted_certs_empty/.gitkeep +0 -0
- data/spec/data/trusted_certs_empty/README.md +0 -1
- data/spec/scripts/ssl-serve.rb +0 -47
@@ -34,6 +34,7 @@ class Chef
|
|
34
34
|
allow_nils
|
35
35
|
use_multipackage_api
|
36
36
|
use_package_name_for_source
|
37
|
+
use_magic_version
|
37
38
|
|
38
39
|
# all rhel variants >= 8 will use DNF
|
39
40
|
provides :package, platform_family: "rhel", platform_version: ">= 8"
|
@@ -71,6 +72,16 @@ class Chef
|
|
71
72
|
current_resource
|
72
73
|
end
|
73
74
|
|
75
|
+
def load_after_resource
|
76
|
+
# force the installed version array to repopulate
|
77
|
+
@current_version = []
|
78
|
+
@after_resource = Chef::Resource::DnfPackage.new(new_resource.name)
|
79
|
+
after_resource.package_name(new_resource.package_name)
|
80
|
+
after_resource.version(get_current_versions)
|
81
|
+
|
82
|
+
after_resource
|
83
|
+
end
|
84
|
+
|
74
85
|
def define_resource_requirements
|
75
86
|
requirements.assert(:install, :upgrade, :remove, :purge) do |a|
|
76
87
|
a.assertion { !new_resource.source || ::File.exist?(new_resource.source) }
|
@@ -87,9 +98,15 @@ class Chef
|
|
87
98
|
end
|
88
99
|
end
|
89
100
|
|
101
|
+
def magic_version
|
102
|
+
package_name_array.each_with_index.map do |pkg, i|
|
103
|
+
magical_version(i).version_with_arch
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
90
107
|
def get_current_versions
|
91
108
|
package_name_array.each_with_index.map do |pkg, i|
|
92
|
-
|
109
|
+
current_version(i).version_with_arch
|
93
110
|
end
|
94
111
|
end
|
95
112
|
|
@@ -107,7 +124,7 @@ class Chef
|
|
107
124
|
alias upgrade_package install_package
|
108
125
|
|
109
126
|
def remove_package(names, versions)
|
110
|
-
resolved_names = names.each_with_index.map { |name, i|
|
127
|
+
resolved_names = names.each_with_index.map { |name, i| magical_version(i).to_s unless name.nil? }
|
111
128
|
dnf(options, "-y", "remove", resolved_names)
|
112
129
|
flushcache
|
113
130
|
end
|
@@ -137,10 +154,10 @@ class Chef
|
|
137
154
|
def resolved_package_lock_names(names)
|
138
155
|
names.each_with_index.map do |name, i|
|
139
156
|
unless name.nil?
|
140
|
-
if
|
157
|
+
if magical_version(i).version.nil?
|
141
158
|
available_version(i).name
|
142
159
|
else
|
143
|
-
|
160
|
+
magical_version(i).name
|
144
161
|
end
|
145
162
|
end
|
146
163
|
end
|
@@ -205,14 +222,24 @@ class Chef
|
|
205
222
|
end
|
206
223
|
|
207
224
|
# @return [Array<Version>]
|
208
|
-
def
|
209
|
-
@
|
210
|
-
@
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
@
|
225
|
+
def magical_version(index)
|
226
|
+
@magical_version ||= []
|
227
|
+
@magical_version[index] ||= if new_resource.source
|
228
|
+
python_helper.package_query(:whatinstalled, available_version(index).name, version: safe_version_array[index], arch: safe_arch_array[index], options: options)
|
229
|
+
else
|
230
|
+
python_helper.package_query(:whatinstalled, package_name_array[index], version: safe_version_array[index], arch: safe_arch_array[index], options: options)
|
231
|
+
end
|
232
|
+
@magical_version[index]
|
233
|
+
end
|
234
|
+
|
235
|
+
def current_version(index)
|
236
|
+
@current_version ||= []
|
237
|
+
@current_version[index] ||= if new_resource.source
|
238
|
+
python_helper.package_query(:whatinstalled, available_version(index).name, arch: safe_arch_array[index], options: options)
|
239
|
+
else
|
240
|
+
python_helper.package_query(:whatinstalled, package_name_array[index], arch: safe_arch_array[index], options: options)
|
241
|
+
end
|
242
|
+
@current_version[index]
|
216
243
|
end
|
217
244
|
|
218
245
|
# cache flushing is accomplished by simply restarting the python helper. this produces a roughly
|
@@ -98,14 +98,27 @@ def query(command):
|
|
98
98
|
q = q.available()
|
99
99
|
|
100
100
|
if 'epoch' in command:
|
101
|
-
|
101
|
+
# We assume that any glob is "*" so just omit the filter since the dnf libraries have no
|
102
|
+
# epoch__glob filter. That means "?" wildcards in epochs will fail. The workaround is to
|
103
|
+
# not use the version filter here but to put the version with all the globs in the package name.
|
104
|
+
if not dnf.util.is_glob_pattern(command['epoch']):
|
105
|
+
q = q.filterm(epoch=int(command['epoch']))
|
102
106
|
if 'version' in command:
|
103
|
-
|
107
|
+
if dnf.util.is_glob_pattern(command['version']):
|
108
|
+
q = q.filterm(version__glob=command['version'])
|
109
|
+
else:
|
110
|
+
q = q.filterm(version=command['version'])
|
104
111
|
if 'release' in command:
|
105
|
-
|
112
|
+
if dnf.util.is_glob_pattern(command['release']):
|
113
|
+
q = q.filterm(release__glob=command['release'])
|
114
|
+
else:
|
115
|
+
q = q.filterm(release=command['release'])
|
106
116
|
|
107
117
|
if 'arch' in command:
|
108
|
-
|
118
|
+
if dnf.util.is_glob_pattern(command['arch']):
|
119
|
+
q = q.filterm(arch__glob=command['arch'])
|
120
|
+
else:
|
121
|
+
q = q.filterm(arch=command['arch'])
|
109
122
|
|
110
123
|
# only apply the default arch query filter if it returns something
|
111
124
|
archq = q.filter(arch=[ 'noarch', hawkey.detect_arch() ])
|
@@ -170,4 +183,4 @@ try:
|
|
170
183
|
raise RuntimeError("bad command")
|
171
184
|
finally:
|
172
185
|
if base is not None:
|
173
|
-
base.
|
186
|
+
base.close()
|
@@ -42,13 +42,13 @@ class Chef
|
|
42
42
|
def dnf_command
|
43
43
|
# platform-python is used for system tools on RHEL 8 and is installed under /usr/libexec
|
44
44
|
@dnf_command ||= begin
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
cmd = which("platform-python", "python", "python3", "python2", "python2.7", extra_path: "/usr/libexec") do |f|
|
46
|
+
shell_out("#{f} -c 'import dnf'").exitstatus == 0
|
47
|
+
end
|
48
|
+
raise Chef::Exceptions::Package, "cannot find dnf libraries, you may need to use yum_package" unless cmd
|
49
49
|
|
50
|
-
|
51
|
-
|
50
|
+
"#{cmd} #{DNF_HELPER}"
|
51
|
+
end
|
52
52
|
end
|
53
53
|
|
54
54
|
def start
|
@@ -33,7 +33,7 @@ class Chef
|
|
33
33
|
def load_current_resource; end
|
34
34
|
|
35
35
|
action :create do
|
36
|
-
declare_resource(:template,
|
36
|
+
declare_resource(:template, ::File.join(new_resource.reposdir, "#{new_resource.repositoryid}.repo")) do
|
37
37
|
if template_available?(new_resource.source)
|
38
38
|
source new_resource.source
|
39
39
|
else
|
@@ -81,7 +81,7 @@ class Chef
|
|
81
81
|
only_if "yum repolist all | grep -P '^#{new_resource.repositoryid}([ \t]|$)'"
|
82
82
|
end
|
83
83
|
|
84
|
-
declare_resource(:file,
|
84
|
+
declare_resource(:file, ::File.join(new_resource.reposdir, "#{new_resource.repositoryid}.repo")) do
|
85
85
|
action :delete
|
86
86
|
notifies :create, "ruby_block[package-cache-reload-#{new_resource.repositoryid}]", :immediately
|
87
87
|
end
|
@@ -49,7 +49,7 @@ class Chef
|
|
49
49
|
|
50
50
|
To install a gem while #{ChefUtils::Dist::Infra::PRODUCT} is configuring the node (the converge phase), set the `compile_time` property to `false`:
|
51
51
|
```ruby
|
52
|
-
chef_gem '
|
52
|
+
chef_gem 'loofah' do
|
53
53
|
compile_time false
|
54
54
|
action :install
|
55
55
|
end
|
@@ -57,7 +57,7 @@ class Chef
|
|
57
57
|
|
58
58
|
To install a gem while the resource collection is being built (the compile phase), set the `compile_time` property to `true`:
|
59
59
|
```ruby
|
60
|
-
chef_gem '
|
60
|
+
chef_gem 'loofah' do
|
61
61
|
compile_time true
|
62
62
|
action :install
|
63
63
|
end
|
data/lib/chef/resource/file.rb
CHANGED
@@ -32,7 +32,7 @@ class Chef
|
|
32
32
|
|
33
33
|
provides :file
|
34
34
|
|
35
|
-
description "Use the **file** resource to manage files directly on a node."
|
35
|
+
description "Use the **file** resource to manage files directly on a node. Note: Use the **cookbook_file** resource to copy a file from a cookbook's `/files` directory. Use the **template** resource to create a file based on a template in a cookbook's `/templates` directory. And use the **remote_file** resource to transfer a file to a node from a remote location."
|
36
36
|
|
37
37
|
if ChefUtils.windows?
|
38
38
|
# Use Windows rights instead of standard *nix permissions
|
@@ -60,7 +60,7 @@ class Chef
|
|
60
60
|
|
61
61
|
unless casked?
|
62
62
|
converge_by("install cask #{new_resource.cask_name} #{new_resource.options}") do
|
63
|
-
shell_out!("#{new_resource.homebrew_path} cask
|
63
|
+
shell_out!("#{new_resource.homebrew_path} install --cask #{new_resource.cask_name} #{new_resource.options}",
|
64
64
|
user: new_resource.owner,
|
65
65
|
env: { "HOME" => ::Dir.home(new_resource.owner), "USER" => new_resource.owner },
|
66
66
|
cwd: ::Dir.home(new_resource.owner))
|
@@ -75,7 +75,7 @@ class Chef
|
|
75
75
|
|
76
76
|
if casked?
|
77
77
|
converge_by("uninstall cask #{new_resource.cask_name}") do
|
78
|
-
shell_out!("#{new_resource.homebrew_path} cask
|
78
|
+
shell_out!("#{new_resource.homebrew_path} uninstall --cask #{new_resource.cask_name}",
|
79
79
|
user: new_resource.owner,
|
80
80
|
env: { "HOME" => ::Dir.home(new_resource.owner), "USER" => new_resource.owner },
|
81
81
|
cwd: ::Dir.home(new_resource.owner))
|
@@ -93,7 +93,7 @@ class Chef
|
|
93
93
|
# @return [Boolean]
|
94
94
|
def casked?
|
95
95
|
unscoped_name = new_resource.cask_name.split("/").last
|
96
|
-
shell_out!("#{new_resource.homebrew_path} cask
|
96
|
+
shell_out!("#{new_resource.homebrew_path} list --cask 2>/dev/null",
|
97
97
|
user: new_resource.owner,
|
98
98
|
env: { "HOME" => ::Dir.home(new_resource.owner), "USER" => new_resource.owner },
|
99
99
|
cwd: ::Dir.home(new_resource.owner)).stdout.split.include?(unscoped_name)
|
@@ -26,7 +26,7 @@ class Chef
|
|
26
26
|
|
27
27
|
provides :http_request
|
28
28
|
|
29
|
-
description "Use the **http_request** resource to send an HTTP request (GET
|
29
|
+
description "Use the **http_request** resource to send an HTTP request (`GET`, `PUT`, `POST`, `DELETE`, `HEAD`, or `OPTIONS`) with an arbitrary message. This resource is often useful when custom callbacks are necessary."
|
30
30
|
|
31
31
|
default_action :get
|
32
32
|
allowed_actions :get, :patch, :put, :post, :delete, :head, :options
|
data/lib/chef/resource/locale.rb
CHANGED
@@ -125,7 +125,7 @@ class Chef
|
|
125
125
|
# @raise [Mixlib::ShellOut::ShellCommandFailed] not a supported language or locale
|
126
126
|
#
|
127
127
|
def generate_locales
|
128
|
-
shell_out!("locale-gen #{unavailable_locales.join(" ")}")
|
128
|
+
shell_out!("locale-gen #{unavailable_locales.join(" ")}", timeout: 1800)
|
129
129
|
end
|
130
130
|
|
131
131
|
# Sets the system locale for the current computer.
|
data/lib/chef/resource/mdadm.rb
CHANGED
@@ -36,7 +36,7 @@ class Chef
|
|
36
36
|
|
37
37
|
property :chunk, Integer,
|
38
38
|
default: 16,
|
39
|
-
description: "The chunk size. This property should not be used for a RAID 1 mirrored pair (i.e. when the level property is set to 1)."
|
39
|
+
description: "The chunk size. This property should not be used for a RAID 1 mirrored pair (i.e. when the `level` property is set to `1`)."
|
40
40
|
|
41
41
|
property :devices, Array,
|
42
42
|
default: lazy { [] },
|
@@ -63,7 +63,7 @@ class Chef
|
|
63
63
|
description: "An optional property to specify the name of the RAID device if it differs from the resource block's name."
|
64
64
|
|
65
65
|
property :layout, String,
|
66
|
-
description: "The RAID5 parity algorithm. Possible values: left-asymmetric (or la), left-symmetric (or ls), right-asymmetric (or ra), or right-symmetric (or rs)."
|
66
|
+
description: "The RAID5 parity algorithm. Possible values: `left-asymmetric` (or `la`), `left-symmetric` (or ls), `right-asymmetric` (or `ra`), or `right-symmetric` (or `rs`)."
|
67
67
|
|
68
68
|
action_class do
|
69
69
|
def load_current_resource
|
@@ -29,7 +29,7 @@ class Chef
|
|
29
29
|
|
30
30
|
provides :remote_directory
|
31
31
|
|
32
|
-
description "Use the **remote_directory** resource to incrementally transfer a directory from a cookbook to a node. The
|
32
|
+
description "Use the **remote_directory** resource to incrementally transfer a directory from a cookbook to a node. The directory that is copied from the cookbook should be located under `COOKBOOK_NAME/files/default/REMOTE_DIRECTORY`. The `remote_directory` resource will obey file specificity."
|
33
33
|
|
34
34
|
default_action :create
|
35
35
|
allowed_actions :create, :create_if_missing, :delete
|
data/lib/chef/resource/ruby.rb
CHANGED
@@ -25,11 +25,7 @@ class Chef
|
|
25
25
|
|
26
26
|
provides :ruby
|
27
27
|
|
28
|
-
description "Use the **ruby** resource to execute scripts using the Ruby interpreter. This"
|
29
|
-
" resource may also use any of the actions and properties that are available"\
|
30
|
-
" to the **execute** resource. Commands that are executed with this resource are (by"\
|
31
|
-
" their nature) not idempotent, as they are typically unique to the environment"\
|
32
|
-
" in which they are run. Use `not_if` and `only_if` to guard this resource for idempotence."
|
28
|
+
description "Use the **ruby** resource to execute scripts using the Ruby interpreter. This resource may also use any of the actions and properties that are available to the **execute** resource. Commands that are executed with this resource are (by their nature) not idempotent, as they are typically unique to the environment in which they are run. Use `not_if` and `only_if` to guard this resource for idempotence."
|
33
29
|
|
34
30
|
def initialize(name, run_context = nil)
|
35
31
|
super
|
@@ -28,7 +28,7 @@ class Chef
|
|
28
28
|
|
29
29
|
provides :ruby_block, target_mode: true
|
30
30
|
|
31
|
-
description "Use the **ruby_block** resource to execute Ruby code during a #{ChefUtils::Dist::Infra::PRODUCT} run. Ruby code in the ruby_block resource is evaluated with other resources during convergence, whereas Ruby code outside of a ruby_block resource is evaluated before other resources, as the recipe is compiled."
|
31
|
+
description "Use the **ruby_block** resource to execute Ruby code during a #{ChefUtils::Dist::Infra::PRODUCT} run. Ruby code in the `ruby_block` resource is evaluated with other resources during convergence, whereas Ruby code outside of a `ruby_block` resource is evaluated before other resources, as the recipe is compiled."
|
32
32
|
|
33
33
|
default_action :run
|
34
34
|
allowed_actions :create, :run
|
@@ -29,6 +29,11 @@ class Chef
|
|
29
29
|
property :full_name, String,
|
30
30
|
description: "The full name of the user.",
|
31
31
|
introduced: "14.6"
|
32
|
+
|
33
|
+
# Override the property from the parent class to coerce to integer.
|
34
|
+
property :uid, [ String, Integer, NilClass ], # nil for backwards compat
|
35
|
+
description: "The numeric user identifier.",
|
36
|
+
coerce: proc { |n| n && Integer(n) rescue n }
|
32
37
|
end
|
33
38
|
end
|
34
39
|
end
|
@@ -69,7 +69,7 @@ class Chef
|
|
69
69
|
description: "The password to access the source if it is a pfx file."
|
70
70
|
|
71
71
|
property :private_key_acl, Array,
|
72
|
-
description: "An array of 'domain
|
72
|
+
description: "An array of 'domain\\account' entries to be granted read-only access to the certificate's private key. Not idempotent."
|
73
73
|
|
74
74
|
property :store_name, String,
|
75
75
|
description: "The certificate store to manipulate.",
|
@@ -309,11 +309,7 @@ class Chef
|
|
309
309
|
# @raise [OpenSSL::PKCS12::PKCS12Error] When incorrect password is provided for PFX certificate
|
310
310
|
#
|
311
311
|
def fetch_cert_object(ext)
|
312
|
-
contents =
|
313
|
-
::File.binread(new_resource.source)
|
314
|
-
else
|
315
|
-
::File.read(new_resource.source)
|
316
|
-
end
|
312
|
+
contents = ::File.binread(new_resource.source)
|
317
313
|
|
318
314
|
case ext
|
319
315
|
when ".pfx"
|
@@ -330,12 +326,6 @@ class Chef
|
|
330
326
|
end
|
331
327
|
end
|
332
328
|
|
333
|
-
# @return [Boolean] Whether the certificate file is binary encoded or not
|
334
|
-
#
|
335
|
-
def binary_cert?
|
336
|
-
shell_out!("file -b --mime-encoding #{new_resource.source}").stdout.strip == "binary"
|
337
|
-
end
|
338
|
-
|
339
329
|
# Imports the certificate object into cert store
|
340
330
|
#
|
341
331
|
# @param cert_objs [OpenSSL::X509::Certificate] Object containing certificate's attributes
|
@@ -50,6 +50,11 @@ class Chef
|
|
50
50
|
|
51
51
|
# http://linux.die.net/man/5/yum.conf as well as
|
52
52
|
# http://dnf.readthedocs.io/en/latest/conf_ref.html
|
53
|
+
property :reposdir, String,
|
54
|
+
description: "The directory where the Yum repository files should be stored",
|
55
|
+
default: "/etc/yum.repos.d/",
|
56
|
+
introduced: "16.9"
|
57
|
+
|
53
58
|
property :baseurl, [String, Array],
|
54
59
|
description: "URL to the directory where the Yum repository's `repodata` directory lives. Can be an `http://`, `https://` or a `ftp://` URLs. You can specify multiple URLs in one `baseurl` statement."
|
55
60
|
|
data/lib/chef/version.rb
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -91,7 +91,6 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
91
91
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
92
92
|
dnf_package.run_action(:install)
|
93
93
|
expect(dnf_package.updated_by_last_action?).to be false
|
94
|
-
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
95
94
|
end
|
96
95
|
|
97
96
|
it "does not install twice" do
|
@@ -128,6 +127,105 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
128
127
|
end
|
129
128
|
end
|
130
129
|
|
130
|
+
context "expanded idempotency checks with version variants" do
|
131
|
+
%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|
|
132
|
+
it "installs the rpm when #{vstring} is in the package_name" do
|
133
|
+
flush_cache
|
134
|
+
dnf_package.package_name("chef_rpm-#{vstring}")
|
135
|
+
dnf_package.run_action(:install)
|
136
|
+
expect(dnf_package.updated_by_last_action?).to be true
|
137
|
+
end
|
138
|
+
|
139
|
+
it "is idempotent when #{vstring} is in the package_name" do
|
140
|
+
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
141
|
+
dnf_package.package_name("chef_rpm-#{vstring}")
|
142
|
+
dnf_package.run_action(:install)
|
143
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
144
|
+
end
|
145
|
+
|
146
|
+
it "installs the rpm when #{vstring} is in the version property" do
|
147
|
+
flush_cache
|
148
|
+
dnf_package.package_name("chef_rpm")
|
149
|
+
dnf_package.version(vstring)
|
150
|
+
dnf_package.run_action(:install)
|
151
|
+
expect(dnf_package.updated_by_last_action?).to be true
|
152
|
+
end
|
153
|
+
|
154
|
+
it "is idempotent when #{vstring} is in the version property" do
|
155
|
+
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
156
|
+
dnf_package.package_name("chef_rpm")
|
157
|
+
dnf_package.version(vstring)
|
158
|
+
dnf_package.run_action(:install)
|
159
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
160
|
+
end
|
161
|
+
|
162
|
+
it "upgrades the rpm when #{vstring} is in the package_name" do
|
163
|
+
flush_cache
|
164
|
+
dnf_package.package_name("chef_rpm-#{vstring}")
|
165
|
+
dnf_package.run_action(:upgrade)
|
166
|
+
expect(dnf_package.updated_by_last_action?).to be true
|
167
|
+
end
|
168
|
+
|
169
|
+
it "is idempotent when #{vstring} is in the package_name" do
|
170
|
+
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
171
|
+
dnf_package.package_name("chef_rpm-#{vstring}")
|
172
|
+
dnf_package.run_action(:upgrade)
|
173
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
174
|
+
end
|
175
|
+
|
176
|
+
it "upgrades the rpm when #{vstring} is in the version property" do
|
177
|
+
flush_cache
|
178
|
+
dnf_package.package_name("chef_rpm")
|
179
|
+
dnf_package.version(vstring)
|
180
|
+
dnf_package.run_action(:upgrade)
|
181
|
+
expect(dnf_package.updated_by_last_action?).to be true
|
182
|
+
end
|
183
|
+
|
184
|
+
it "is idempotent when #{vstring} is in the version property" do
|
185
|
+
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
186
|
+
dnf_package.package_name("chef_rpm")
|
187
|
+
dnf_package.version(vstring)
|
188
|
+
dnf_package.run_action(:upgrade)
|
189
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
%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|
|
194
|
+
it "is idempotent when #{vstring} is in the version property and there is a candidate version" do
|
195
|
+
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
196
|
+
dnf_package.package_name("chef_rpm")
|
197
|
+
dnf_package.version(vstring)
|
198
|
+
dnf_package.run_action(:install)
|
199
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
200
|
+
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
%w{1.2 1.2-1 1.2-* 0:1.2 0:1.2-1 *:1.2-*}.each do |vstring|
|
205
|
+
it "is idempotent when #{vstring} is in the version property on upgrade and it doesn't match the candidate version" do
|
206
|
+
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
207
|
+
dnf_package.package_name("chef_rpm")
|
208
|
+
dnf_package.version(vstring)
|
209
|
+
dnf_package.run_action(:upgrade)
|
210
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
211
|
+
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
%w{1* 1*-1 1*-* 0:1* 0:1*-1 *:1*-*}.each do |vstring|
|
216
|
+
it "upgrades when #{vstring} is in the version property on upgrade and it matches the candidate version" do
|
217
|
+
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
218
|
+
dnf_package.package_name("chef_rpm")
|
219
|
+
dnf_package.version(vstring)
|
220
|
+
dnf_package.run_action(:upgrade)
|
221
|
+
expect(dnf_package.updated_by_last_action?).to be true
|
222
|
+
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
223
|
+
dnf_package.run_action(:upgrade)
|
224
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
131
229
|
context "with versions or globs in the name" do
|
132
230
|
it "works with a version" do
|
133
231
|
flush_cache
|
@@ -135,6 +233,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
135
233
|
dnf_package.run_action(:install)
|
136
234
|
expect(dnf_package.updated_by_last_action?).to be true
|
137
235
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
236
|
+
dnf_package.run_action(:install)
|
237
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
138
238
|
end
|
139
239
|
|
140
240
|
it "works with an older version" do
|
@@ -143,6 +243,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
143
243
|
dnf_package.run_action(:install)
|
144
244
|
expect(dnf_package.updated_by_last_action?).to be true
|
145
245
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
246
|
+
dnf_package.run_action(:install)
|
247
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
146
248
|
end
|
147
249
|
|
148
250
|
it "works with an evra" do
|
@@ -151,6 +253,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
151
253
|
dnf_package.run_action(:install)
|
152
254
|
expect(dnf_package.updated_by_last_action?).to be true
|
153
255
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
256
|
+
dnf_package.run_action(:install)
|
257
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
154
258
|
end
|
155
259
|
|
156
260
|
it "works with version and release" do
|
@@ -159,6 +263,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
159
263
|
dnf_package.run_action(:install)
|
160
264
|
expect(dnf_package.updated_by_last_action?).to be true
|
161
265
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
266
|
+
dnf_package.run_action(:install)
|
267
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
162
268
|
end
|
163
269
|
|
164
270
|
it "works with a version glob" do
|
@@ -167,6 +273,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
167
273
|
dnf_package.run_action(:install)
|
168
274
|
expect(dnf_package.updated_by_last_action?).to be true
|
169
275
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
276
|
+
dnf_package.run_action(:install)
|
277
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
170
278
|
end
|
171
279
|
|
172
280
|
it "works with a name glob + version glob" do
|
@@ -175,6 +283,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
175
283
|
dnf_package.run_action(:install)
|
176
284
|
expect(dnf_package.updated_by_last_action?).to be true
|
177
285
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
286
|
+
dnf_package.run_action(:install)
|
287
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
178
288
|
end
|
179
289
|
|
180
290
|
it "upgrades when the installed version does not match the version string" do
|
@@ -183,6 +293,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
183
293
|
dnf_package.run_action(:install)
|
184
294
|
expect(dnf_package.updated_by_last_action?).to be true
|
185
295
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}")
|
296
|
+
dnf_package.run_action(:install)
|
297
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
186
298
|
end
|
187
299
|
|
188
300
|
it "downgrades when the installed version is higher than the package_name version" do
|
@@ -191,6 +303,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
191
303
|
dnf_package.run_action(:install)
|
192
304
|
expect(dnf_package.updated_by_last_action?).to be true
|
193
305
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
306
|
+
dnf_package.run_action(:install)
|
307
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
194
308
|
end
|
195
309
|
end
|
196
310
|
|
@@ -203,6 +317,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
203
317
|
dnf_package.run_action(:install)
|
204
318
|
expect(dnf_package.updated_by_last_action?).to be true
|
205
319
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
320
|
+
dnf_package.run_action(:install)
|
321
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
206
322
|
end
|
207
323
|
|
208
324
|
it "matches with a glob" do
|
@@ -212,6 +328,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
212
328
|
dnf_package.run_action(:install)
|
213
329
|
expect(dnf_package.updated_by_last_action?).to be true
|
214
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}$")
|
331
|
+
dnf_package.run_action(:install)
|
332
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
215
333
|
end
|
216
334
|
|
217
335
|
it "matches the vr" do
|
@@ -221,6 +339,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
221
339
|
dnf_package.run_action(:install)
|
222
340
|
expect(dnf_package.updated_by_last_action?).to be true
|
223
341
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
342
|
+
dnf_package.run_action(:install)
|
343
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
224
344
|
end
|
225
345
|
|
226
346
|
it "matches the evr" do
|
@@ -230,6 +350,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
230
350
|
dnf_package.run_action(:install)
|
231
351
|
expect(dnf_package.updated_by_last_action?).to be true
|
232
352
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
353
|
+
dnf_package.run_action(:install)
|
354
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
233
355
|
end
|
234
356
|
|
235
357
|
it "matches with a vr glob", :rhel_gte_8 do
|
@@ -239,6 +361,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
239
361
|
dnf_package.run_action(:install)
|
240
362
|
expect(dnf_package.updated_by_last_action?).to be true
|
241
363
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
364
|
+
dnf_package.run_action(:install)
|
365
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
242
366
|
end
|
243
367
|
|
244
368
|
it "matches with an evr glob", :rhel_gte_8 do
|
@@ -248,6 +372,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
248
372
|
dnf_package.run_action(:install)
|
249
373
|
expect(dnf_package.updated_by_last_action?).to be true
|
250
374
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
375
|
+
dnf_package.run_action(:install)
|
376
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
251
377
|
end
|
252
378
|
end
|
253
379
|
|
@@ -260,6 +386,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
260
386
|
dnf_package.run_action(:install)
|
261
387
|
expect(dnf_package.updated_by_last_action?).to be true
|
262
388
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
389
|
+
dnf_package.run_action(:install)
|
390
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
263
391
|
end
|
264
392
|
end
|
265
393
|
|
@@ -270,6 +398,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
270
398
|
dnf_package.run_action(:install)
|
271
399
|
expect(dnf_package.updated_by_last_action?).to be true
|
272
400
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
401
|
+
dnf_package.run_action(:install)
|
402
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
273
403
|
end
|
274
404
|
|
275
405
|
it "installs with 32-bit arch in the name" do
|
@@ -278,6 +408,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
278
408
|
dnf_package.run_action(:install)
|
279
409
|
expect(dnf_package.updated_by_last_action?).to be true
|
280
410
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.i686$")
|
411
|
+
dnf_package.run_action(:install)
|
412
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
281
413
|
end
|
282
414
|
|
283
415
|
it "installs with 64-bit arch in the property" do
|
@@ -287,6 +419,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
287
419
|
dnf_package.run_action(:install)
|
288
420
|
expect(dnf_package.updated_by_last_action?).to be true
|
289
421
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
422
|
+
dnf_package.run_action(:install)
|
423
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
290
424
|
end
|
291
425
|
|
292
426
|
it "installs with 32-bit arch in the property" do
|
@@ -296,6 +430,30 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
296
430
|
dnf_package.run_action(:install)
|
297
431
|
expect(dnf_package.updated_by_last_action?).to be true
|
298
432
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.i686$")
|
433
|
+
dnf_package.run_action(:install)
|
434
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
435
|
+
end
|
436
|
+
|
437
|
+
it "installs when the 32-bit arch is in the name and the version is in the property" do
|
438
|
+
flush_cache
|
439
|
+
dnf_package.package_name("chef_rpm.i686")
|
440
|
+
dnf_package.version("1.10-1")
|
441
|
+
dnf_package.run_action(:install)
|
442
|
+
expect(dnf_package.updated_by_last_action?).to be true
|
443
|
+
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.i686$")
|
444
|
+
dnf_package.run_action(:install)
|
445
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
446
|
+
end
|
447
|
+
|
448
|
+
it "installs when the 64-bit arch is in the name and the version is in the property" do
|
449
|
+
flush_cache
|
450
|
+
dnf_package.package_name("chef_rpm.#{pkg_arch}")
|
451
|
+
dnf_package.version("1.10-1")
|
452
|
+
dnf_package.run_action(:install)
|
453
|
+
expect(dnf_package.updated_by_last_action?).to be true
|
454
|
+
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
455
|
+
dnf_package.run_action(:install)
|
456
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
299
457
|
end
|
300
458
|
end
|
301
459
|
|
@@ -306,6 +464,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
306
464
|
dnf_package.run_action(:install)
|
307
465
|
expect(dnf_package.updated_by_last_action?).to be true
|
308
466
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
467
|
+
dnf_package.run_action(:install)
|
468
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
309
469
|
end
|
310
470
|
|
311
471
|
it "when it is met, it does nothing" do
|
@@ -330,6 +490,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
330
490
|
dnf_package.run_action(:install)
|
331
491
|
expect(dnf_package.updated_by_last_action?).to be true
|
332
492
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
493
|
+
dnf_package.run_action(:install)
|
494
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
333
495
|
end
|
334
496
|
|
335
497
|
it "when it is not met by an installed rpm, it upgrades" do
|
@@ -338,6 +500,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
338
500
|
dnf_package.run_action(:install)
|
339
501
|
expect(dnf_package.updated_by_last_action?).to be true
|
340
502
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
503
|
+
dnf_package.run_action(:install)
|
504
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
341
505
|
end
|
342
506
|
|
343
507
|
it "with an equality constraint, when it is not met by an installed rpm, it upgrades" do
|
@@ -346,6 +510,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
346
510
|
dnf_package.run_action(:install)
|
347
511
|
expect(dnf_package.updated_by_last_action?).to be true
|
348
512
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
513
|
+
dnf_package.run_action(:install)
|
514
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
349
515
|
end
|
350
516
|
|
351
517
|
it "with an equality constraint, when it is met by an installed rpm, it does nothing" do
|
@@ -382,6 +548,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
382
548
|
dnf_package.run_action(:install)
|
383
549
|
expect(dnf_package.updated_by_last_action?).to be true
|
384
550
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
551
|
+
dnf_package.run_action(:install)
|
552
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
385
553
|
end
|
386
554
|
|
387
555
|
it "with a less than constraint, when the install version matches, it does nothing" do
|
@@ -398,6 +566,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
398
566
|
dnf_package.run_action(:install)
|
399
567
|
expect(dnf_package.updated_by_last_action?).to be true
|
400
568
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
569
|
+
dnf_package.run_action(:install)
|
570
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
401
571
|
end
|
402
572
|
end
|
403
573
|
|
@@ -424,6 +594,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
424
594
|
dnf_package.run_action(:install)
|
425
595
|
expect(dnf_package.updated_by_last_action?).to be true
|
426
596
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
597
|
+
dnf_package.run_action(:install)
|
598
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
427
599
|
end
|
428
600
|
|
429
601
|
it "installs the package when the name is a path to a file" do
|
@@ -432,6 +604,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
432
604
|
dnf_package.run_action(:install)
|
433
605
|
expect(dnf_package.updated_by_last_action?).to be true
|
434
606
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
607
|
+
dnf_package.run_action(:install)
|
608
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
435
609
|
end
|
436
610
|
|
437
611
|
it "downgrade on a local file with allow_downgrade true works" do
|
@@ -441,6 +615,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
441
615
|
dnf_package.run_action(:install)
|
442
616
|
expect(dnf_package.updated_by_last_action?).to be true
|
443
617
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
618
|
+
dnf_package.run_action(:install)
|
619
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
444
620
|
end
|
445
621
|
|
446
622
|
it "does not downgrade the package with :install" do
|
@@ -475,15 +651,6 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
475
651
|
expect(dnf_package.updated_by_last_action?).to be false
|
476
652
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
477
653
|
end
|
478
|
-
|
479
|
-
it "is idempotent when the package is already installed and there is a version string with arch" do
|
480
|
-
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
481
|
-
dnf_package.version "1.2-1.#{pkg_arch}"
|
482
|
-
dnf_package.package_name("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
483
|
-
dnf_package.run_action(:install)
|
484
|
-
expect(dnf_package.updated_by_last_action?).to be false
|
485
|
-
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
486
|
-
end
|
487
654
|
end
|
488
655
|
|
489
656
|
context "with no available version" do
|
@@ -502,6 +669,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
502
669
|
dnf_package.run_action(:install)
|
503
670
|
expect(dnf_package.updated_by_last_action?).to be true
|
504
671
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
672
|
+
dnf_package.run_action(:install)
|
673
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
505
674
|
end
|
506
675
|
end
|
507
676
|
|
@@ -513,6 +682,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
513
682
|
expect(dnf_package.updated_by_last_action?).to be true
|
514
683
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.#{pkg_arch}$/)
|
515
684
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.i686$/)
|
685
|
+
dnf_package.run_action(:install)
|
686
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
516
687
|
end
|
517
688
|
|
518
689
|
it "does nothing if both are installed" do
|
@@ -530,6 +701,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
530
701
|
expect(dnf_package.updated_by_last_action?).to be true
|
531
702
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.#{pkg_arch}$/)
|
532
703
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.i686$/)
|
704
|
+
dnf_package.run_action(:install)
|
705
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
533
706
|
end
|
534
707
|
|
535
708
|
it "installs the first rpm if the second is installed" do
|
@@ -539,6 +712,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
539
712
|
expect(dnf_package.updated_by_last_action?).to be true
|
540
713
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.#{pkg_arch}$/)
|
541
714
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.i686$/)
|
715
|
+
dnf_package.run_action(:install)
|
716
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
542
717
|
end
|
543
718
|
|
544
719
|
# unlikely to work consistently correct, okay to deprecate the arch-array in favor of the arch in the name
|
@@ -550,6 +725,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
550
725
|
expect(dnf_package.updated_by_last_action?).to be true
|
551
726
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.#{pkg_arch}$/)
|
552
727
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.i686$/)
|
728
|
+
dnf_package.run_action(:install)
|
729
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
553
730
|
end
|
554
731
|
|
555
732
|
# unlikely to work consistently correct, okay to deprecate the arch-array in favor of the arch in the name
|
@@ -561,6 +738,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
561
738
|
expect(dnf_package.updated_by_last_action?).to be true
|
562
739
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.#{pkg_arch}$/)
|
563
740
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.i686$/)
|
741
|
+
dnf_package.run_action(:install)
|
742
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
564
743
|
end
|
565
744
|
|
566
745
|
# unlikely to work consistently correct, okay to deprecate the arch-array in favor of the arch in the name
|
@@ -572,6 +751,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
572
751
|
expect(dnf_package.updated_by_last_action?).to be true
|
573
752
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.#{pkg_arch}$/)
|
574
753
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match(/^chef_rpm-1.10-1.i686$/)
|
754
|
+
dnf_package.run_action(:install)
|
755
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
575
756
|
end
|
576
757
|
|
577
758
|
# unlikely to work consistently correct, okay to deprecate the arch-array in favor of the arch in the name
|
@@ -597,6 +778,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
597
778
|
dnf_package.run_action(:install)
|
598
779
|
expect(dnf_package.updated_by_last_action?).to be true
|
599
780
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
781
|
+
dnf_package.run_action(:install)
|
782
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
600
783
|
end
|
601
784
|
|
602
785
|
it "should work to enable a disabled repo" do
|
@@ -608,6 +791,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
608
791
|
dnf_package.run_action(:install)
|
609
792
|
expect(dnf_package.updated_by_last_action?).to be true
|
610
793
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
794
|
+
dnf_package.run_action(:install)
|
795
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
611
796
|
end
|
612
797
|
|
613
798
|
it "when an idempotent install action is run, does not leave repos disabled" do
|
@@ -628,6 +813,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
628
813
|
dnf_package.run_action(:install)
|
629
814
|
expect(dnf_package.updated_by_last_action?).to be true
|
630
815
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
816
|
+
dnf_package.run_action(:install)
|
817
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
631
818
|
end
|
632
819
|
end
|
633
820
|
end
|
@@ -640,6 +827,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
640
827
|
dnf_package.run_action(:install)
|
641
828
|
expect(dnf_package.updated_by_last_action?).to be true
|
642
829
|
expect(shell_out("rpm -q chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}")
|
830
|
+
dnf_package.run_action(:install)
|
831
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
643
832
|
end
|
644
833
|
|
645
834
|
it "throws a deprecation warning with allow_downgrade" do
|
@@ -647,10 +836,12 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
647
836
|
expect(Chef).to receive(:deprecated).with(:dnf_package_allow_downgrade, /^the allow_downgrade property on the dnf_package provider is not used/)
|
648
837
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
649
838
|
dnf_package.version("1.2")
|
650
|
-
dnf_package.run_action(:install)
|
651
839
|
dnf_package.allow_downgrade true
|
840
|
+
dnf_package.run_action(:install)
|
652
841
|
expect(dnf_package.updated_by_last_action?).to be true
|
653
842
|
expect(shell_out("rpm -q chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}")
|
843
|
+
dnf_package.run_action(:install)
|
844
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
654
845
|
end
|
655
846
|
end
|
656
847
|
|
@@ -663,6 +854,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
663
854
|
dnf_package.run_action(:upgrade)
|
664
855
|
expect(dnf_package.updated_by_last_action?).to be true
|
665
856
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
857
|
+
dnf_package.run_action(:upgrade)
|
858
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
666
859
|
end
|
667
860
|
|
668
861
|
it "installs the package when the name is a path to a file" do
|
@@ -671,6 +864,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
671
864
|
dnf_package.run_action(:upgrade)
|
672
865
|
expect(dnf_package.updated_by_last_action?).to be true
|
673
866
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
867
|
+
dnf_package.run_action(:upgrade)
|
868
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
674
869
|
end
|
675
870
|
|
676
871
|
it "downgrades the package when allow_downgrade is true" do
|
@@ -679,6 +874,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
679
874
|
dnf_package.run_action(:upgrade)
|
680
875
|
expect(dnf_package.updated_by_last_action?).to be true
|
681
876
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
877
|
+
dnf_package.run_action(:upgrade)
|
878
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
682
879
|
end
|
683
880
|
|
684
881
|
it "upgrades the package" do
|
@@ -687,6 +884,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
687
884
|
dnf_package.run_action(:upgrade)
|
688
885
|
expect(dnf_package.updated_by_last_action?).to be true
|
689
886
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
887
|
+
dnf_package.run_action(:upgrade)
|
888
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
690
889
|
end
|
691
890
|
|
692
891
|
it "is idempotent when the package is already installed" do
|
@@ -715,32 +914,104 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
715
914
|
dnf_package.run_action(:upgrade)
|
716
915
|
expect(dnf_package.updated_by_last_action?).to be true
|
717
916
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
917
|
+
dnf_package.run_action(:upgrade)
|
918
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
718
919
|
end
|
719
920
|
end
|
720
921
|
|
721
922
|
context "version pinning" do
|
722
|
-
it "with
|
923
|
+
it "with a full version pin it installs a later package" do
|
723
924
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
724
|
-
dnf_package.package_name("chef_rpm
|
925
|
+
dnf_package.package_name("chef_rpm")
|
926
|
+
dnf_package.version("1.10-1")
|
725
927
|
dnf_package.run_action(:upgrade)
|
726
928
|
expect(dnf_package.updated_by_last_action?).to be true
|
727
929
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
930
|
+
dnf_package.run_action(:upgrade)
|
931
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
728
932
|
end
|
729
933
|
|
730
|
-
it "with a
|
934
|
+
it "with a full version pin in the name it downgrades the package" do
|
935
|
+
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
936
|
+
dnf_package.package_name("chef_rpm")
|
937
|
+
dnf_package.version("1.2-1")
|
938
|
+
dnf_package.run_action(:upgrade)
|
939
|
+
expect(dnf_package.updated_by_last_action?).to be true
|
940
|
+
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
941
|
+
dnf_package.run_action(:upgrade)
|
942
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
943
|
+
end
|
944
|
+
|
945
|
+
it "with a partial (no release) version pin it installs a later package" do
|
731
946
|
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
732
|
-
dnf_package.package_name("chef_rpm
|
947
|
+
dnf_package.package_name("chef_rpm")
|
948
|
+
dnf_package.version("1.10")
|
949
|
+
dnf_package.run_action(:upgrade)
|
950
|
+
expect(dnf_package.updated_by_last_action?).to be true
|
951
|
+
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
952
|
+
dnf_package.run_action(:upgrade)
|
953
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
954
|
+
end
|
955
|
+
|
956
|
+
it "with a partial (no release) version pin in the name it downgrades the package" do
|
957
|
+
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
958
|
+
dnf_package.package_name("chef_rpm")
|
959
|
+
dnf_package.version("1.2")
|
960
|
+
dnf_package.run_action(:upgrade)
|
961
|
+
expect(dnf_package.updated_by_last_action?).to be true
|
962
|
+
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
963
|
+
dnf_package.run_action(:upgrade)
|
964
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
965
|
+
end
|
966
|
+
|
967
|
+
it "with a full version pin it installs a later package" do
|
968
|
+
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
969
|
+
dnf_package.package_name("chef_rpm-1.10-1")
|
970
|
+
dnf_package.run_action(:upgrade)
|
971
|
+
expect(dnf_package.updated_by_last_action?).to be true
|
972
|
+
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
973
|
+
dnf_package.run_action(:upgrade)
|
974
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
975
|
+
end
|
976
|
+
|
977
|
+
it "with a full version pin in the name it downgrades the package" do
|
978
|
+
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
979
|
+
dnf_package.package_name("chef_rpm-1.2-1")
|
980
|
+
dnf_package.run_action(:upgrade)
|
981
|
+
expect(dnf_package.updated_by_last_action?).to be true
|
982
|
+
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
983
|
+
dnf_package.run_action(:upgrade)
|
984
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
985
|
+
end
|
986
|
+
|
987
|
+
it "with a partial (no release) version pin it installs a later package" do
|
988
|
+
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
989
|
+
dnf_package.package_name("chef_rpm-1.10")
|
733
990
|
dnf_package.run_action(:upgrade)
|
734
991
|
expect(dnf_package.updated_by_last_action?).to be true
|
735
992
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
993
|
+
dnf_package.run_action(:upgrade)
|
994
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
736
995
|
end
|
737
996
|
|
738
|
-
it "with
|
997
|
+
it "with a partial (no release) version pin in the name it downgrades the package" do
|
739
998
|
preinstall("chef_rpm-1.10-1.#{pkg_arch}.rpm")
|
740
999
|
dnf_package.package_name("chef_rpm-1.2")
|
741
1000
|
dnf_package.run_action(:upgrade)
|
742
1001
|
expect(dnf_package.updated_by_last_action?).to be true
|
743
1002
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
1003
|
+
dnf_package.run_action(:upgrade)
|
1004
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
1005
|
+
end
|
1006
|
+
|
1007
|
+
it "with a prco equality pin in the name it upgrades a prior package" do
|
1008
|
+
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
|
1009
|
+
dnf_package.package_name("chef_rpm = 1.10")
|
1010
|
+
dnf_package.run_action(:upgrade)
|
1011
|
+
expect(dnf_package.updated_by_last_action?).to be true
|
1012
|
+
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
1013
|
+
dnf_package.run_action(:upgrade)
|
1014
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
744
1015
|
end
|
745
1016
|
|
746
1017
|
it "with a prco equality pin in the name it downgrades a later package" do
|
@@ -749,6 +1020,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
749
1020
|
dnf_package.run_action(:upgrade)
|
750
1021
|
expect(dnf_package.updated_by_last_action?).to be true
|
751
1022
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
1023
|
+
dnf_package.run_action(:upgrade)
|
1024
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
752
1025
|
end
|
753
1026
|
|
754
1027
|
it "with a > pin in the name and no rpm installed it installs" do
|
@@ -757,6 +1030,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
757
1030
|
dnf_package.run_action(:upgrade)
|
758
1031
|
expect(dnf_package.updated_by_last_action?).to be true
|
759
1032
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
1033
|
+
dnf_package.run_action(:upgrade)
|
1034
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
760
1035
|
end
|
761
1036
|
|
762
1037
|
it "with a < pin in the name and no rpm installed it installs" do
|
@@ -765,6 +1040,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
765
1040
|
dnf_package.run_action(:upgrade)
|
766
1041
|
expect(dnf_package.updated_by_last_action?).to be true
|
767
1042
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
1043
|
+
dnf_package.run_action(:upgrade)
|
1044
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
768
1045
|
end
|
769
1046
|
|
770
1047
|
it "with a > pin in the name and matching rpm installed it does nothing" do
|
@@ -789,6 +1066,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
789
1066
|
dnf_package.run_action(:upgrade)
|
790
1067
|
expect(dnf_package.updated_by_last_action?).to be true
|
791
1068
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
1069
|
+
dnf_package.run_action(:upgrade)
|
1070
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
792
1071
|
end
|
793
1072
|
|
794
1073
|
it "with a < pin in the name and non-matching rpm installed it downgrades" do
|
@@ -797,6 +1076,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
797
1076
|
dnf_package.run_action(:upgrade)
|
798
1077
|
expect(dnf_package.updated_by_last_action?).to be true
|
799
1078
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
|
1079
|
+
dnf_package.run_action(:upgrade)
|
1080
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
800
1081
|
end
|
801
1082
|
end
|
802
1083
|
end
|
@@ -833,6 +1114,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
833
1114
|
dnf_package.run_action(:remove)
|
834
1115
|
expect(dnf_package.updated_by_last_action?).to be true
|
835
1116
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
|
1117
|
+
dnf_package.run_action(:remove)
|
1118
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
836
1119
|
end
|
837
1120
|
|
838
1121
|
it "removes the package if the i686 package is installed", :intel_64bit do
|
@@ -841,6 +1124,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
841
1124
|
dnf_package.run_action(:remove)
|
842
1125
|
expect(dnf_package.updated_by_last_action?).to be true
|
843
1126
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
|
1127
|
+
dnf_package.run_action(:remove)
|
1128
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
844
1129
|
end
|
845
1130
|
|
846
1131
|
it "removes the package if the prior version i686 package is installed", :intel_64bit do
|
@@ -849,6 +1134,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
849
1134
|
dnf_package.run_action(:remove)
|
850
1135
|
expect(dnf_package.updated_by_last_action?).to be true
|
851
1136
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
|
1137
|
+
dnf_package.run_action(:remove)
|
1138
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
852
1139
|
end
|
853
1140
|
end
|
854
1141
|
|
@@ -866,6 +1153,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
866
1153
|
dnf_package.run_action(:remove)
|
867
1154
|
expect(dnf_package.updated_by_last_action?).to be true
|
868
1155
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
|
1156
|
+
dnf_package.run_action(:remove)
|
1157
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
869
1158
|
end
|
870
1159
|
|
871
1160
|
it "removes the package if the prior version package is installed" do
|
@@ -873,6 +1162,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
873
1162
|
dnf_package.run_action(:remove)
|
874
1163
|
expect(dnf_package.updated_by_last_action?).to be true
|
875
1164
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
|
1165
|
+
dnf_package.run_action(:remove)
|
1166
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
876
1167
|
end
|
877
1168
|
|
878
1169
|
it "does nothing if the i686 package is installed" do
|
@@ -897,6 +1188,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
897
1188
|
dnf_package.run_action(:remove)
|
898
1189
|
expect(dnf_package.updated_by_last_action?).to be true
|
899
1190
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
|
1191
|
+
dnf_package.run_action(:remove)
|
1192
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
900
1193
|
end
|
901
1194
|
end
|
902
1195
|
|
@@ -907,6 +1200,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
907
1200
|
dnf_package.run_action(:remove)
|
908
1201
|
expect(dnf_package.updated_by_last_action?).to be true
|
909
1202
|
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^package chef_rpm is not installed$")
|
1203
|
+
dnf_package.run_action(:remove)
|
1204
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
910
1205
|
end
|
911
1206
|
end
|
912
1207
|
end
|
@@ -926,6 +1221,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
926
1221
|
dnf_package.run_action(:lock)
|
927
1222
|
expect(dnf_package.updated_by_last_action?).to be true
|
928
1223
|
expect(shell_out("dnf versionlock list").stdout.chomp).to match("^chef_rpm-0:")
|
1224
|
+
dnf_package.run_action(:lock)
|
1225
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
929
1226
|
end
|
930
1227
|
|
931
1228
|
it "does not lock if its already locked" do
|
@@ -944,6 +1241,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
944
1241
|
dnf_package.run_action(:unlock)
|
945
1242
|
expect(dnf_package.updated_by_last_action?).to be true
|
946
1243
|
expect(shell_out("dnf versionlock list").stdout.chomp).not_to match("^chef_rpm-0:")
|
1244
|
+
dnf_package.run_action(:unlock)
|
1245
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
947
1246
|
end
|
948
1247
|
|
949
1248
|
it "does not unlock an already locked rpm" do
|
@@ -960,6 +1259,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
960
1259
|
dnf_package.run_action(:lock)
|
961
1260
|
expect(dnf_package.updated_by_last_action?).to be true
|
962
1261
|
expect(shell_out("dnf versionlock list").stdout.chomp).to match("^chef_rpm-0:")
|
1262
|
+
dnf_package.run_action(:lock)
|
1263
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
963
1264
|
end
|
964
1265
|
|
965
1266
|
it "check that we can unlock based on provides" do
|
@@ -969,6 +1270,8 @@ describe Chef::Resource::DnfPackage, :requires_root, external: exclude_test do
|
|
969
1270
|
dnf_package.run_action(:unlock)
|
970
1271
|
expect(dnf_package.updated_by_last_action?).to be true
|
971
1272
|
expect(shell_out("dnf versionlock list").stdout.chomp).not_to match("^chef_rpm-0:")
|
1273
|
+
dnf_package.run_action(:unlock)
|
1274
|
+
expect(dnf_package.updated_by_last_action?).to be false
|
972
1275
|
end
|
973
1276
|
end
|
974
1277
|
end
|