Skip to content

Commit dcaaf36

Browse files
committed
fix(plan): add await block to ensure parallel tasks completion in add_inventory_hostnames
- Wrap parallelize block with await to ensure all tasks complete before proceeding - Add notification to indicate inventory update completion
1 parent ce44b21 commit dcaaf36

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

spec/acceptance/peadm_spec/plans/add_inventory_hostnames.pp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@
44
$t = get_targets('*')
55
wait_until_available($t)
66

7-
parallelize($t) |$target| {
8-
$fqdn = run_command('hostname -f', $target)
9-
$target.set_var('certname', $fqdn.first['stdout'].chomp)
10-
$command = "yq eval '(.groups[].targets[] | select(.uri == \"${target.uri}\").name) = \"${target.vars['certname']}\"' -i ${inventory_file}"
11-
run_command($command, 'localhost')
12-
}
7+
await(
8+
parallelize($t) |$target| {
9+
$fqdn = run_command('hostname -f', $target)
10+
$target.set_var('certname', $fqdn.first['stdout'].chomp)
11+
$command = "yq eval '(.groups[].targets[] | select(.uri == \"${target.uri}\").name) = \"${target.vars['certname']}\"' -i ${inventory_file}"
12+
run_command($command, 'localhost')
13+
}
14+
)
15+
notify { 'Inventory updated': }
1316
}

0 commit comments

Comments
 (0)