From 6667ec447466abf1641787afccf9175369319d1f Mon Sep 17 00:00:00 2001 From: Artem Goncharov Date: Fri, 27 Jul 2018 16:02:34 +0200 Subject: [PATCH] fixes #42042 (#42939) Do not create group with empty name when region (optional argument) is not given in the openstack connection --- changelogs/fragments/42042-inventory_with_no_region.yaml | 2 ++ lib/ansible/plugins/inventory/openstack.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/42042-inventory_with_no_region.yaml diff --git a/changelogs/fragments/42042-inventory_with_no_region.yaml b/changelogs/fragments/42042-inventory_with_no_region.yaml new file mode 100644 index 0000000000..65ed6458fd --- /dev/null +++ b/changelogs/fragments/42042-inventory_with_no_region.yaml @@ -0,0 +1,2 @@ +bugfixes: +- plugins/inventory/openstack.py - Do not create group with empty name if region is not set diff --git a/lib/ansible/plugins/inventory/openstack.py b/lib/ansible/plugins/inventory/openstack.py index b2ad6c2ebd..6105a88395 100644 --- a/lib/ansible/plugins/inventory/openstack.py +++ b/lib/ansible/plugins/inventory/openstack.py @@ -258,7 +258,8 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): groups.append(cloud) # Create a group on region - groups.append(region) + if region: + groups.append(region) # And one by cloud_region groups.append("%s_%s" % (cloud, region))