Fixed private option in inventory plugin

Story: 2010614
Task: 47538
Change-Id: I64e1b3ce5323ca8e351ee9faef4bddbef53dfd5d
This commit is contained in:
Jakob Meng 2023-03-06 21:07:23 +01:00
parent 497f020100
commit 62c0169e64

View File

@ -293,10 +293,6 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
clouds = [openstack.connection.Connection(config=cloud_region) clouds = [openstack.connection.Connection(config=cloud_region)
for cloud_region in cloud_regions] for cloud_region in cloud_regions]
if self.get_option('private'):
for cloud in self.clouds:
cloud.private = True
self.display.vvvv( self.display.vvvv(
'Found {0} OpenStack cloud(s)' 'Found {0} OpenStack cloud(s)'
.format(len(clouds))) .format(len(clouds)))
@ -393,7 +389,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
if address['OS-EXT-IPS:type'] == 'fixed'), if address['OS-EXT-IPS:type'] == 'fixed'),
None) None)
ip = floating_ip if floating_ip is not None else fixed_ip ip = floating_ip if floating_ip is not None and not self.get_option('private') else fixed_ip
if ip is not None: if ip is not None:
host_vars['ansible_ssh_host'] = ip host_vars['ansible_ssh_host'] = ip