From c8c14eab620ed04073f0ea531fa5a8c6ade4f9f8 Mon Sep 17 00:00:00 2001 From: Roberto Alfieri Date: Tue, 7 May 2024 19:15:30 +0200 Subject: [PATCH] Use `$node.hostName` if `$node.ansible.ansibleHost` isn't available If in the `openstackdataplanenodesets` resources the `$node.ansible.ansibleHost` is not defined, the must-gather from the compute nodes fails with this kind of error: ``` [must-gather-27lcm] POD 2024-04-26T22:51:13.104464074Z /usr/bin/bg.sh: eval: line 30: syntax error near unexpected token `(' [must-gather-27lcm] POD 2024-04-26T22:51:13.104464074Z /usr/bin/bg.sh: eval: line 30: `gather_edpm_sos compute-0 %!s() zuul dataplane-ansible-ssh-private-key-secret openstack' [must-gather-27lcm] POD 2024-04-26T22:51:13.104464074Z /usr/bin/bg.sh: eval: line 30: syntax error near unexpected token `(' [must-gather-27lcm] POD 2024-04-26T22:51:13.104464074Z /usr/bin/bg.sh: eval: line 30: `gather_edpm_sos compute-1 %!s() zuul dataplane-ansible-ssh-private-key-secret openstack' [must-gather-27lcm] POD 2024-04-26T22:51:13.104464074Z /usr/bin/bg.sh: eval: line 30: syntax error near unexpected token `(' [must-gather-27lcm] POD 2024-04-26T22:51:13.104464074Z /usr/bin/bg.sh: eval: line 30: `gather_edpm_sos compute-2 %!s() zuul dataplane-ansible-ssh-private-key-secret openstack' ``` To avoid this behavior, we are going to pass `$node.hostName` as `address` parameter Signed-off-by: Roberto Alfieri --- collection-scripts/gather_edpm_sos | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collection-scripts/gather_edpm_sos b/collection-scripts/gather_edpm_sos index eab7478..e0eccdb 100755 --- a/collection-scripts/gather_edpm_sos +++ b/collection-scripts/gather_edpm_sos @@ -100,7 +100,7 @@ gather_edpm_sos () { } -data=$(oc get openstackdataplanenodesets --all-namespaces -o go-template='{{range $indexns,$nodeset := .items}}{{range $index,$node := $nodeset.spec.nodes}}{{printf "%s %s %s %s %s\n" $node.hostName $node.ansible.ansibleHost $nodeset.spec.nodeTemplate.ansible.ansibleUser $nodeset.spec.nodeTemplate.ansibleSSHPrivateKeySecret $nodeset.metadata.namespace}}{{end}}{{end}}') +data=$(oc get openstackdataplanenodesets --all-namespaces -o go-template='{{range $indexns,$nodeset := .items}}{{range $index,$node := $nodeset.spec.nodes}}{{printf "%s " $node.hostName}}{{if $node.ansible.ansibleHost}}{{printf "%s " $node.ansible.ansibleHost}}{{else}}{{printf "%s " $node.hostName}}{{end}}{{printf "%s %s %s\n" $nodeset.spec.nodeTemplate.ansible.ansibleUser $nodeset.spec.nodeTemplate.ansibleSSHPrivateKeySecret $nodeset.metadata.namespace}}{{end}}{{end}}') while read -r node address username secret namespace; do [[ -z "$node" ]] && continue