Skip to content

Commit

Permalink
add dnfmodule repo implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeni committed Oct 29, 2023
1 parent 6bdf0de commit ba1e2db
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
24 changes: 24 additions & 0 deletions manifests/repo/dnfmodule.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# @summary Manage the DNF module
#
# On EL8+ DNF can manage modules.
# This is a method of providing multiple versions on the same OS.
# Only one DNF module stream can be active at the same time.
#
# @param ensure
# Value of ensure parameter for redis dns module package
#
# @param module
# Name of the nodejs dnf package
#
# @api private
class nodejs::repo::dnfmodule (
String[1] $ensure = $nodejs::repo_version,
String[1] $module = 'nodejs',
) {
package { 'nodejs dnf module':
ensure => $ensure,
name => $module,
enable_only => true,
provider => 'dnfmodule',
}
}
28 changes: 28 additions & 0 deletions spec/acceptance/class_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,34 @@ class { 'nodejs':
end
end

context 'RedHat with repo_class => nodejs::repo::dnfmodule', if: fact('os.family') == 'RedHat' && fact('os.release.major') in ['8', '9'] do

Check failure on line 68 in spec/acceptance/class_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Lint/Syntax: unexpected token kIN (Using Ruby 2.6 parser; configure using `TargetRubyVersion` parameter, under `AllCops`)

Check failure on line 68 in spec/acceptance/class_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Lint/Syntax: unexpected token kDO (Using Ruby 2.6 parser; configure using `TargetRubyVersion` parameter, under `AllCops`)
include_examples 'cleanup'

it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-PUPPET
class { 'nodejs':
nodejs_dev_package_ensure => installed,
npm_package_ensure => installed,
repo_class => 'nodejs::repo::dnfmodule',
}
PUPPET
end
end

%w[
npm
nodejs
nodejs-devel
].each do |pkg|
describe package(pkg) do
it do
is_expected.to be_installed
end
end
end
end

Check failure on line 94 in spec/acceptance/class_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Lint/Syntax: unexpected token kEND (Using Ruby 2.6 parser; configure using `TargetRubyVersion` parameter, under `AllCops`)

context 'Debian distribution packages', if: fact('os.family') == 'Debian' do
before(:context) { purge_node }

Expand Down

0 comments on commit ba1e2db

Please sign in to comment.