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 5c740f1
Show file tree
Hide file tree
Showing 2 changed files with 60 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',
}
}
36 changes: 36 additions & 0 deletions spec/acceptance/class_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,42 @@ class { 'nodejs':
end
end

context 'RedHat with repo_class => nodejs::repo::dnfmodule', if: fact('os.family') == 'RedHat' && %w[8 9].include?(fact('os.release.major')) do
include_examples 'cleanup'

# Node 20 is only available in Stream yet, not in a released EL
# So we're testing 18 here
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',
repo_version => '18',
}
PUPPET
end
end

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

it 'comes from the expected source' do
pkg_output = shell(pkg_cmd)
expect(pkg_output.stdout).to match 'appstream'
end
end
end
end

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

Expand Down

0 comments on commit 5c740f1

Please sign in to comment.