From ad803ab716448e2dfaa446d732f64c6bd851cb05 Mon Sep 17 00:00:00 2001 From: Giulio Fidente Date: Thu, 7 Feb 2019 09:01:32 +0100 Subject: [PATCH] Sanitize the uuid string for ceph-ansible dmidecode can return some additional data if SMBIOS is updated; this ensures output matches the UUID format. Change-Id: I5c61c0049bfd16114894cf4db3b79f94b6d9291b Related-Bug: 1762460 --- docker/services/ceph-ansible/ceph-base.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/services/ceph-ansible/ceph-base.yaml b/docker/services/ceph-ansible/ceph-base.yaml index 7b96d044e6..a7132b2c9a 100644 --- a/docker/services/ceph-ansible/ceph-base.yaml +++ b/docker/services/ceph-ansible/ceph-base.yaml @@ -446,7 +446,8 @@ outputs: set_fact: nodes_data: "{% raw %}{{ lookup('file','./nodes_uuid_data.json') | from_json }}{% endraw %}" - name: register machine id - command: dmidecode -s system-uuid | tr A-F a-f + # awk strips unwanted output, see LP bug #1762460 + shell: 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 register: machine_uuid # NOTE(tonyb): 0 == no error, 1 == -EPERM or bad data and 2 == Command not found # 1 and 2 aren't great but shouldn't cause the deploy to fail. If we're using