From afdd48b23683d2b5110fa08897bb2815e2a6523e Mon Sep 17 00:00:00 2001 From: Theo Chatzimichos Date: Feb 05 2018 14:02:00 +0000 Subject: bin/get_valid_custom_grains.py: add support for multiple virt_cluster there exist more than one virt_cluster per location. This commit takes into account the case where virt_cluster is a list, and creates more than one entry per location with different virt_cluster each time --- diff --git a/bin/get_valid_custom_grains.py b/bin/get_valid_custom_grains.py index 64aedb3..783b99d 100755 --- a/bin/get_valid_custom_grains.py +++ b/bin/get_valid_custom_grains.py @@ -22,7 +22,11 @@ def print_valid_localized_grains(): results = [] all_valid_localized_grains = get_all_valid_localized_grains() for country, items in all_valid_localized_grains.items(): - results.append('%s,%s' % (country, ','.join(items.values()))) + if type(items['virt_cluster']) == str: + results.append('%s,%s,%s' % (country, items['city'], items['virt_cluster'])) + elif type(items['virt_cluster']) == list: + for virt_cluster in items['virt_cluster']: + results.append('%s,%s,%s' % (country, items['city'], virt_cluster)) print('\n'.join(results))