Browse Source

Handle case change for dmidecode >= 3.1 in ceph-ansible workbook

Forced lowercase on the dmidecode output matching the UUID
format returned if SMBIOS is updated and added a task inside
the workflow to manipulate the node_data_lookup parameter
(lowercase enforcing).

Change-Id: Ic7ad351a7d564819bc8967045e6a227f158a9ae1
Co-Authored-By: Giulio Fidente <gfidente@redhat.com>
Closes-Bug: 1814070
tags/8.6.8
Francesco Pantano (fmount) 3 months ago
parent
commit
aa92a7f717
1 changed files with 8 additions and 2 deletions
  1. 8
    2
      workbooks/ceph-ansible.yaml

+ 8
- 2
workbooks/ceph-ansible.yaml View File

@@ -108,7 +108,8 @@ workflows:
108 108
               gather_facts: no
109 109
               tasks:
110 110
                 - name: collect machine id
111
-                  command: dmidecode -s system-uuid
111
+                  # awk strips unwanted output, see LP bug #1762460
112
+                  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
112 113
         publish:
113 114
           ansible_output: <% json_parse(task().result.stderr) %>
114 115
         on-success: set_ip_uuids
@@ -121,10 +122,15 @@ workflows:
121 122
           json_node_data_lookup: <% json_parse($.node_data_lookup) %>
122 123
         on-error:
123 124
           - fail(msg=<% 'Ceph deployment stopped, NodeDataLookup (node_data_lookup) is not valid JSON. {0}'.format($.node_data_lookup) %>)
125
+        on-success:
126
+         - uuid_force_lowercase
127
+      uuid_force_lowercase:
128
+        publish:
129
+          node_data: <% dict($.json_node_data_lookup.keys().select($.toLower()).zip($.json_node_data_lookup.values())) %>
124 130
         on-success: map_node_data_lookup
125 131
       map_node_data_lookup:
126 132
         publish:
127
-          ips_data: <% let(uuids => $.ip_uuids, root => $) -> $.ips_list.toDict($, $root.json_node_data_lookup.get($uuids.get($, "NO-UUID-FOUND"), {})) %>
133
+          ips_data: <% let(uuids => $.ip_uuids, root => $) -> $.ips_list.toDict($, $root.node_data.get($uuids.get($, "NO-UUID-FOUND"), {})) %>
128 134
         on-success: set_role_vars
129 135
       set_role_vars:
130 136
         publish:

Loading…
Cancel
Save