diff --git a/.msync.yml b/.msync.yml
index 43966c2f..a83abd9b 100644
--- a/.msync.yml
+++ b/.msync.yml
@@ -2,4 +2,4 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
-modulesync_config_version: '4.2.0'
+modulesync_config_version: '5.1.0'
diff --git a/.puppet-lint.rc b/.puppet-lint.rc
new file mode 100644
index 00000000..02a3e71d
--- /dev/null
+++ b/.puppet-lint.rc
@@ -0,0 +1 @@
+--fail-on-warnings
diff --git a/.sync.yml b/.sync.yml
index 85de65aa..ba4c3695 100644
--- a/.sync.yml
+++ b/.sync.yml
@@ -1,8 +1,7 @@
-.travis.yml:
- docker_sets:
- - set: centos6-64
- - set: centos7-64
- - set: centos8-64
- secure: "iItNJ/PlMvdSiYjtXWJkS69mF/4XUriTRC6axFoiTgX8BzGNWA1U/anENNyzmhRKcH/Nc0erVeau+RX8vyJ0HmIJOCvYfq5Q/SQWex1fDXLe/UYJkAEWwmeIOVSF2nTEUPDvDn/d6bNEdULw5yrNn1dT8eLqIIXl6/nThdpiS917BX6CeYdojr/mISrLsvihuB5DQRdVzH+hK1bXcECihnOfNH9lQ0lZ2v2ohJiLJL0DadDg0YMMeJMlP7CnBZzRs7fhTPdLMjzCvysef9nqBYRlGBRUn+CaQ4VoQZlWB1JchJup4qCGeU9ANkb8gdKYTy1kFkBrEDuqlUUuuTTMhDpQ+2fGF32zgnXCSnVY8AIriFfO9c1ljxL6k6vaHpfnsPcMrxuQXNeOPGYpVjNGi/Hz8OjuZ3IT07c8SmZgmGaNp+ZIKErJQV0eob0NeA/1P7HheRS5aPEiN8vj/ZGuIGa+BhbTp2riJ599urrSqGDcJ0YzNeW2BvBZQoXs953X4N4yROz4xKMNqPz/jhyGM9w5SBJ/uLiIvKTu+bSsJ2VNyrOOu25eYqzH1zKc71fKiWa1ZOTHKVM24chlmoq3tZTSpSn6OxpptKLxAYZG0IUdFSMy66m8nss1AxL2djScAptugsqpfLqziMArAoN9iWXCeGiWz1qLRl+5AlMrmMY="
+---
spec/spec_helper_acceptance.rb:
unmanaged: false
+.puppet-lint.rc:
+ enabled_lint_checks:
+ - parameter_documentation
+ - parameter_types
diff --git a/Gemfile b/Gemfile
index a39114ce..b6dcf456 100644
--- a/Gemfile
+++ b/Gemfile
@@ -4,7 +4,7 @@
source ENV['GEM_SOURCE'] || "https://rubygems.org"
group :test do
- gem 'voxpupuli-test', '~> 2.5', :require => false
+ gem 'voxpupuli-test', '~> 5.0', :require => false
gem 'coveralls', :require => false
gem 'simplecov-console', :require => false
gem 'puppet_metadata', '~> 1.0', :require => false
@@ -21,7 +21,7 @@ end
group :release do
gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5'
- gem 'voxpupuli-release', '>= 1.0.2', :require => false
+ gem 'voxpupuli-release', '>= 1.2.0', :require => false
gem 'puppet-strings', '>= 2.2', :require => false
end
diff --git a/REFERENCE.md b/REFERENCE.md
index ffebfe3b..d899724e 100644
--- a/REFERENCE.md
+++ b/REFERENCE.md
@@ -9,15 +9,15 @@
* [`yum`](#yum): A class to install and manage Yum configuration.
* [`yum::clean`](#yumclean): A $(yum clean all) Exec to be notified if desired.
* [`yum::plugin::post_transaction_actions`](#yumpluginpost_transaction_actions): Class to install post_transaction plugin
-* [`yum::plugin::versionlock`](#yumpluginversionlock): Class: yum::plugin::versionlock This class installs versionlock plugin Parameters: [*ensure*] - specifies if versionlock should be presen
+* [`yum::plugin::versionlock`](#yumpluginversionlock): This class installs versionlock plugin
### Defined types
-* [`yum::config`](#yumconfig): Define: yum::config This definition manages yum.conf Parameters: [*key*] - alternative conf. key (defaults to name) [*ensure*] -
-* [`yum::gpgkey`](#yumgpgkey): Define: yum::gpgkey This definition saves and imports public GPG key for RPM. Key can be stored on Puppet's fileserver or as inline content.
-* [`yum::group`](#yumgroup): Define: yum::group This definition installs or removes yum package group. Parameters: [*ensure*] - specifies if package group should be
-* [`yum::install`](#yuminstall): Define: yum::install This definition installs or removes rpms from local file or URL via yum install command. This can be better than using
-* [`yum::plugin`](#yumplugin): Define: yum::plugin This definition installs Yum plugin. Parameters: [*ensure*] - specifies if plugin should be present or absent Acti
+* [`yum::config`](#yumconfig): This definition manages yum.conf
+* [`yum::gpgkey`](#yumgpgkey): imports/deleted public GPG key for RPM. Key can be stored on Puppet's fileserver or as inline content.
+* [`yum::group`](#yumgroup): This definition installs or removes yum package group.
+* [`yum::install`](#yuminstall): Installs/removes rpms from local file/URL via yum install command.
+* [`yum::plugin`](#yumplugin): This definition installs Yum plugin.
* [`yum::post_transaction_action`](#yumpost_transaction_action): Creates post transaction configuratons for dnf or yum.
* [`yum::versionlock`](#yumversionlock): Locks package from updates.
@@ -257,79 +257,71 @@ Default value: `'present'`
### `yum::plugin::versionlock`
-Class: yum::plugin::versionlock
-
This class installs versionlock plugin
-Parameters:
- [*ensure*] - specifies if versionlock should be present or absent
- [*clean*] - specifies if yum clean all should be called after edits. Defaults false.
-
-Actions:
+#### Examples
-Requires:
+##### Sample usage:
-Sample usage:
- include yum::plugin::versionlock
+```puppet
+include yum::plugin::versionlock
+```
#### Parameters
The following parameters are available in the `yum::plugin::versionlock` class:
* [`ensure`](#ensure)
-* [`path`](#path)
* [`clean`](#clean)
+* [`path`](#path)
##### `ensure`
Data type: `Enum['present', 'absent']`
-
+specifies if versionlock should be present or absent
Default value: `'present'`
-##### `path`
-
-Data type: `String`
-
+##### `clean`
+Data type: `Boolean`
-Default value: `'/etc/yum/pluginconf.d/versionlock.list'`
+specifies if yum clean all should be called after edits. Defaults false.
-##### `clean`
+Default value: ``false``
-Data type: `Boolean`
+##### `path`
+Data type: `String`
+filepath for the versionlocks
-Default value: ``false``
+Default value: `'/etc/yum/pluginconf.d/versionlock.list'`
## Defined types
### `yum::config`
-Define: yum::config
-
This definition manages yum.conf
-Parameters:
- [*key*] - alternative conf. key (defaults to name)
- [*ensure*] - specifies value or absent keyword
- [*section*] - config section (default to main)
+#### Examples
-Actions:
+##### configure installonly limit
-Requires:
- RPM based system
+```puppet
+yum::config { 'installonly_limit':
+ ensure => 2,
+}
+```
-Sample usage:
- yum::config { 'installonly_limit':
- ensure => 2,
- }
+##### remove a configuration
- yum::config { 'debuglevel':
- ensure => absent,
- }
+```puppet
+yum::config { 'debuglevel':
+ ensure => absent,
+}
+```
#### Parameters
@@ -342,45 +334,32 @@ The following parameters are available in the `yum::config` defined type:
Data type: `Variant[Boolean, Integer, Enum['absent'], String]`
-
+specifies value or absent keyword
##### `key`
Data type: `String`
-
+alternative conf. key (defaults to name)
Default value: `$title`
### `yum::gpgkey`
-Define: yum::gpgkey
-
-This definition saves and imports public GPG key for RPM. Key can
-be stored on Puppet's fileserver or as inline content. Key can be
-also removed from system.
+imports/deleted public GPG key for RPM. Key can be stored on Puppet's fileserver or as inline content.
-Parameters:
- [*path*] - alternative file location (defaults to name)
- [*ensure*] - specifies if key should be present or absent
- [*content*] - content
- [*source*] - source (e.g.: puppet:///)
- [*owner*] - file owner
- [*group*] - file group
- [*mode*] - file mode
-
-Actions:
+#### Examples
-Requires:
- RPM based system
+##### Sample usage:
-Sample usage:
- yum::gpgkey { '/etc/pki/rpm-gpg/RPM-GPG-KEY-puppet-smoketest1':
- ensure => 'present',
- content => '-----BEGIN PGP PUBLIC KEY BLOCK-----
- ...
- -----END PGP PUBLIC KEY BLOCK-----';
- }
+```puppet
+yum::gpgkey { '/etc/pki/rpm-gpg/RPM-GPG-KEY-puppet-smoketest1':
+ ensure => 'present',
+ content => '-----BEGIN PGP PUBLIC KEY BLOCK-----
+...
+-----END PGP PUBLIC KEY BLOCK-----';
+}
+```
#### Parameters
@@ -398,7 +377,7 @@ The following parameters are available in the `yum::gpgkey` defined type:
Data type: `String`
-
+alternative file location (defaults to name)
Default value: `$name`
@@ -406,7 +385,7 @@ Default value: `$name`
Data type: `Enum['present', 'absent']`
-
+specifies if key should be present or absent
Default value: `'present'`
@@ -414,7 +393,7 @@ Default value: `'present'`
Data type: `Optional[String]`
-
+the actual file content
Default value: ``undef``
@@ -422,7 +401,7 @@ Default value: ``undef``
Data type: `Optional[String]`
-
+source (e.g.: puppet:///)
Default value: ``undef``
@@ -430,7 +409,7 @@ Default value: ``undef``
Data type: `String`
-
+file owner
Default value: `'root'`
@@ -438,7 +417,7 @@ Default value: `'root'`
Data type: `String`
-
+file group
Default value: `'root'`
@@ -446,53 +425,37 @@ Default value: `'root'`
Data type: `String`
-
+file mode
Default value: `'0644'`
### `yum::group`
-Define: yum::group
-
This definition installs or removes yum package group.
-Parameters:
- [*ensure*] - specifies if package group should be
- present (installed) or absent (purged)
- [*timeout*] - exec timeout for yum groupinstall command
- [*install_options*] - options provided to yum groupinstall command
-
-Actions:
+#### Examples
-Requires:
- RPM based system
+##### Sample usage:
-Sample usage:
- yum::group { 'X Window System':
- ensure => 'present',
- }
+```puppet
+yum::group { 'X Window System':
+ ensure => 'present',
+}
+```
#### Parameters
The following parameters are available in the `yum::group` defined type:
-* [`install_options`](#install_options)
* [`ensure`](#ensure)
* [`timeout`](#timeout)
-
-##### `install_options`
-
-Data type: `Array[String[1]]`
-
-
-
-Default value: `[]`
+* [`install_options`](#install_options)
##### `ensure`
Data type: `Enum['present', 'installed', 'latest', 'absent', 'purged']`
-
+specifies if package group should be present (installed) or absent (purged)
Default value: `'present'`
@@ -500,33 +463,34 @@ Default value: `'present'`
Data type: `Optional[Integer]`
-
+exec timeout for yum groupinstall command
Default value: ``undef``
-### `yum::install`
+##### `install_options`
-Define: yum::install
+Data type: `Array[String[1]]`
-This definition installs or removes rpms from local file or URL via
-yum install command. This can be better than using just the rpm
-provider because it will pull all the dependencies.
+options provided to yum groupinstall command
-Parameters:
- [*ensure*] - specifies if package group should be
- present (installed) or absent (purged)
- [*source*] - file or URL where RPM is available
+Default value: `[]`
+
+### `yum::install`
-Actions:
+Installs/removes rpms from local file/URL via yum install command.
-Requires:
- RPM based system
+* **Note** This can be better than using just the rpm provider because it will pull all the dependencies.
-Sample usage:
- yum::install { 'epel-release':
- ensure => 'present',
- source => 'https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm',
- }
+#### Examples
+
+##### Sample usage:
+
+```puppet
+yum::install { 'epel-release':
+ ensure => 'present',
+ source => 'https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm',
+}
+```
#### Parameters
@@ -540,13 +504,13 @@ The following parameters are available in the `yum::install` defined type:
Data type: `String`
-
+file or URL where RPM is available
##### `ensure`
Data type: `Enum['present', 'installed', 'absent', 'purged']`
-
+the desired state of the package
Default value: `'present'`
@@ -554,28 +518,23 @@ Default value: `'present'`
Data type: `Optional[Integer]`
-
+optional timeout for the installation
Default value: ``undef``
### `yum::plugin`
-Define: yum::plugin
-
This definition installs Yum plugin.
-Parameters:
- [*ensure*] - specifies if plugin should be present or absent
-
-Actions:
+#### Examples
-Requires:
- RPM based system
+##### Sample usage:
-Sample usage:
- yum::plugin { 'versionlock':
- ensure => 'present',
- }
+```puppet
+yum::plugin { 'versionlock':
+ ensure => 'present',
+}
+```
#### Parameters
@@ -589,7 +548,7 @@ The following parameters are available in the `yum::plugin` defined type:
Data type: `Enum['present', 'absent']`
-
+specifies if plugin should be present or absent
Default value: `'present'`
@@ -597,7 +556,7 @@ Default value: `'present'`
Data type: `Optional[String]`
-
+the package prefix for the plugins
Default value: ``undef``
@@ -605,7 +564,7 @@ Default value: ``undef``
Data type: `Optional[String]`
-
+the actual package name
Default value: ``undef``
@@ -703,7 +662,7 @@ yum::versionlock { 'bash':
ensure => present,
version => '4.1.2',
release => '9.el8',
- epoch => '0',
+ epoch => 0,
arch => 'noarch',
}
```
@@ -715,7 +674,7 @@ yum::versionlock { 'bash':
ensure => present,
version => '3.1.2',
release => '9.el7',
- epoch => '0',
+ epoch => 0,
arch => 'noarch',
}
```
diff --git a/Rakefile b/Rakefile
index 80b799d6..f92f0516 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,7 +1,7 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
-# Attempt to load voxupuli-test (which pulls in puppetlabs_spec_helper),
+# Attempt to load voxpupuli-test (which pulls in puppetlabs_spec_helper),
# otherwise attempt to load it directly.
begin
require 'voxpupuli/test/rake'
diff --git a/lib/facter/yum_reboot_required.rb b/lib/facter/yum_reboot_required.rb
index 41c596aa..198f99d3 100644
--- a/lib/facter/yum_reboot_required.rb
+++ b/lib/facter/yum_reboot_required.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'English'
Facter.add(:yum_reboot_required) do
diff --git a/lib/facter/yum_updates.rb b/lib/facter/yum_updates.rb
index 0f8a3de4..565f3329 100644
--- a/lib/facter/yum_updates.rb
+++ b/lib/facter/yum_updates.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
Facter.add('yum_package_updates') do
confine osfamily: 'RedHat'
setcode do
@@ -5,13 +7,9 @@
if File.executable?('/usr/bin/yum')
yum_get_result = Facter::Util::Resolution.exec('/usr/bin/yum --assumeyes --quiet --cacheonly list updates')
- unless yum_get_result.nil?
- yum_get_result.each_line do |line|
- %r{\A(?\S+\.\S+)\s+(?[[:digit:]]\S+)\s+(?\S+)\s*\z} =~ line
- if package && available_version && repository
- yum_updates.push(package)
- end
- end
+ yum_get_result&.each_line do |line|
+ %r{\A(?\S+\.\S+)\s+(?[[:digit:]]\S+)\s+(?\S+)\s*\z} =~ line
+ yum_updates.push(package) if package && available_version && repository
end
end
diff --git a/manifests/config.pp b/manifests/config.pp
index 45a8dd9d..0daec57f 100644
--- a/manifests/config.pp
+++ b/manifests/config.pp
@@ -1,22 +1,15 @@
-# Define: yum::config
#
-# This definition manages yum.conf
+# @summary This definition manages yum.conf
#
-# Parameters:
-# [*key*] - alternative conf. key (defaults to name)
-# [*ensure*] - specifies value or absent keyword
-# [*section*] - config section (default to main)
+# @param ensure specifies value or absent keyword
+# @param key alternative conf. key (defaults to name)
#
-# Actions:
-#
-# Requires:
-# RPM based system
-#
-# Sample usage:
+# @example configure installonly limit
# yum::config { 'installonly_limit':
# ensure => 2,
# }
#
+# @example remove a configuration
# yum::config { 'debuglevel':
# ensure => absent,
# }
diff --git a/manifests/gpgkey.pp b/manifests/gpgkey.pp
index 772575f3..8f06d307 100644
--- a/manifests/gpgkey.pp
+++ b/manifests/gpgkey.pp
@@ -1,24 +1,16 @@
-# Define: yum::gpgkey
#
-# This definition saves and imports public GPG key for RPM. Key can
-# be stored on Puppet's fileserver or as inline content. Key can be
-# also removed from system.
#
-# Parameters:
-# [*path*] - alternative file location (defaults to name)
-# [*ensure*] - specifies if key should be present or absent
-# [*content*] - content
-# [*source*] - source (e.g.: puppet:///)
-# [*owner*] - file owner
-# [*group*] - file group
-# [*mode*] - file mode
+# @summary imports/deleted public GPG key for RPM. Key can be stored on Puppet's fileserver or as inline content.
#
-# Actions:
+# @param path alternative file location (defaults to name)
+# @param ensure specifies if key should be present or absent
+# @param content the actual file content
+# @param source source (e.g.: puppet:///)
+# @param owner file owner
+# @param group file group
+# @param mode file mode
#
-# Requires:
-# RPM based system
-#
-# Sample usage:
+# @example Sample usage:
# yum::gpgkey { '/etc/pki/rpm-gpg/RPM-GPG-KEY-puppet-smoketest1':
# ensure => 'present',
# content => '-----BEGIN PGP PUBLIC KEY BLOCK-----
diff --git a/manifests/group.pp b/manifests/group.pp
index 18113f75..2a4f7c6c 100644
--- a/manifests/group.pp
+++ b/manifests/group.pp
@@ -1,19 +1,11 @@
-# Define: yum::group
#
-# This definition installs or removes yum package group.
+# @summary This definition installs or removes yum package group.
#
-# Parameters:
-# [*ensure*] - specifies if package group should be
-# present (installed) or absent (purged)
-# [*timeout*] - exec timeout for yum groupinstall command
-# [*install_options*] - options provided to yum groupinstall command
+# @param ensure specifies if package group should be present (installed) or absent (purged)
+# @param timeout exec timeout for yum groupinstall command
+# @param install_options options provided to yum groupinstall command
#
-# Actions:
-#
-# Requires:
-# RPM based system
-#
-# Sample usage:
+# @example Sample usage:
# yum::group { 'X Window System':
# ensure => 'present',
# }
diff --git a/manifests/init.pp b/manifests/init.pp
index 507238bf..870e5ccd 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -1,19 +1,19 @@
# A class to install and manage Yum configuration.
#
-# @param clean_old_kernels [Boolean]
+# @param clean_old_kernels
# Whether or not to purge old kernel version beyond the `keeponly_limit`.
#
-# @param keep_kernel_devel [Boolean]
+# @param keep_kernel_devel
# Whether or not to keep kernel devel packages on old kernel purge.
#
-# @param config_options [Hash]
+# @param config_options
# A Hash where keys are the names of `Yum::Config` resources and the values
# are either the direct `ensure` value, or a Hash of the resource's attributes.
#
# @note Boolean parameter values will be converted to either a `1` or `0`; use a quoted string to
# get a literal `true` or `false`.
#
-# @param repos [Hash]
+# @param repos
# A hash where keys are the names of `Yumrepo` resources and each value represents its respective
# Yumrepo's resource parameters. This is used in conjunction with the `managed_repos` parameter
# to create `Yumrepo` resources en masse. Some default data is provided for this using module
@@ -23,7 +23,7 @@
# @note Boolean parameter values will be converted to either a `1` or `0`; use a quoted string to
# get a literal `true` or `false`.
#
-# @param managed_repos [Array]
+# @param managed_repos
# An array of first-level keys from the `repos` hash to include in the catalog. The module uses
# this list to select `Yumrepo` resources from the `repos` hash for instantiation. Defaults are
# set in the module's Hiera data.
@@ -31,17 +31,17 @@
# @note This only indicates the *managed* state of the repos, the `ensure` state must be managed
# in the `repos` data.
#
-# @param manage_os_default_repos [Boolean]
+# @param manage_os_default_repos
# Whether or not to add an operating system's default repos to the `managed_repos` array.
#
# @note This only works for operating systems with data in the module's data directory. Currently
# the module only contains data for for CentOS 6 & 7.
#
-# @param os_default_repos [Array]
+# @param os_default_repos
# A list of default repos to add to `managed_repos` if `manage_os_default_repos` is enabled.
# Normally this should not be modified.
#
-# @param repo_exclusions [Array]
+# @param repo_exclusions
# An array of first-level keys from the `repos` hash to exclude from management via this module.
# Values in this array will be subtracted from the `managed_repos` array as a last step before
# instantiation.
diff --git a/manifests/install.pp b/manifests/install.pp
index ac107ac9..6fada9e4 100644
--- a/manifests/install.pp
+++ b/manifests/install.pp
@@ -1,20 +1,13 @@
-# Define: yum::install
#
-# This definition installs or removes rpms from local file or URL via
-# yum install command. This can be better than using just the rpm
-# provider because it will pull all the dependencies.
+# @summary Installs/removes rpms from local file/URL via yum install command.
#
-# Parameters:
-# [*ensure*] - specifies if package group should be
-# present (installed) or absent (purged)
-# [*source*] - file or URL where RPM is available
+# @note This can be better than using just the rpm provider because it will pull all the dependencies.
#
-# Actions:
+# @param source file or URL where RPM is available
+# @param ensure the desired state of the package
+# @param timeout optional timeout for the installation
#
-# Requires:
-# RPM based system
-#
-# Sample usage:
+# @example Sample usage:
# yum::install { 'epel-release':
# ensure => 'present',
# source => 'https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm',
diff --git a/manifests/plugin.pp b/manifests/plugin.pp
index 02be68b9..67c11ec1 100644
--- a/manifests/plugin.pp
+++ b/manifests/plugin.pp
@@ -1,16 +1,12 @@
-# Define: yum::plugin
#
-# This definition installs Yum plugin.
+# @summary This definition installs Yum plugin.
#
-# Parameters:
-# [*ensure*] - specifies if plugin should be present or absent
+# @param ensure specifies if plugin should be present or absent
+# @param pkg_prefix the package prefix for the plugins
+# @param pkg_name the actual package name
#
-# Actions:
#
-# Requires:
-# RPM based system
-#
-# Sample usage:
+# @example Sample usage:
# yum::plugin { 'versionlock':
# ensure => 'present',
# }
diff --git a/manifests/plugin/versionlock.pp b/manifests/plugin/versionlock.pp
index edbc746e..9f8ad6da 100644
--- a/manifests/plugin/versionlock.pp
+++ b/manifests/plugin/versionlock.pp
@@ -1,16 +1,11 @@
-# Class: yum::plugin::versionlock
#
-# This class installs versionlock plugin
+# @summary This class installs versionlock plugin
#
-# Parameters:
-# [*ensure*] - specifies if versionlock should be present or absent
-# [*clean*] - specifies if yum clean all should be called after edits. Defaults false.
+# @param ensure specifies if versionlock should be present or absent
+# @param clean specifies if yum clean all should be called after edits. Defaults false.
+# @param path filepath for the versionlocks
#
-# Actions:
-#
-# Requires:
-#
-# Sample usage:
+# @example Sample usage:
# include yum::plugin::versionlock
#
class yum::plugin::versionlock (
diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb
index 4ccd7736..cc958387 100644
--- a/spec/acceptance/class_spec.rb
+++ b/spec/acceptance/class_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper_acceptance'
describe 'yum class' do
diff --git a/spec/acceptance/define_versionlock_spec.rb b/spec/acceptance/define_versionlock_spec.rb
index d088fb54..936425d3 100644
--- a/spec/acceptance/define_versionlock_spec.rb
+++ b/spec/acceptance/define_versionlock_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper_acceptance'
describe 'yum::versionlock define' do
@@ -41,8 +43,10 @@
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end
+
describe file('/etc/yum/pluginconf.d/versionlock.list') do
it { is_expected.to be_file }
+
if %w[7].include?(fact('os.release.major'))
it { is_expected.to contain '0:bash-4.1.2-9.el6_2.*' }
it { is_expected.to contain '0:tcsh-3.1.2-9.el6_2.*' }
@@ -53,6 +57,7 @@
it { is_expected.to contain 'netscape-2:8.1.2-9.el6_2.*' }
end
end
+
if fact('os.release.major') == '8'
describe package('python3-dnf-plugin-versionlock') do
it { is_expected.to be_installed }
@@ -63,6 +68,7 @@
end
end
end
+
it 'must work if clean is specified' do
shell('yum repolist', acceptable_exit_codes: [0])
pp = <<-EOS
diff --git a/spec/acceptance/post_transaction_actions_spec.rb b/spec/acceptance/post_transaction_actions_spec.rb
index d0e3794c..df6d9ff1 100644
--- a/spec/acceptance/post_transaction_actions_spec.rb
+++ b/spec/acceptance/post_transaction_actions_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper_acceptance'
describe 'yum::post_transaction_action define' do
@@ -23,6 +25,7 @@
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end
+
describe file('/tmp/vim-installed') do
it { is_expected.to be_file }
end
diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb
index 559bca43..30cd646c 100644
--- a/spec/classes/init_spec.rb
+++ b/spec/classes/init_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
require 'deep_merge'
@@ -5,6 +7,7 @@
value ||= 3
it { is_expected.to contain_yum__config('installonly_limit').with_ensure(value.to_s) }
+
it 'contains Exec[package-cleanup_oldkernels' do
is_expected.to contain_exec('package-cleanup_oldkernels').with(
command: "/usr/bin/package-cleanup --oldkernels --count=#{value} -y",
@@ -47,22 +50,22 @@
case facts[:os]['name']
when 'Rocky'
- it_behaves_like 'a catalog containing repos', [
- 'appstream',
- 'appstream-source',
- 'baseos',
- 'baseos-source',
- 'devel',
- 'extras',
- 'ha',
- 'ha-source',
- 'nfv',
- 'plus',
- 'powertools',
- 'powertools-source',
- 'resilient-storage',
- 'resilient-storage-source',
- 'rt'
+ it_behaves_like 'a catalog containing repos', %w[
+ appstream
+ appstream-source
+ baseos
+ baseos-source
+ devel
+ extras
+ ha
+ ha-source
+ nfv
+ plus
+ powertools
+ powertools-source
+ resilient-storage
+ resilient-storage-source
+ rt
]
case facts[:os]['release']['major']
when '8'
@@ -71,178 +74,183 @@
it { is_expected.to have_yumrepo_resource_count(0) } # rubocop:disable RSpec/RepeatedExample
end
when 'CentOS'
- it_behaves_like 'a catalog containing repos', [
- 'extras',
- 'centosplus',
- 'fasttrack',
- 'extras-source',
- 'base-debuginfo',
+ it_behaves_like 'a catalog containing repos', %w[
+ extras
+ centosplus
+ fasttrack
+ extras-source
+ base-debuginfo
]
case facts[:os]['release']['major']
when '8'
- it_behaves_like 'a catalog containing repos', [
- 'AppStream',
- 'BaseOS',
- 'cr',
- 'Devel',
- 'HA',
- 'PowerTools',
- 'BaseOS-source',
- 'Appstream-source',
- 'c8-media-BaseOS',
- 'c8-media-AppStream'
+ it_behaves_like 'a catalog containing repos', %w[
+ AppStream
+ BaseOS
+ cr
+ Devel
+ HA
+ PowerTools
+ BaseOS-source
+ Appstream-source
+ c8-media-BaseOS
+ c8-media-AppStream
]
- it_behaves_like 'a catalog not containing repos', [
- 'base',
- 'updates',
- 'contrib',
- 'base-source',
- 'updates-source',
- 'centos-media'
+ it_behaves_like 'a catalog not containing repos', %w[
+ base
+ updates
+ contrib
+ base-source
+ updates-source
+ centos-media
]
when '7'
- it_behaves_like 'a catalog containing repos', [
- 'base',
- 'updates',
- 'cr',
- 'base-source',
- 'updates-source',
- 'centos-media'
+ it_behaves_like 'a catalog containing repos', %w[
+ base
+ updates
+ cr
+ base-source
+ updates-source
+ centos-media
]
- it_behaves_like 'a catalog not containing repos', [
- 'contrib',
- 'AppStream',
- 'BaseOS',
- 'Devel',
- 'HA',
- 'PowerTools',
- 'BaseOS-source',
- 'Appstream-source',
- 'c8-media-BaseOS',
- 'c8-media-AppStream'
+ it_behaves_like 'a catalog not containing repos', %w[
+ contrib
+ AppStream
+ BaseOS
+ Devel
+ HA
+ PowerTools
+ BaseOS-source
+ Appstream-source
+ c8-media-BaseOS
+ c8-media-AppStream
]
when '6'
- it_behaves_like 'a catalog containing repos', [
- 'contrib',
- 'base',
- 'updates',
- 'centos-media',
- 'base-source',
- 'updates-source'
+ it_behaves_like 'a catalog containing repos', %w[
+ contrib
+ base
+ updates
+ centos-media
+ base-source
+ updates-source
]
- it_behaves_like 'a catalog not containing repos', [
- 'cr',
- 'AppStream',
- 'BaseOS',
- 'Devel',
- 'HA',
- 'PowerTools',
- 'BaseOS-source',
- 'Appstream-source',
- 'c8-media-BaseOS',
- 'c8-media-AppStream'
+ it_behaves_like 'a catalog not containing repos', %w[
+ cr
+ AppStream
+ BaseOS
+ Devel
+ HA
+ PowerTools
+ BaseOS-source
+ Appstream-source
+ c8-media-BaseOS
+ c8-media-AppStream
]
else
it { is_expected.to have_yumrepo_resource_count(4) }
end
when 'Amazon'
it { is_expected.to have_yumrepo_resource_count(16) } # rubocop:disable RSpec/RepeatedExample
- it_behaves_like 'a catalog containing repos', [
- 'amzn-main',
- 'amzn-main-debuginfo',
- 'amzn-main-source',
- 'amzn-nosrc',
- 'amzn-preview',
- 'amzn-preview-debuginfo',
- 'amzn-preview-source',
- 'amzn-updates',
- 'amzn-updates-debuginfo',
- 'amzn-updates-source',
- 'epel',
- 'epel-debuginfo',
- 'epel-source',
- 'epel-testing',
- 'epel-testing-debuginfo',
- 'epel-testing-source'
+
+ it_behaves_like 'a catalog containing repos', %w[
+ amzn-main
+ amzn-main-debuginfo
+ amzn-main-source
+ amzn-nosrc
+ amzn-preview
+ amzn-preview-debuginfo
+ amzn-preview-source
+ amzn-updates
+ amzn-updates-debuginfo
+ amzn-updates-source
+ epel
+ epel-debuginfo
+ epel-source
+ epel-testing
+ epel-testing-debuginfo
+ epel-testing-source
]
when 'RedHat'
it { is_expected.to have_yumrepo_resource_count(18) }
- it_behaves_like 'a catalog containing repos', [
- 'rhui-REGION-rhel-server-releases',
- 'rhui-REGION-rhel-server-releases-debug',
- 'rhui-REGION-rhel-server-releases-source',
- 'rhui-REGION-rhel-server-rhscl',
- 'rhui-REGION-rhel-server-debug-rhscl',
- 'rhui-REGION-rhel-server-source-rhscl',
- 'rhui-REGION-rhel-server-extras',
- 'rhui-REGION-rhel-server-debug-extras',
- 'rhui-REGION-rhel-server-source-extras',
- 'rhui-REGION-rhel-server-optional',
- 'rhui-REGION-rhel-server-debug-optional',
- 'rhui-REGION-rhel-server-source-optional',
- 'rhui-REGION-rhel-server-rh-common',
- 'rhui-REGION-rhel-server-debug-rh-common',
- 'rhui-REGION-rhel-server-source-rh-common',
- 'rhui-REGION-rhel-server-supplementary',
- 'rhui-REGION-rhel-server-debug-supplementary',
- 'rhui-REGION-rhel-server-source-supplementary'
+
+ it_behaves_like 'a catalog containing repos', %w[
+ rhui-REGION-rhel-server-releases
+ rhui-REGION-rhel-server-releases-debug
+ rhui-REGION-rhel-server-releases-source
+ rhui-REGION-rhel-server-rhscl
+ rhui-REGION-rhel-server-debug-rhscl
+ rhui-REGION-rhel-server-source-rhscl
+ rhui-REGION-rhel-server-extras
+ rhui-REGION-rhel-server-debug-extras
+ rhui-REGION-rhel-server-source-extras
+ rhui-REGION-rhel-server-optional
+ rhui-REGION-rhel-server-debug-optional
+ rhui-REGION-rhel-server-source-optional
+ rhui-REGION-rhel-server-rh-common
+ rhui-REGION-rhel-server-debug-rh-common
+ rhui-REGION-rhel-server-source-rh-common
+ rhui-REGION-rhel-server-supplementary
+ rhui-REGION-rhel-server-debug-supplementary
+ rhui-REGION-rhel-server-source-supplementary
]
when 'VirtuozzoLinux'
case facts[:os]['release']['major']
when '6'
it { is_expected.to have_yumrepo_resource_count(12) } # rubocop:disable RSpec/RepeatedExample
- it_behaves_like 'a catalog containing repos', [
- 'virtuozzolinux-base',
- 'virtuozzolinux-updates',
- 'virtuozzolinux-base-debuginfo',
- 'virtuozzolinux-updates-debuginfo',
- 'virtuozzolinux-factory',
- 'virtuozzolinux-factory-debuginfo',
- 'virtuozzo-os',
- 'virtuozzo-updates',
- 'virtuozzo-os-debuginfo',
- 'virtuozzo-updates-debuginfo',
- 'virtuozzo-readykernel',
- 'obsoleted_tmpls'
+
+ it_behaves_like 'a catalog containing repos', %w[
+ virtuozzolinux-base
+ virtuozzolinux-updates
+ virtuozzolinux-base-debuginfo
+ virtuozzolinux-updates-debuginfo
+ virtuozzolinux-factory
+ virtuozzolinux-factory-debuginfo
+ virtuozzo-os
+ virtuozzo-updates
+ virtuozzo-os-debuginfo
+ virtuozzo-updates-debuginfo
+ virtuozzo-readykernel
+ obsoleted_tmpls
]
when '7'
it { is_expected.to have_yumrepo_resource_count(16) } # rubocop:disable RSpec/RepeatedExample
- it_behaves_like 'a catalog containing repos', [
- 'virtuozzolinux-base',
- 'virtuozzolinux-updates',
- 'virtuozzolinux-base-debuginfo',
- 'virtuozzolinux-updates-debuginfo',
- 'virtuozzolinux-factory',
- 'virtuozzolinux-factory-debuginfo',
- 'virtuozzo-os',
- 'virtuozzo-updates',
- 'virtuozzo-os-debuginfo',
- 'virtuozzo-updates-debuginfo',
- 'virtuozzo-readykernel',
- 'obsoleted_tmpls',
- 'factory',
- 'factory-debuginfo',
- 'virtuozzolinux-vz-factory',
- 'virtuozzolinux-vz-factory-debuginfo'
+
+ it_behaves_like 'a catalog containing repos', %w[
+ virtuozzolinux-base
+ virtuozzolinux-updates
+ virtuozzolinux-base-debuginfo
+ virtuozzolinux-updates-debuginfo
+ virtuozzolinux-factory
+ virtuozzolinux-factory-debuginfo
+ virtuozzo-os
+ virtuozzo-updates
+ virtuozzo-os-debuginfo
+ virtuozzo-updates-debuginfo
+ virtuozzo-readykernel
+ obsoleted_tmpls
+ factory
+ factory-debuginfo
+ virtuozzolinux-vz-factory
+ virtuozzolinux-vz-factory-debuginfo
]
end
when 'AlmaLinux'
case facts[:os]['release']['major']
when '8'
it { is_expected.to have_yumrepo_resource_count(12) } # rubocop:disable RSpec/RepeatedExample
- it_behaves_like 'a catalog containing repos', [
- 'baseos',
- 'appstream',
- 'powertools',
- 'extras',
- 'baseos-source',
- 'appstream-source',
- 'powertools-source',
- 'extras-source',
- 'baseos-debuginfo',
- 'appstream-debuginfo',
- 'powertools-debuginfo',
- 'extras-debuginfo',
+
+ it_behaves_like 'a catalog containing repos', %w[
+ baseos
+ appstream
+ powertools
+ extras
+ baseos-source
+ appstream-source
+ powertools-source
+ extras-source
+ baseos-debuginfo
+ appstream-debuginfo
+ powertools-debuginfo
+ extras-debuginfo
]
end
else
@@ -257,176 +265,185 @@
let(:params) { super().merge(repo_exclusions: ['base']) }
end
+ it { is_expected.to compile.with_all_deps }
+
case facts[:os]['name']
when 'CentOS'
it { is_expected.not_to contain_yumrepo('base') }
it { is_expected.not_to contain_yumrepo('BaseOS') }
+
case facts[:os]['release']['major']
when '8'
- it_behaves_like 'a catalog containing repos', [
- 'AppStream',
- 'cr',
- 'Devel',
- 'fasttrack',
- 'HA',
- 'PowerTools',
- 'BaseOS-source',
- 'Appstream-source',
- 'c8-media-BaseOS',
- 'c8-media-AppStream'
+ it_behaves_like 'a catalog containing repos', %w[
+ AppStream
+ cr
+ Devel
+ fasttrack
+ HA
+ PowerTools
+ BaseOS-source
+ Appstream-source
+ c8-media-BaseOS
+ c8-media-AppStream
]
when '7'
- it_behaves_like 'a catalog containing repos', [
- 'cr',
- 'updates',
- 'extras',
- 'base-source',
- 'updates-source',
- 'extras-source',
- 'base-debuginfo',
- 'centosplus',
- 'centos-media'
+ it_behaves_like 'a catalog containing repos', %w[
+ cr
+ updates
+ extras
+ base-source
+ updates-source
+ extras-source
+ base-debuginfo
+ centosplus
+ centos-media
]
when '6'
- it_behaves_like 'a catalog containing repos', [
- 'contrib',
- 'updates',
- 'extras',
- 'base-source',
- 'updates-source',
- 'extras-source',
- 'base-debuginfo',
- 'centosplus',
- 'centos-media'
+ it_behaves_like 'a catalog containing repos', %w[
+ contrib
+ updates
+ extras
+ base-source
+ updates-source
+ extras-source
+ base-debuginfo
+ centosplus
+ centos-media
]
else
- it_behaves_like 'a catalog containing repos', [
- 'extras',
- 'centosplus',
- 'extras-source',
- 'base-debuginfo'
+ it_behaves_like 'a catalog containing repos', %w[
+ extras
+ centosplus
+ extras-source
+ base-debuginfo
]
end
when 'Amazon'
it { is_expected.to have_yumrepo_resource_count(16) } # rubocop:disable RSpec/RepeatedExample
- it_behaves_like 'a catalog containing repos', [
- 'amzn-main',
- 'amzn-main-debuginfo',
- 'amzn-main-source',
- 'amzn-nosrc',
- 'amzn-preview',
- 'amzn-preview-debuginfo',
- 'amzn-preview-source',
- 'amzn-updates',
- 'amzn-updates-debuginfo',
- 'amzn-updates-source',
- 'epel',
- 'epel-debuginfo',
- 'epel-source',
- 'epel-testing',
- 'epel-testing-debuginfo',
- 'epel-testing-source'
+
+ it_behaves_like 'a catalog containing repos', %w[
+ amzn-main
+ amzn-main-debuginfo
+ amzn-main-source
+ amzn-nosrc
+ amzn-preview
+ amzn-preview-debuginfo
+ amzn-preview-source
+ amzn-updates
+ amzn-updates-debuginfo
+ amzn-updates-source
+ epel
+ epel-debuginfo
+ epel-source
+ epel-testing
+ epel-testing-debuginfo
+ epel-testing-source
]
when 'RedHat'
it { is_expected.to have_yumrepo_resource_count(18) }
- it_behaves_like 'a catalog containing repos', [
- 'rhui-REGION-rhel-server-releases',
- 'rhui-REGION-rhel-server-releases-debug',
- 'rhui-REGION-rhel-server-releases-source',
- 'rhui-REGION-rhel-server-rhscl',
- 'rhui-REGION-rhel-server-debug-rhscl',
- 'rhui-REGION-rhel-server-source-rhscl',
- 'rhui-REGION-rhel-server-extras',
- 'rhui-REGION-rhel-server-debug-extras',
- 'rhui-REGION-rhel-server-source-extras',
- 'rhui-REGION-rhel-server-optional',
- 'rhui-REGION-rhel-server-debug-optional',
- 'rhui-REGION-rhel-server-source-optional',
- 'rhui-REGION-rhel-server-rh-common',
- 'rhui-REGION-rhel-server-debug-rh-common',
- 'rhui-REGION-rhel-server-source-rh-common',
- 'rhui-REGION-rhel-server-supplementary',
- 'rhui-REGION-rhel-server-debug-supplementary',
- 'rhui-REGION-rhel-server-source-supplementary'
+
+ it_behaves_like 'a catalog containing repos', %w[
+ rhui-REGION-rhel-server-releases
+ rhui-REGION-rhel-server-releases-debug
+ rhui-REGION-rhel-server-releases-source
+ rhui-REGION-rhel-server-rhscl
+ rhui-REGION-rhel-server-debug-rhscl
+ rhui-REGION-rhel-server-source-rhscl
+ rhui-REGION-rhel-server-extras
+ rhui-REGION-rhel-server-debug-extras
+ rhui-REGION-rhel-server-source-extras
+ rhui-REGION-rhel-server-optional
+ rhui-REGION-rhel-server-debug-optional
+ rhui-REGION-rhel-server-source-optional
+ rhui-REGION-rhel-server-rh-common
+ rhui-REGION-rhel-server-debug-rh-common
+ rhui-REGION-rhel-server-source-rh-common
+ rhui-REGION-rhel-server-supplementary
+ rhui-REGION-rhel-server-debug-supplementary
+ rhui-REGION-rhel-server-source-supplementary
]
when 'VirtuozzoLinux'
case facts[:os]['release']['major']
when '6'
it { is_expected.to have_yumrepo_resource_count(12) } # rubocop:disable RSpec/RepeatedExample
- it_behaves_like 'a catalog containing repos', [
- 'virtuozzolinux-base',
- 'virtuozzolinux-updates',
- 'virtuozzolinux-base-debuginfo',
- 'virtuozzolinux-updates-debuginfo',
- 'virtuozzolinux-factory',
- 'virtuozzolinux-factory-debuginfo',
- 'virtuozzo-os',
- 'virtuozzo-updates',
- 'virtuozzo-os-debuginfo',
- 'virtuozzo-updates-debuginfo',
- 'virtuozzo-readykernel',
- 'obsoleted_tmpls'
+
+ it_behaves_like 'a catalog containing repos', %w[
+ virtuozzolinux-base
+ virtuozzolinux-updates
+ virtuozzolinux-base-debuginfo
+ virtuozzolinux-updates-debuginfo
+ virtuozzolinux-factory
+ virtuozzolinux-factory-debuginfo
+ virtuozzo-os
+ virtuozzo-updates
+ virtuozzo-os-debuginfo
+ virtuozzo-updates-debuginfo
+ virtuozzo-readykernel
+ obsoleted_tmpls
]
when '7'
it { is_expected.to have_yumrepo_resource_count(16) } # rubocop:disable RSpec/RepeatedExample
- it_behaves_like 'a catalog containing repos', [
- 'virtuozzolinux-base',
- 'virtuozzolinux-updates',
- 'virtuozzolinux-base-debuginfo',
- 'virtuozzolinux-updates-debuginfo',
- 'virtuozzolinux-factory',
- 'virtuozzolinux-factory-debuginfo',
- 'virtuozzo-os',
- 'virtuozzo-updates',
- 'virtuozzo-os-debuginfo',
- 'virtuozzo-updates-debuginfo',
- 'virtuozzo-readykernel',
- 'obsoleted_tmpls',
- 'factory',
- 'factory-debuginfo',
- 'virtuozzolinux-vz-factory',
- 'virtuozzolinux-vz-factory-debuginfo'
+
+ it_behaves_like 'a catalog containing repos', %w[
+ virtuozzolinux-base
+ virtuozzolinux-updates
+ virtuozzolinux-base-debuginfo
+ virtuozzolinux-updates-debuginfo
+ virtuozzolinux-factory
+ virtuozzolinux-factory-debuginfo
+ virtuozzo-os
+ virtuozzo-updates
+ virtuozzo-os-debuginfo
+ virtuozzo-updates-debuginfo
+ virtuozzo-readykernel
+ obsoleted_tmpls
+ factory
+ factory-debuginfo
+ virtuozzolinux-vz-factory
+ virtuozzolinux-vz-factory-debuginfo
]
end
when 'AlmaLinux'
case facts[:os]['release']['major']
when '8'
it { is_expected.to have_yumrepo_resource_count(12) } # rubocop:disable RSpec/RepeatedExample
- it_behaves_like 'a catalog containing repos', [
- 'baseos',
- 'appstream',
- 'powertools',
- 'extras',
- 'baseos-source',
- 'appstream-source',
- 'powertools-source',
- 'extras-source',
- 'baseos-debuginfo',
- 'appstream-debuginfo',
- 'powertools-debuginfo',
- 'extras-debuginfo',
+
+ it_behaves_like 'a catalog containing repos', %w[
+ baseos
+ appstream
+ powertools
+ extras
+ baseos-source
+ appstream-source
+ powertools-source
+ extras-source
+ baseos-debuginfo
+ appstream-debuginfo
+ powertools-debuginfo
+ extras-debuginfo
]
end
when 'Rocky'
case facts[:os]['release']['major']
when '8'
it { is_expected.to have_yumrepo_resource_count(15) }
- it_behaves_like 'a catalog containing repos', [
- 'appstream',
- 'appstream-source',
- 'baseos',
- 'baseos-source',
- 'devel',
- 'extras',
- 'ha',
- 'ha-source',
- 'nfv',
- 'plus',
- 'powertools',
- 'powertools-source',
- 'resilient-storage',
- 'resilient-storage-source',
- 'rt',
+
+ it_behaves_like 'a catalog containing repos', %w[
+ appstream
+ appstream-source
+ baseos
+ baseos-source
+ devel
+ extras
+ ha
+ ha-source
+ nfv
+ plus
+ powertools
+ powertools-source
+ resilient-storage
+ resilient-storage-source
+ rt
]
end
else
@@ -468,6 +485,7 @@
it { is_expected.to compile.with_all_deps }
it { is_expected.to have_yumrepo_resource_count(supported_repos.count) }
+
it_behaves_like 'a catalog containing repos', supported_repos
end
end
@@ -495,6 +513,7 @@
let(:params) { { config_options: { 'cachedir' => '/var/cache/yum' } } }
it { is_expected.to contain_yum__config('cachedir').with_ensure('/var/cache/yum') }
+
it_behaves_like 'a Yum class'
end
@@ -502,6 +521,7 @@
let(:params) { { config_options: { 'debuglevel' => 5 } } }
it { is_expected.to contain_yum__config('debuglevel').with_ensure('5') }
+
it_behaves_like 'a Yum class'
end
@@ -509,6 +529,7 @@
let(:params) { { config_options: { 'gpgcheck' => true } } }
it { is_expected.to contain_yum__config('gpgcheck').with_ensure('1') }
+
it_behaves_like 'a Yum class'
end
@@ -517,6 +538,7 @@
let(:params) { { config_options: { 'my_cachedir' => { 'ensure' => '/var/cache/yum', 'key' => 'cachedir' } } } }
it { is_expected.to contain_yum__config('my_cachedir').with_ensure('/var/cache/yum').with_key('cachedir') }
+
it_behaves_like 'a Yum class'
end
@@ -524,6 +546,7 @@
let(:params) { { config_options: { 'my_debuglevel' => { 'ensure' => 5, 'key' => 'debuglevel' } } } }
it { is_expected.to contain_yum__config('my_debuglevel').with_ensure('5').with_key('debuglevel') }
+
it_behaves_like 'a Yum class'
end
@@ -531,6 +554,7 @@
let(:params) { { config_options: { 'my_gpgcheck' => { 'ensure' => true, 'key' => 'gpgcheck' } } } }
it { is_expected.to contain_yum__config('my_gpgcheck').with_ensure('1').with_key('gpgcheck') }
+
it_behaves_like 'a Yum class'
end
end
@@ -546,6 +570,7 @@
let(:params) { { managed_repos: ['epel'] } }
it { is_expected.to contain_yumrepo('epel') }
+
case facts[:os]['release']['major']
when '8'
it { is_expected.to contain_yum__gpgkey('/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8') }
@@ -557,6 +582,8 @@
end
context 'when utils_package_name is not set' do
+ it { is_expected.to compile.with_all_deps }
+
case facts[:os]['name']
when 'Fedora'
it { is_expected.to contain_package('dnf-utils') }
@@ -564,6 +591,7 @@
it { is_expected.to contain_package('yum-utils') }
end
end
+
context 'when utils_package_name is set' do
let(:params) { { utils_package_name: 'dnf-utils' } }
diff --git a/spec/classes/plugin_post_transaction_actions_spec.rb b/spec/classes/plugin_post_transaction_actions_spec.rb
index 95a6108b..2d58ddc9 100644
--- a/spec/classes/plugin_post_transaction_actions_spec.rb
+++ b/spec/classes/plugin_post_transaction_actions_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe 'yum::plugin::post_transaction_actions' do
@@ -12,6 +14,7 @@
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_concat('puppet_actions') }
it { is_expected.to contain_concat__fragment('action_header') }
+
case provider
when 'yum'
it { is_expected.to contain_package('yum-plugin-post-transaction-actions').with_ensure('present') }
@@ -30,6 +33,7 @@
it { is_expected.to compile.with_all_deps }
it { is_expected.not_to contain_concat('puppet_actions') }
it { is_expected.not_to contain_concat__fragment('action_header') }
+
case provider
when 'yum'
it { is_expected.to contain_package('yum-plugin-post-transaction-actions').with_ensure('absent') }
diff --git a/spec/defines/config_spec.rb b/spec/defines/config_spec.rb
index 3a96690a..637fa7f4 100644
--- a/spec/defines/config_spec.rb
+++ b/spec/defines/config_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe 'yum::config' do
@@ -12,6 +14,7 @@
let(:params) { { ensure: true } }
it { is_expected.to compile.with_all_deps }
+
it 'contains an Augeas resource with the correct changes' do
is_expected.to contain_augeas("yum.conf_#{title}").with(
changes: "set assumeyes '1'"
@@ -24,6 +27,7 @@
let(:params) { { ensure: 0 } }
it { is_expected.to compile.with_all_deps }
+
it 'contains an Augeas resource with the correct changes' do
is_expected.to contain_augeas("yum.conf_#{title}").with(
changes: "set assumeyes '0'"
@@ -36,6 +40,7 @@
let(:params) { { ensure: '1, 2' } }
it { is_expected.to compile.with_all_deps }
+
it 'contains an Augeas resource with the correct changes' do
is_expected.to contain_augeas("yum.conf_#{title}").with(
changes: "set assumeyes '1, 2'"
diff --git a/spec/defines/gpgkey_spec.rb b/spec/defines/gpgkey_spec.rb
index c862de08..9de4f4c5 100644
--- a/spec/defines/gpgkey_spec.rb
+++ b/spec/defines/gpgkey_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe 'yum::gpgkey' do
@@ -17,11 +19,12 @@
end
it { is_expected.to compile.with_all_deps }
+
it {
is_expected.to contain_exec("rpm-import-#{title}").with(
- 'path' => '/bin:/usr/bin:/sbin/:/usr/sbin',
+ 'path' => '/bin:/usr/bin:/sbin/:/usr/sbin',
'command' => "rpm --import #{title}",
- 'unless' => "rpm -q gpg-pubkey-$(gpg --with-colons #{title} | head -n 1 | cut -d: -f5 | cut -c9-16 | tr '[A-Z]' '[a-z]')",
+ 'unless' => "rpm -q gpg-pubkey-$(gpg --with-colons #{title} | head -n 1 | cut -d: -f5 | cut -c9-16 | tr '[A-Z]' '[a-z]')",
'require' => "File[#{title}]"
)
}
@@ -33,11 +36,12 @@
end
it { is_expected.to compile.with_all_deps }
+
it {
is_expected.to contain_exec("rpm-delete-#{title}").with(
- 'path' => '/bin:/usr/bin:/sbin/:/usr/sbin',
+ 'path' => '/bin:/usr/bin:/sbin/:/usr/sbin',
'command' => "rpm -e gpg-pubkey-$(gpg --with-colons #{title} | head -n 1 | cut -d: -f5 | cut -c9-16 | tr '[A-Z]' '[a-z]')",
- 'onlyif' => ["test -f #{title}", "rpm -q gpg-pubkey-$(gpg --with-colons #{title} | head -n 1 | cut -d: -f5 | cut -c9-16 | tr '[A-Z]' '[a-z]')"],
+ 'onlyif' => ["test -f #{title}", "rpm -q gpg-pubkey-$(gpg --with-colons #{title} | head -n 1 | cut -d: -f5 | cut -c9-16 | tr '[A-Z]' '[a-z]')"],
'before' => "File[#{title}]"
)
}
diff --git a/spec/defines/group_spec.rb b/spec/defines/group_spec.rb
index 37cbac7d..2aa849c3 100644
--- a/spec/defines/group_spec.rb
+++ b/spec/defines/group_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe 'yum::group' do
@@ -23,6 +25,7 @@
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_exec("yum-groupinstall-#{title}").with_timeout(30) }
end
+
context 'with an install option specified' do
let(:title) { 'Core' }
let(:params) { { install_options: ['--enablerepo=epel'] } }
diff --git a/spec/defines/plugin_spec.rb b/spec/defines/plugin_spec.rb
index bb2e6f71..b41617f3 100644
--- a/spec/defines/plugin_spec.rb
+++ b/spec/defines/plugin_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe 'yum::plugin' do
diff --git a/spec/defines/post_transaction_action_spec.rb b/spec/defines/post_transaction_action_spec.rb
index 9e301dd2..a09aa718 100644
--- a/spec/defines/post_transaction_action_spec.rb
+++ b/spec/defines/post_transaction_action_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe 'yum::post_transaction_action' do
@@ -23,6 +25,7 @@
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('yum::plugin::post_transaction_actions') }
it { is_expected.to contain_concat__fragment('post_trans_an entry').with_content(%r{^# Action name: an entry$}) }
+
it {
is_expected.to contain_concat__fragment('post_trans_an entry').with(
{
@@ -32,6 +35,7 @@
}
)
}
+
context 'with post_transaction_actions disabled' do
let(:pre_condition) { 'class{"yum::plugin::post_transaction_actions": ensure => "absent"}' }
@@ -40,6 +44,7 @@
it { is_expected.not_to contain_concat__fragment('post_trans_an entry') }
end
end
+
context 'with package name glob and state any' do
let(:params) do
{
@@ -51,6 +56,7 @@
it { is_expected.to contain_concat__fragment('post_trans_an entry').with_content(%r{^openssh-\*:any:foo bar$}) }
end
+
context 'with file name path and state any' do
let(:params) do
{
@@ -62,6 +68,7 @@
it { is_expected.to contain_concat__fragment('post_trans_an entry').with_content(%r{^/etc/passwd:any:foo bar$}) }
end
+
context 'with file name glob and state any' do
let(:params) do
{
@@ -73,7 +80,8 @@
it { is_expected.to contain_concat__fragment('post_trans_an entry').with_content(%r{^/etc/\*:any:foo bar$}) }
end
- context 'with simple package name and state in (dnf only option)' do
+
+ context 'with simple package name and state in (dnf only option)' do # rubocop:disable RSpec/EmptyExampleGroup
let(:params) do
{
key: 'openssh',
@@ -89,7 +97,8 @@
it { is_expected.to contain_concat__fragment('post_trans_an entry').with_content(%r{^openssh:in:foo bar$}) }
end
end
- context 'with simple package name and state install (yum only option)' do
+
+ context 'with simple package name and state install (yum only option)' do # rubocop:disable RSpec/EmptyExampleGroup
let(:params) do
{
key: 'openssh',
diff --git a/spec/defines/versionlock_spec.rb b/spec/defines/versionlock_spec.rb
index 027efe94..7ff7835b 100644
--- a/spec/defines/versionlock_spec.rb
+++ b/spec/defines/versionlock_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe 'yum::versionlock' do
@@ -13,11 +15,14 @@
context 'and no parameters' do
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_concat__fragment('versionlock_header').with_content("# File managed by puppet\n") }
+
it 'contains a well-formed Concat::Fragment' do
is_expected.to contain_concat__fragment("yum-versionlock-#{title}").with_content("#{title}\n")
end
+
it { is_expected.to contain_concat('/etc/yum/pluginconf.d/versionlock.list').without_notify }
end
+
context 'clean set to true on module' do
let :pre_condition do
'class { "yum::plugin::versionlock": clean => true, }'
@@ -32,6 +37,7 @@
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_concat__fragment('versionlock_header').with_content("# File managed by puppet\n") }
+
it 'contains a well-formed Concat::Fragment' do
is_expected.to contain_concat__fragment("yum-versionlock-#{title}").with_content("#{title}\n")
end
@@ -42,6 +48,7 @@
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_concat__fragment('versionlock_header').with_content("# File managed by puppet\n") }
+
it 'contains a well-formed Concat::Fragment' do
is_expected.not_to contain_concat__fragment("yum-versionlock-#{title}")
end
@@ -58,6 +65,7 @@
let(:title) { '0:bash-4.1.2-9.el6_2.*' }
it { is_expected.to compile.with_all_deps }
+
it 'contains a well-formed Concat::Fragment' do
is_expected.to contain_concat__fragment("yum-versionlock-#{title}").with_content("#{title}\n")
end
@@ -121,6 +129,7 @@
context 'it works' do
it { is_expected.to compile.with_all_deps }
+
it 'contains a well-formed Concat::Fragment' do
is_expected.to contain_concat__fragment("yum-versionlock-#{title}").with_content("42:bash-4.3-3.2.arm\n")
end
@@ -145,6 +154,7 @@
it 'contains a well-formed Concat::Fragment' do
is_expected.to contain_concat__fragment('yum-versionlock-bash').with_content("bash-0:4.3-*.*\n")
end
+
context 'and an arch set to x86_64' do
let(:params) { super().merge(arch: 'x86_64') }
@@ -152,6 +162,7 @@
is_expected.to contain_concat__fragment('yum-versionlock-bash').with_content("bash-0:4.3-*.x86_64\n")
end
end
+
context 'and an release set to 22.x' do
let(:params) { super().merge(release: '22.5') }
@@ -159,6 +170,7 @@
is_expected.to contain_concat__fragment('yum-versionlock-bash').with_content("bash-0:4.3-22.5.*\n")
end
end
+
context 'and an epoch set to 5' do
let(:params) { super().merge(epoch: 5) }
@@ -167,6 +179,7 @@
end
end
end
+
context 'with release, version, epoch, arch all set' do
let(:params) do
{
diff --git a/spec/functions/bool2num_hash_recursive_spec.rb b/spec/functions/bool2num_hash_recursive_spec.rb
index 8f0a4a02..3a0c75b0 100644
--- a/spec/functions/bool2num_hash_recursive_spec.rb
+++ b/spec/functions/bool2num_hash_recursive_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe 'yum::bool2num_hash_recursive' do
@@ -5,7 +7,7 @@
let(:nested_hash) do
{
'a' => {
- 'aa' => true, 'ab' => false, 'ac' => 'c',
+ 'aa' => true, 'ab' => false, 'ac' => 'c',
'aaa' => true, 'aab' => false, 'aac' => 'c'
},
'b' => { 'ba' => true, 'bb' => false, 'bc' => 'c' },
@@ -23,7 +25,7 @@
is_expected.to run.with_params(nested_hash).
and_return(
'a' => {
- 'aa' => 1, 'ab' => 0, 'ac' => 'c',
+ 'aa' => 1, 'ab' => 0, 'ac' => 'c',
'aaa' => 1, 'aab' => 0, 'aac' => 'c'
},
'b' => { 'ba' => 1, 'bb' => 0, 'bc' => 'c' },
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index fb5f0cbe..4d617f39 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,17 +1,17 @@
+# frozen_string_literal: true
+
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
# puppetlabs_spec_helper will set up coverage if the env variable is set.
# We want to do this if lib exists and it hasn't been explicitly set.
-ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../../lib', __FILE__))
+ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../lib', __dir__))
require 'voxpupuli/test/spec_helper'
if File.exist?(File.join(__dir__, 'default_module_facts.yml'))
facts = YAML.safe_load(File.read(File.join(__dir__, 'default_module_facts.yml')))
- if facts
- facts.each do |name, value|
- add_custom_fact name.to_sym, value
- end
+ facts&.each do |name, value|
+ add_custom_fact name.to_sym, value
end
end
diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb
index d3b906bf..d3a6e23c 100644
--- a/spec/spec_helper_acceptance.rb
+++ b/spec/spec_helper_acceptance.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
diff --git a/spec/type_aliases/yum_rpmarch_spec.rb b/spec/type_aliases/yum_rpmarch_spec.rb
index d16732d2..29f7c3c2 100644
--- a/spec/type_aliases/yum_rpmarch_spec.rb
+++ b/spec/type_aliases/yum_rpmarch_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe 'Yum::Rpmarch' do
diff --git a/spec/type_aliases/yum_rpmname_spec.rb b/spec/type_aliases/yum_rpmname_spec.rb
index 54327b45..7025d402 100644
--- a/spec/type_aliases/yum_rpmname_spec.rb
+++ b/spec/type_aliases/yum_rpmname_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe 'Yum::Rpmname' do
diff --git a/spec/type_aliases/yum_rpmnameglob_spec.rb b/spec/type_aliases/yum_rpmnameglob_spec.rb
index 4b073548..31cfe947 100644
--- a/spec/type_aliases/yum_rpmnameglob_spec.rb
+++ b/spec/type_aliases/yum_rpmnameglob_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe 'Yum::RpmnameGlob' do
diff --git a/spec/type_aliases/yum_rpmrelease_spec.rb b/spec/type_aliases/yum_rpmrelease_spec.rb
index 4752033a..546ea618 100644
--- a/spec/type_aliases/yum_rpmrelease_spec.rb
+++ b/spec/type_aliases/yum_rpmrelease_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe 'Yum::Rpmrelease' do
diff --git a/spec/type_aliases/yum_rpmversion_spec.rb b/spec/type_aliases/yum_rpmversion_spec.rb
index 4683c149..acd86eec 100644
--- a/spec/type_aliases/yum_rpmversion_spec.rb
+++ b/spec/type_aliases/yum_rpmversion_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe 'Yum::Rpmversion' do
diff --git a/spec/unit/facter/yum_package_updates_spec.rb b/spec/unit/facter/yum_package_updates_spec.rb
index 38662e6b..e95a2e92 100644
--- a/spec/unit/facter/yum_package_updates_spec.rb
+++ b/spec/unit/facter/yum_package_updates_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe 'yum_package_updates fact' do
@@ -9,6 +11,7 @@
before do
allow(Facter.fact(:osfamily)).to receive(:value).once.and_return('Debian')
end
+
it { is_expected.to be_nil }
end
@@ -29,20 +32,20 @@
context 'when updates are available' do
let(:yum_list_updates_result) do
# rubocop:disable Layout/TrailingWhitespace
- <<-END
-Updated Packages
-ca-certificates.noarch 2020.2.41-70.0.el7_8 updates
-gitlab-ce.x86_64 13.1.1-ce.0.el7 gitlab_official_ce
-grafana.x86_64 7.0.4-1 grafana-stable
-kernel.x86_64 3.10.0-1127.13.1.el7 updates
-kernel-headers.x86_64 3.10.0-1127.13.1.el7 updates
-net-snmp-libs.x86_64 1:5.7.2-48.el7_8.1 updates
-ntp.x86_64 4.2.6p5-29.el7.centos.2 updates
-ntpdate.x86_64 4.2.6p5-29.el7.centos.2 updates
-passenger.x86_64 6.0.5-1.el7 passenger
-python-perf.x86_64 3.10.0-1127.13.1.el7 updates
-unbound.x86_64 1.6.6-5.el7_8 updates
-unbound-libs.x86_64 1.6.6-5.el7_8 updates
+ <<~END
+ Updated Packages
+ ca-certificates.noarch 2020.2.41-70.0.el7_8 updates
+ gitlab-ce.x86_64 13.1.1-ce.0.el7 gitlab_official_ce
+ grafana.x86_64 7.0.4-1 grafana-stable
+ kernel.x86_64 3.10.0-1127.13.1.el7 updates
+ kernel-headers.x86_64 3.10.0-1127.13.1.el7 updates
+ net-snmp-libs.x86_64 1:5.7.2-48.el7_8.1 updates
+ ntp.x86_64 4.2.6p5-29.el7.centos.2 updates
+ ntpdate.x86_64 4.2.6p5-29.el7.centos.2 updates
+ passenger.x86_64 6.0.5-1.el7 passenger
+ python-perf.x86_64 3.10.0-1127.13.1.el7 updates
+ unbound.x86_64 1.6.6-5.el7_8 updates
+ unbound-libs.x86_64 1.6.6-5.el7_8 updates
END
# rubocop:enable Layout/TrailingWhitespace
end
@@ -58,11 +61,11 @@
context 'when diagnostic messages are emitted' do
let(:yum_list_updates_result) do
- <<-END
-https://oss-binaries.phusionpassenger.com/yum/passenger/el/7/x86_64/repodata/repomd.xml: [Errno -1] repomd.xml signature could not be verified for passenger
-Trying other mirror.
-Updated Packages
-ca-certificates.noarch 2020.2.41-70.0.el7_8 updates
+ <<~END
+ https://oss-binaries.phusionpassenger.com/yum/passenger/el/7/x86_64/repodata/repomd.xml: [Errno -1] repomd.xml signature could not be verified for passenger
+ Trying other mirror.
+ Updated Packages
+ ca-certificates.noarch 2020.2.41-70.0.el7_8 updates
END
end
@@ -71,10 +74,10 @@
context 'when plugins emit output' do
let(:yum_list_updates_result) do
- <<-END
-Loaded plugins: auto-update-debuginfo, priorities, product-id, subscription-
- : manager, versionlock
-ca-certificates.noarch 2020.2.41-70.0.el7_8 updates
+ <<~END
+ Loaded plugins: auto-update-debuginfo, priorities, product-id, subscription-
+ : manager, versionlock
+ ca-certificates.noarch 2020.2.41-70.0.el7_8 updates
END
end
diff --git a/tasks/init.rb b/tasks/init.rb
index cf400499..0ce5a7b7 100755
--- a/tasks/init.rb
+++ b/tasks/init.rb
@@ -1,4 +1,5 @@
#!/opt/puppetlabs/puppet/bin/ruby
+# frozen_string_literal: true
require 'json'
require 'open3'
@@ -11,6 +12,7 @@ def yum(action, quiet)
stdout, stderr, status = Open3.capture3(*cmd)
raise Puppet::Error, stderr unless status.success?
+
{ status: stdout.strip }
end
@@ -30,7 +32,7 @@ def process_list_updates(output)
{ status: result }
end
-params = JSON.parse(STDIN.read)
+params = JSON.parse($stdin.read)
action = params['action']
quiet = params['quiet']