Skip to content

Commit 6ab4841

Browse files
committed
add sles bugfix
1 parent fb6f13c commit 6ab4841

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/puppet_litmus/rake_helper.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,20 @@ 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+
puts "Creating Puppet credentials file on SLES target #{target}."
152+
result = run_command('touch /etc/zypp/credentials.d/PuppetcoreCreds',
153+
target, config: DEFAULT_CONFIG_DATA, inventory: inventory_hash.clone)
154+
raise_bolt_errors(result, "Failed to create Puppet credentials file on SLES target #{target}.")
155+
end
156+
146157
# using boltspec, when the runner is called it changes the inventory_hash dropping the version field. The clone works around this
147158
bolt_result = run_task('puppet_agent::install', targets, params, config: DEFAULT_CONFIG_DATA, inventory: inventory_hash.clone)
159+
148160
targets.each do |target|
149161
params = {
150162
'path' => '/opt/puppetlabs/bin'

0 commit comments

Comments
 (0)