Skip to content

Commit

Permalink
Merge pull request #1110 from lsst-it/IT-5219/enc-to-puppetdb
Browse files Browse the repository at this point in the history
(profile::core::node_info) fwv
  • Loading branch information
jhoblitt authored Apr 4, 2024
2 parents 807fcf7 + 9b1acab commit d0ae681
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 2 deletions.
1 change: 1 addition & 0 deletions site/profile/manifests/core/common.pp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
include profile::core::kernel
include profile::core::keytab
include profile::core::nm_dispatch
include profile::core::node_info
include profile::core::selinux
include profile::core::systemd
include rsyslog
Expand Down
22 changes: 22 additions & 0 deletions site/profile/manifests/core/node_info.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# @summary
# This empty class exists solely as a vehicle for shipping enc data to puppetdb.
#
# Note that the facts hash does not contain enc parameters and they must be
# accessed as top scoped variables.
#
# @param site
# @param role
# @param cluster
# @param variant
# @param subvariant
#
# lint:ignore:top_scope_facts
class profile::core::node_info (
Optional[String[1]] $site = $::site,
Optional[String[1]] $role = $::role,
Optional[String[1]] $cluster = $::cluster,
Optional[String[1]] $variant = $::variant,
Optional[String[1]] $subvariant = $::subvariant,
) {
# lint:endignore
}
3 changes: 2 additions & 1 deletion spec/classes/ccs/common_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
describe 'profile::ccs::common' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { override_facts(os_facts, site: 'ls') }
let(:facts) { os_facts }
let(:node_params) { { site: 'ls' } }
let(:pre_condition) do
<<~PP
include ssh
Expand Down
3 changes: 2 additions & 1 deletion spec/classes/ccs/el9_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
next unless os =~ %r{almalinux-9-x86_64}

context "on #{os}" do
let(:facts) { override_facts(os_facts, site: 'ls') }
let(:facts) { os_facts }
let(:node_params) { { site: 'ls' } }
let(:pre_condition) do
<<~PP
include ssh
Expand Down
20 changes: 20 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ def hiera_files_in_layer(layer)
Puppet.settings[:strict] = :warning
end
c.filter_run_excluding(bolt: true) unless ENV['GEM_BOLT']
# stub out enc parameters which will show up as top level variables, if set.
c.default_node_params = {
role: nil,
site: nil,
cluster: nil,
variant: nil,
subvariant: nil,
}
end

# Disable rspec-puppet coverage reporting which is hardwired as enabled here:
Expand Down Expand Up @@ -419,6 +427,18 @@ def node_files

it { is_expected.to contain_class('systemd').with_manage_udevd(true) }
it { is_expected.to contain_class('sudo').with_purge(true) }

# All host spec are expected to set the role & site node params. The other
# node params will vary per host spec.
it do
is_expected.to contain_class('profile::core::node_info').with(
role: node_params[:role],
site: node_params[:site],
cluster: node_params[:cluster],
variant: node_params[:variant],
subvariant: node_params[:subvariant],
)
end
end

shared_examples 'lhn sysctls', :lhn_node do
Expand Down

0 comments on commit d0ae681

Please sign in to comment.