Node Specific Overrides for Ceph fail on awk command

Bug #1854209 reported by John Fulton
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
tripleo
Fix Released
High
John Fulton

Bug Description

When using Node Specific Overrides to pass a different
list of devices to a Ceph deployment [1] the additional
devices are not passed to the specific node even though
the UUID is correct.

After investigating I found the awk command that is executed
by ansible is not valid. It executes:

"dmidecode -s system-uuid | awk 'match($0, /[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}/) \\ { print substr($0, RSTART, RLENGTH) }' | tr A-F a-f"

Which returns "backslash not last character on line" [2].

When examining the role [3] which prepares this command however
there is no extra whitespace after the backslashes.

I see the problematic backslash embedded in a pair of single
quotes which is embedded in YAML's block chomping indicator
'>-' (which replaces newlines with spaces and puts no newline
at the end) which is in turn embedded in YAML's block chomping
indicator '|' (which keeps new lines but adds a single newline
at the end) which is provided as the content flag of Ansible's
copy module. It might be safer to just make the awk statement
cover one line.

[1] https://docs.openstack.org/project-deploy-guide/tripleo-docs/latest/features/node_specific_hieradata.html

[2]
TASK [register machine id] ******************************************************************
changed: [undercloud] => {"changed": true, "cmd": "dmidecode -s system-uuid | awk 'match($0, /[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}/) \\ { print substr($0, RSTART, RLENGTH) }' | tr A-F a-f", "delta": "0:00:00.019814", "end": "2019-11-27 16:21:12.453826", "failed_when_result": false, "rc": 0, "start": "2019-11-27 16:21:12.434012", "stderr": "awk: cmd. line:1: match($0, /[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}/) \\ { print substr($0, RSTART, RLENGTH) }\nawk: cmd. line:1: ^ backslash not last character on line\nawk: cmd. line:1: match($0, /[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}/) \\ { print substr($0, RSTART, RLENGTH) }\nawk: cmd. line:1: ^ syntax error", "stderr_lines": ["awk: cmd. line:1: match($0, /[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}/) \\ { print substr($0, RSTART, RLENGTH) }", "awk: cmd. line:1: ^ backslash not last character on line", "awk: cmd. line:1: match($0, /[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}/) \\ { print substr($0, RSTART, RLENGTH) }", "awk: cmd. line:1: ^ syntax error"], "stdout": "", "stdout_lines": []}

[3] https://opendev.org/openstack/tripleo-ansible/src/branch/stable/train/tripleo_ansible/roles/tripleo-ceph-uuid/tasks/prepare.yml#L38

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-ansible (master)

Fix proposed to branch: master
Review: https://review.opendev.org/696391

Changed in tripleo:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-ansible (master)

Reviewed: https://review.opendev.org/696391
Committed: https://git.openstack.org/cgit/openstack/tripleo-ansible/commit/?id=7d935a5be428d7b05be740bd326c3a78e3af3fab
Submitter: Zuul
Branch: master

commit 7d935a5be428d7b05be740bd326c3a78e3af3fab
Author: John Fulton <email address hidden>
Date: Wed Nov 27 19:16:23 2019 +0000

    Remove extra backslash in awk for tripleo-ceph-uuid role

    This backslash caused bug 1854209. Whitespace in the
    multi embedded in YAML is complicated. Seems safer to
    just remove it in this case.

    Change-Id: I8414a776360700b05fb18d73862797b13a58f32d
    Closes-Bug: #1854209

Changed in tripleo:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-ansible (stable/train)

Fix proposed to branch: stable/train
Review: https://review.opendev.org/702015

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-ansible (stable/train)

Reviewed: https://review.opendev.org/702015
Committed: https://git.openstack.org/cgit/openstack/tripleo-ansible/commit/?id=67f5ca46971412d1717fde0549f70dcb5406029d
Submitter: Zuul
Branch: stable/train

commit 67f5ca46971412d1717fde0549f70dcb5406029d
Author: John Fulton <email address hidden>
Date: Wed Nov 27 19:16:23 2019 +0000

    Remove extra backslash in awk for tripleo-ceph-uuid role

    This backslash caused bug 1854209. Whitespace in the
    multi embedded in YAML is complicated. Seems safer to
    just remove it in this case.

    Change-Id: I8414a776360700b05fb18d73862797b13a58f32d
    Closes-Bug: #1854209
    (cherry picked from commit 7d935a5be428d7b05be740bd326c3a78e3af3fab)

tags: added: in-stable-train
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-ansible 1.1.0

This issue was fixed in the openstack/tripleo-ansible 1.1.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-ansible 0.5.0

This issue was fixed in the openstack/tripleo-ansible 0.5.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.