Skip to content

Commit c4194c2

Browse files
committed
(CAT-2476) Address SLES agent installation failure
Fix SLES agent installation issues by ensuring /etc/zypp/credentials.d/PuppetcoreCreds exists The puppet_agent install_shell.sh task silently fails on SLES systems when the PuppetcoreCreds file is missing. This fix touches the required file before running the agent installation task on SLES targets.
1 parent de7ef27 commit c4194c2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/puppet_litmus/rake_helper.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,19 @@ def install_agent(collection, targets, inventory_hash)
143143
raise 'puppetcore agent installs require a valid PUPPET_FORGE_TOKEN set in the env.' \
144144
if collection =~ /\Apuppetcore.*/ && !forge_token
145145

146+
# Fix for SLES systems - ensure credentials file exists before agent installation
147+
targets.each do |target|
148+
node_facts = facts_from_node(inventory_hash, target)
149+
next unless node_facts && node_facts['platform'] =~ /sles/i
150+
151+
result = run_command('touch /etc/zypp/credentials.d/PuppetcoreCreds',
152+
target, config: DEFAULT_CONFIG_DATA, inventory: inventory_hash.clone)
153+
raise_bolt_errors(result, "Failed to create Puppet credentials file on SLES target #{target}.")
154+
end
155+
146156
# using boltspec, when the runner is called it changes the inventory_hash dropping the version field. The clone works around this
147157
bolt_result = run_task('puppet_agent::install', targets, params, config: DEFAULT_CONFIG_DATA, inventory: inventory_hash.clone)
158+
148159
targets.each do |target|
149160
params = {
150161
'path' => '/opt/puppetlabs/bin'

0 commit comments

Comments
 (0)