When using container-backed OpenStack CLIs, it has been observed that
commands with multi-word options are failing to run due to poor parsing
of parameters by the wrapper script.
Currently, all commands that are redirected to the clients container are
expanded using the * parameter, i.e., $* [1]. However, according to [2],
a more appropriate option would be to expand the * parameter with the
Q operator, since:
> The expansion is a string that is the value of _parameter_ quoted in
a format that can be reused as input.
Which is exactly what we are doing with the wrapper script -- reusing
inputs but in a containerized environment.
Reviewed: https:/ /review. opendev. org/c/starlingx /openstack- armada- app/+/895786 /opendev. org/starlingx/ openstack- armada- app/commit/ c4c0ad9e042dbf6 b3a658cf5331646 dd050dee43
Committed: https:/
Submitter: "Zuul (22348)"
Branch: f/antelope
commit c4c0ad9e042dbf6 b3a658cf5331646 dd050dee43
Author: Luan Nunes Utimura <email address hidden>
Date: Mon Sep 18 14:06:14 2023 -0300
clients: Fix multi-word option parsing in CLIs
When using container-backed OpenStack CLIs, it has been observed that
commands with multi-word options are failing to run due to poor parsing
of parameters by the wrapper script.
Currently, all commands that are redirected to the clients container are
expanded using the * parameter, i.e., $* [1]. However, according to [2],
a more appropriate option would be to expand the * parameter with the
Q operator, since:
> The expansion is a string that is the value of _parameter_ quoted in
a format that can be reused as input.
Which is exactly what we are doing with the wrapper script -- reusing
inputs but in a containerized environment.
[1] https:/ /opendev. org/starlingx/ openstack- armada- app/src/ commit/ 4c238a8063c2781 5954c3aa151cdca e7dd5f67cb/ stx-openstack- helm-fluxcd/ stx-openstack- helm-fluxcd/ helm-charts/ clients/ templates/ bin/_clients- wrapper. sh.tpl# L63-L64 /www.gnu. org/software/ bash/manual/ html_node/ Shell-Parameter -Expansion. html
[2] https:/
Test Plan: helm-fluxcd package openstack/ admin-openrc`
- -description= "words separated by space" my_project
PASS - Build stx-openstack-
PASS - Build stx-openstack helm charts
PASS - Upload/apply stx-openstack
PASS - Source `/var/opt/
PASS - Run command with multi-word option(s), e.g.:
$ openstack project create \
and confirm that it's executed successfully
PASS - Remove/delete stx-openstack
Closes-Bug: 2036447
Change-Id: I6441cf077e0bcf e386d7086ea9029 8e6dd247a2a 872d2206392bd37 b239e2fc28)
Signed-off-by: Luan Nunes Utimura <email address hidden>
(cherry picked from commit 670ec0c6e598b3c