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

This commit is contained in:
Alan Rominger 2019-01-11 12:26:53 -05:00 committed by John R Barker
parent 64bacb0e02
commit be5b7889f9
3 changed files with 7 additions and 2 deletions

View file

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

View file

@ -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:

View file

@ -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: