Skip to content

Commit 41ce8ec

Browse files
authored
Merge pull request #613 from puppetlabs/CAT-2476-Address_SLES_agent_installation_failures
(CAT-2476) Address SLES agent installation failure
2 parents de7ef27 + c4194c2 commit 41ce8ec

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)