Do not load user kube config if path specified (#49952)

pull/50823/head
Alan Rominger 6 years ago committed by John R Barker
parent 64bacb0e02
commit be5b7889f9

@ -0,0 +1,2 @@
bugfixes:
- openshift inventory plugin - do not default create client if auth parameters were given.

@ -165,7 +165,6 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable, K8sAnsibleM
self.fetch_objects(connections)
def fetch_objects(self, connections):
client = self.get_api_client()
if connections:
if not isinstance(connections, list):
@ -184,6 +183,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable, K8sAnsibleM
self.get_pods_for_namespace(client, name, namespace)
self.get_services_for_namespace(client, name, namespace)
else:
client = self.get_api_client()
name = self.get_default_host_name(client.configuration.host)
namespaces = self.get_available_namespaces(client)
for namespace in namespaces:

@ -123,9 +123,11 @@ class InventoryModule(K8sInventoryModule):
def fetch_objects(self, connections):
super(InventoryModule, self).fetch_objects(connections)
client = self.get_api_client()
if connections:
if not isinstance(connections, list):
raise K8sInventoryException("Expecting connections to be a list.")
for connection in connections:
client = self.get_api_client(**connection)
name = connection.get('name', self.get_default_host_name(client.configuration.host))
@ -136,6 +138,7 @@ class InventoryModule(K8sInventoryModule):
for namespace in namespaces:
self.get_routes_for_namespace(client, name, namespace)
else:
client = self.get_api_client()
name = self.get_default_host_name(client.configuration.host)
namespaces = self.get_available_namespaces(client)
for namespace in namespaces:

Loading…
Cancel
Save