Jelajahi Sumber

Return a openshift_node_labels as a dict

The OpenStack dynamic inventory was setting the
`openshift_node_labels` value as a string which causes a failure with
the `lib_utils_oo_dict_to_keqv_list` filter.

Fixes #6555
Tomas Sedovic 7 tahun lalu
induk
melakukan
ff1d04276b
1 mengubah file dengan 5 tambahan dan 0 penghapusan
  1. 5 0
      playbooks/openstack/sample-inventory/inventory.py

+ 5 - 0
playbooks/openstack/sample-inventory/inventory.py

@@ -9,6 +9,7 @@ environment.
 
 from __future__ import print_function
 
+from collections import Mapping
 import json
 
 import shade
@@ -94,6 +95,10 @@ def build_inventory():
         hostvars['openshift_public_hostname'] = server.name
 
         node_labels = server.metadata.get('node_labels')
+        # NOTE(shadower): the node_labels value must be a dict not string
+        if not isinstance(node_labels, Mapping):
+            node_labels = json.loads(node_labels)
+
         if node_labels:
             hostvars['openshift_node_labels'] = node_labels