Several kubectl fixes (#40882)

* Fixed typo

* Fixed namespace parameter and tmp dir
This commit is contained in:
Pavel Eremeev 2018-07-12 00:06:26 +01:00 committed by Will Thames
parent 765a5130d5
commit 2a90bea311

View file

@ -70,7 +70,7 @@ class K8sInventoryHelper(K8sAnsibleMixin):
client = self.get_api_client(**connection) client = self.get_api_client(**connection)
name = connection.get('name', self.get_default_host_name(client.configuration.host)) name = connection.get('name', self.get_default_host_name(client.configuration.host))
if connection.get('namespaces'): if connection.get('namespaces'):
namespaces = connections['namespaces'] namespaces = connection['namespaces']
else: else:
namespaces = self.get_available_namespaces(client) namespaces = self.get_available_namespaces(client)
for namespace in namespaces: for namespace in namespaces:
@ -157,11 +157,14 @@ class K8sInventoryHelper(K8sAnsibleMixin):
if container.state.waiting: if container.state.waiting:
self.inventory.set_variable(container_name, 'container_state', 'Waiting') self.inventory.set_variable(container_name, 'container_state', 'Waiting')
self.inventory.set_variable(container_name, 'container_ready', container.ready) self.inventory.set_variable(container_name, 'container_ready', container.ready)
self.inventory.set_variable(container_name, 'ansible_remote_tmp', '/tmp/')
self.inventory.set_variable(container_name, 'ansible_connection', self.transport) self.inventory.set_variable(container_name, 'ansible_connection', self.transport)
self.inventory.set_variable(container_name, 'ansible_{0}_pod'.format(self.transport), self.inventory.set_variable(container_name, 'ansible_{0}_pod'.format(self.transport),
pod_name) pod_name)
self.inventory.set_variable(container_name, 'ansible_{0}_container'.format(self.transport), self.inventory.set_variable(container_name, 'ansible_{0}_container'.format(self.transport),
container.name) container.name)
self.inventory.set_variable(container_name, 'ansible_{0}_namespace'.format(self.transport),
namespace)
def get_services_for_namespace(self, client, name, namespace): def get_services_for_namespace(self, client, name, namespace):
v1_service = client.resources.get(api_version='v1', kind='Service') v1_service = client.resources.get(api_version='v1', kind='Service')