From 54445470e2a1a065d9d0693849bea5ab748eeada Mon Sep 17 00:00:00 2001 From: David Wilson Date: Wed, 31 Oct 2018 12:40:08 +0000 Subject: [PATCH] issue #409: add missing path config variables to severa plugins So every method can be redirected to a stub implementation. --- ansible_mitogen/connection.py | 9 +++++++++ docs/ansible.rst | 6 ++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ansible_mitogen/connection.py b/ansible_mitogen/connection.py index a651d163..140c901b 100644 --- a/ansible_mitogen/connection.py +++ b/ansible_mitogen/connection.py @@ -172,6 +172,7 @@ def _connect_lxc(spec): 'kwargs': { 'container': spec['remote_addr'], 'python_path': spec['python_path'], + 'lxc_attach_path': spec['mitogen_lxc_attach_path'], 'connect_timeout': spec['ansible_ssh_timeout'] or spec['timeout'], } } @@ -186,6 +187,7 @@ def _connect_lxd(spec): 'kwargs': { 'container': spec['remote_addr'], 'python_path': spec['python_path'], + 'lxc_path': spec['mitogen_lxc_path'], 'connect_timeout': spec['ansible_ssh_timeout'] or spec['timeout'], } } @@ -210,6 +212,7 @@ def _connect_setns(spec): 'python_path': spec['python_path'], 'kind': spec['mitogen_kind'], 'docker_path': spec['mitogen_docker_path'], + 'lxc_path': spec['mitogen_lxc_path'], 'lxc_info_path': spec['mitogen_lxc_info_path'], 'machinectl_path': spec['mitogen_machinectl_path'], } @@ -392,6 +395,10 @@ def config_from_play_context(transport, inventory_name, connection): connection.get_task_var('mitogen_docker_path'), 'mitogen_kubectl_path': connection.get_task_var('mitogen_kubectl_path'), + 'mitogen_lxc_path': + connection.get_task_var('mitogen_lxc_path'), + 'mitogen_lxc_attach_path': + connection.get_task_var('mitogen_lxc_attach_path'), 'mitogen_lxc_info_path': connection.get_task_var('mitogen_lxc_info_path'), 'mitogen_machinectl_path': @@ -427,6 +434,8 @@ def config_from_hostvars(transport, inventory_name, connection, 'mitogen_kind': hostvars.get('mitogen_kind'), 'mitogen_docker_path': hostvars.get('mitogen_docker_path'), 'mitogen_kubectl_path': hostvars.get('mitogen_kubectl_path'), + 'mitogen_lxc_path': hostvars.get('mitogen_lxc_path'), + 'mitogen_lxc_attach_path': hostvars.get('mitogen_lxc_attach_path'), 'mitogen_lxc_info_path': hostvars.get('mitogen_lxc_info_path'), 'mitogen_machinectl_path': hostvars.get('mitogen_machinctl_path'), }) diff --git a/docs/ansible.rst b/docs/ansible.rst index c6e9d553..0918b2f1 100644 --- a/docs/ansible.rst +++ b/docs/ansible.rst @@ -768,10 +768,10 @@ Connect to classic LXC containers, like `lxc connection delegation is supported, and ``lxc-attach`` is always used rather than the LXC Python bindings, as is usual with ``lxc``. -The ``lxc-attach`` command must be available on the host machine. - * ``ansible_python_interpreter`` * ``ansible_host``: Name of LXC container (default: inventory hostname). +* ``mitogen_lxc_attach_path``: path to ``lxc-attach`` command if not available + on the system path. .. _method-lxd: @@ -786,6 +786,8 @@ the host machine. * ``ansible_python_interpreter`` * ``ansible_host``: Name of LXC container (default: inventory hostname). +* ``mitogen_lxc_path``: path to ``lxc`` command if not available on the system + path. .. _machinectl: