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 7c26002 commit 085ce40
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
23 changes: 23 additions & 0 deletions manifests/repo/dnfmodule.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# @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 nodejs dnf 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,

Check warning on line 19 in manifests/repo/dnfmodule.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

indentation of => is not properly aligned (expected in column 14, but found it in column 17) (check: arrow_alignment)
name => $module,

Check warning on line 20 in manifests/repo/dnfmodule.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

indentation of => is not properly aligned (expected in column 14, but found it in column 17) (check: arrow_alignment)
provider => 'dnfmodule',

Check warning on line 21 in manifests/repo/dnfmodule.pp

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

indentation of => is not properly aligned (expected in column 14, but found it in column 17) (check: arrow_alignment)
}
}
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 085ce40

Please sign in to comment.