From 0aa5d8ed45880d6004e4958842fa7b9686adaff5 Mon Sep 17 00:00:00 2001 From: Artem Goncharov Date: Wed, 18 Jul 2018 13:37:04 +0200 Subject: [PATCH] fixes #42042 do not create group with region name if it is not given Backport https://github.com/ansible/ansible/pull/42939 (cherry picked from commit d3f53b4b9f6167c359dae1069cb71eb10d00afc0) --- 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 00000000000..65ed6458fd6 --- /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 086af9b0929..c3b5abcb8ad 100644 --- a/lib/ansible/plugins/inventory/openstack.py +++ b/lib/ansible/plugins/inventory/openstack.py @@ -254,7 +254,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))