Comment 4 for bug 2036447

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to openstack-armada-app (f/antelope)

Reviewed: https://review.opendev.org/c/starlingx/openstack-armada-app/+/895786
Committed: https://opendev.org/starlingx/openstack-armada-app/commit/c4c0ad9e042dbf6b3a658cf5331646dd050dee43
Submitter: "Zuul (22348)"
Branch: f/antelope

commit c4c0ad9e042dbf6b3a658cf5331646dd050dee43
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/4c238a8063c27815954c3aa151cdcae7dd5f67cb/stx-openstack-helm-fluxcd/stx-openstack-helm-fluxcd/helm-charts/clients/templates/bin/_clients-wrapper.sh.tpl#L63-L64
    [2] https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html

    Test Plan:
    PASS - Build stx-openstack-helm-fluxcd package
    PASS - Build stx-openstack helm charts
    PASS - Upload/apply stx-openstack
    PASS - Source `/var/opt/openstack/admin-openrc`
    PASS - Run command with multi-word option(s), e.g.:
           $ openstack project create \
             --description="words separated by space" my_project
           and confirm that it's executed successfully
    PASS - Remove/delete stx-openstack

    Closes-Bug: 2036447

    Change-Id: I6441cf077e0bcfe386d7086ea90298e6dd247a2a
    Signed-off-by: Luan Nunes Utimura <email address hidden>
    (cherry picked from commit 670ec0c6e598b3c872d2206392bd37b239e2fc28)