Skip to content

Commit 8a020e5

Browse files
(CAT-2052 Pass target container URI instead of container SHA ID to add_feature_to_node() method
There is a bug in the 'install_agent' task. It is supposed to install the agent on a host (a VM or a docker container) using bolt and then add the 'puppet-agent' feature to the host in the litmus_inventory file. Bolt returns the SHA ID of the container instead of the localhost URI after it installs the agent. The feature is added through the add_feature_to_node() method. The last parameter of the method is being sent as result["target"]. This is fine in the case of VMs since its their IPv4 address and the method is expecting just that. But in case of docker containers it is their SHA container ID and the method expecting the localhost:{port} URI. This results in the feature not being added to the host. Since bolt is returning the results in the same order it is provided the input 'targets', we can add the feature by indexing the 'targets' array in that order. See https://perforce.atlassian.net/browse/CAT-2052?focusedCommentId=2970824
1 parent 6700713 commit 8a020e5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/puppet_litmus/rake_tasks.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@
128128
Rake::Task['spec_prep'].invoke
129129

130130
results = install_agent(args[:collection], targets, inventory_hash)
131+
target_index = 0
131132
results.each do |result|
132133
command_to_run = "bolt task run puppet_agent::install --targets #{result['target']} --inventoryfile spec/fixtures/litmus_inventory.yaml --modulepath #{DEFAULT_CONFIG_DATA['modulepath']}"
133134
raise "Failed on #{result['target']}\n#{result}\ntry running '#{command_to_run}'" if result['status'] != 'success'
@@ -157,7 +158,8 @@
157158
end
158159

159160
# add puppet-agent feature to successful nodes
160-
inventory_hash = add_feature_to_node(inventory_hash, 'puppet-agent', result['target'])
161+
inventory_hash = add_feature_to_node(inventory_hash, 'puppet-agent', targets[target_index])
162+
target_index += 1
161163
end
162164

163165
# update the inventory with the puppet-agent feature set per node

0 commit comments

Comments
 (0)