Skip to content

Commit

Permalink
(voxpupuli#236) Enable python module stream on EL8. Bump minimum pupp…
Browse files Browse the repository at this point in the history
…et version

The certbot package on EL8 currently requires `/usr/bin/python3.6`, which is part of the `python36` module stream, and needs enabled in order to install.

Bump the minimum puppet version to 6.15.0 since the enable_only feature of the dnfmodule provider was added in https://tickets.puppetlabs.com/browse/PUP-10235
  • Loading branch information
yachub committed Oct 1, 2022
1 parent 94ebf72 commit b28f212
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 2 deletions.
18 changes: 18 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ The following parameters are available in the `letsencrypt` class:
* [`environment`](#environment)
* [`package_name`](#package_name)
* [`package_ensure`](#package_ensure)
* [`dnfmodule_version`](#dnfmodule_version)
* [`package_command`](#package_command)
* [`config_file`](#config_file)
* [`config`](#config)
Expand Down Expand Up @@ -119,6 +120,14 @@ The value passed to `ensure` when installing the client package.

Default value: `'installed'`

##### <a name="dnfmodule_version"></a>`dnfmodule_version`

Data type: `String`

The yum module stream version to enable on EL8 and greater variants using the `package` method with the `dnfmodule` provider.

Default value: `'python36'`

##### <a name="package_command"></a>`package_command`

Data type: `String`
Expand Down Expand Up @@ -305,6 +314,7 @@ The following parameters are available in the `letsencrypt::install` class:
* [`configure_epel`](#configure_epel)
* [`package_ensure`](#package_ensure)
* [`package_name`](#package_name)
* [`dnfmodule_version`](#dnfmodule_version)

##### <a name="configure_epel"></a>`configure_epel`

Expand All @@ -330,6 +340,14 @@ Name of package to use when installing the client package.

Default value: `$letsencrypt::package_name`

##### <a name="dnfmodule_version"></a>`dnfmodule_version`

Data type: `String`

The yum module stream version to enable on EL8 and greater variants using the `package` method with the `dnfmodule` provider.

Default value: `$letsencrypt::dnfmodule_version`

### <a name="letsencryptplugindns_cloudflare"></a>`letsencrypt::plugin::dns_cloudflare`

This class installs and configures the Let's Encrypt dns-cloudflare plugin.
Expand Down
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# @param environment An optional array of environment variables
# @param package_name Name of package and command to use when installing the client package.
# @param package_ensure The value passed to `ensure` when installing the client package.
# @param dnfmodule_version The yum module stream version to enable on EL8 and greater variants using the `package` method with the `dnfmodule` provider.
# @param package_command Path or name for letsencrypt executable.
# @param config_file The path to the configuration file for the letsencrypt cli.
# @param config A hash representation of the letsencrypt configuration file.
Expand Down Expand Up @@ -57,6 +58,7 @@
Array $environment = [],
String $package_name = 'certbot',
$package_ensure = 'installed',
String[1] $dnfmodule_version = 'python36',
String $package_command = 'certbot',
Stdlib::Unixpath $config_dir = '/etc/letsencrypt',
String $config_file = "${config_dir}/cli.ini",
Expand Down
11 changes: 11 additions & 0 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,23 @@
# @param configure_epel A feature flag to include the 'epel' class and depend on it for package installation.
# @param package_ensure The value passed to `ensure` when installing the client package.
# @param package_name Name of package to use when installing the client package.
# @param dnfmodule_version The yum module stream version to enable on EL8 and greater variants using the `package` method with the `dnfmodule` provider.
#
class letsencrypt::install (
Boolean $configure_epel = $letsencrypt::configure_epel,
String $package_name = $letsencrypt::package_name,
String $package_ensure = $letsencrypt::package_ensure,
String[1] $dnfmodule_version = $letsencrypt::dnfmodule_version,
) {
if ($facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] >= '8') {
package { 'enable python module stream':
name => $dnfmodule_version,
enable_only => true,
provider => 'dnfmodule',
before => Package['letsencrypt'],
}
}

package { 'letsencrypt':
ensure => $package_ensure,
name => $package_name,
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"requirements": [
{
"name": "puppet",
"version_requirement": ">= 6.1.0 < 8.0.0"
"version_requirement": ">= 6.15.0 < 8.0.0"
}
],
"dependencies": [
Expand Down
10 changes: 9 additions & 1 deletion spec/classes/letsencrypt_install_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
{
configure_epel: false,
package_ensure: 'installed',
package_name: 'letsencrypt'
package_name: 'letsencrypt',
dnfmodule_version: 'python36'
}
end
let(:additional_params) { {} }
Expand Down Expand Up @@ -44,6 +45,13 @@
is_expected.to contain_package('letsencrypt').that_requires('Class[epel]')
end
end

case facts[:operatingsystemmajrelease]
when '7'
it { is_expected.not_to contain_package('enable python module stream').with_name('python36') }
when '8'
it { is_expected.to contain_package('enable python module stream').with_name('python36').with_enable_only('true').with_provider('dnfmodule') }
end
end
end
end
Expand Down

0 comments on commit b28f212

Please sign in to comment.