mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
fixed some breaks after merging ansible/devel
This commit is contained in:
parent
cd2c140f69
commit
870160b8ed
2 changed files with 15 additions and 9 deletions
|
@ -50,7 +50,6 @@ except ImportError:
|
||||||
|
|
||||||
MAGIC_VARIABLE_MAPPING = dict(
|
MAGIC_VARIABLE_MAPPING = dict(
|
||||||
connection = ('ansible_connection',),
|
connection = ('ansible_connection',),
|
||||||
docker_extra_args = ('ansible_docker_extra_args',),
|
|
||||||
remote_addr = ('ansible_ssh_host', 'ansible_host'),
|
remote_addr = ('ansible_ssh_host', 'ansible_host'),
|
||||||
remote_user = ('ansible_ssh_user', 'ansible_user'),
|
remote_user = ('ansible_ssh_user', 'ansible_user'),
|
||||||
port = ('ansible_ssh_port', 'ansible_port'),
|
port = ('ansible_ssh_port', 'ansible_port'),
|
||||||
|
@ -66,6 +65,7 @@ MAGIC_VARIABLE_MAPPING = dict(
|
||||||
become_exe = ('ansible_become_exe',),
|
become_exe = ('ansible_become_exe',),
|
||||||
become_flags = ('ansible_become_flags',),
|
become_flags = ('ansible_become_flags',),
|
||||||
ssh_common_args = ('ansible_ssh_common_args',),
|
ssh_common_args = ('ansible_ssh_common_args',),
|
||||||
|
docker_extra_args= ('ansible_docker_extra_args',),
|
||||||
sftp_extra_args = ('ansible_sftp_extra_args',),
|
sftp_extra_args = ('ansible_sftp_extra_args',),
|
||||||
scp_extra_args = ('ansible_scp_extra_args',),
|
scp_extra_args = ('ansible_scp_extra_args',),
|
||||||
ssh_extra_args = ('ansible_ssh_extra_args',),
|
ssh_extra_args = ('ansible_ssh_extra_args',),
|
||||||
|
@ -258,9 +258,6 @@ class PlayContext(Base):
|
||||||
lower precedence than those set on the play or host.
|
lower precedence than those set on the play or host.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
if options.connection:
|
|
||||||
self.connection = options.connection
|
|
||||||
|
|
||||||
# privilege escalation
|
# privilege escalation
|
||||||
self.become = options.become
|
self.become = options.become
|
||||||
self.become_method = options.become_method
|
self.become_method = options.become_method
|
||||||
|
|
|
@ -68,10 +68,10 @@ class Connection(ConnectionBase):
|
||||||
# root.
|
# root.
|
||||||
|
|
||||||
if 'docker_command' in kwargs:
|
if 'docker_command' in kwargs:
|
||||||
self.docker_cmd = [kwargs['docker_command']]
|
self.docker_cmd = kwargs['docker_command']
|
||||||
else:
|
else:
|
||||||
self.docker_cmd = [distutils.spawn.find_executable('docker')]
|
self.docker_cmd = distutils.spawn.find_executable('docker')
|
||||||
if not self.docker_cmd[0]:
|
if not self.docker_cmd:
|
||||||
raise AnsibleError("docker command not found in PATH")
|
raise AnsibleError("docker command not found in PATH")
|
||||||
|
|
||||||
docker_version = self._get_docker_version()
|
docker_version = self._get_docker_version()
|
||||||
|
@ -106,7 +106,13 @@ class Connection(ConnectionBase):
|
||||||
|
|
||||||
def _get_docker_version(self):
|
def _get_docker_version(self):
|
||||||
|
|
||||||
cmd = self.docker_cmd + ['version']
|
cmd = [self.docker_cmd]
|
||||||
|
|
||||||
|
if self._play_context.docker_extra_args:
|
||||||
|
cmd += self._play_context.docker_extra_args.split(' ')
|
||||||
|
|
||||||
|
cmd += ['version']
|
||||||
|
|
||||||
cmd_output = subprocess.check_output(cmd)
|
cmd_output = subprocess.check_output(cmd)
|
||||||
|
|
||||||
for line in cmd_output.split('\n'):
|
for line in cmd_output.split('\n'):
|
||||||
|
@ -114,7 +120,10 @@ class Connection(ConnectionBase):
|
||||||
return self._sanitize_version(line.split()[2])
|
return self._sanitize_version(line.split()[2])
|
||||||
|
|
||||||
# no result yet, must be newer Docker version
|
# no result yet, must be newer Docker version
|
||||||
new_docker_cmd = self.docker_cmd + ['version', '--format', "'{{.Server.Version}}'"]
|
new_docker_cmd = [
|
||||||
|
self.docker_cmd,
|
||||||
|
'version', '--format', "'{{.Server.Version}}'"
|
||||||
|
]
|
||||||
|
|
||||||
cmd_output = subprocess.check_output(new_docker_cmd)
|
cmd_output = subprocess.check_output(new_docker_cmd)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue