mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix mixed output from ansible and lxd when using the lxd connection plugin (#45246)
* Replace fetch and put operations with Popen instead of call to prevent lxd to mess the Ansible output * Remove extra blank line
This commit is contained in:
parent
be199cfe90
commit
af40d8c2a5
1 changed files with 5 additions and 3 deletions
|
@ -31,7 +31,7 @@ DOCUMENTATION = """
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from distutils.spawn import find_executable
|
from distutils.spawn import find_executable
|
||||||
from subprocess import call, Popen, PIPE
|
from subprocess import Popen, PIPE
|
||||||
|
|
||||||
from ansible.errors import AnsibleError, AnsibleConnectionFailure, AnsibleFileNotFound
|
from ansible.errors import AnsibleError, AnsibleConnectionFailure, AnsibleFileNotFound
|
||||||
from ansible.module_utils._text import to_bytes, to_text
|
from ansible.module_utils._text import to_bytes, to_text
|
||||||
|
@ -103,7 +103,8 @@ class Connection(ConnectionBase):
|
||||||
|
|
||||||
local_cmd = [to_bytes(i, errors='surrogate_or_strict') for i in local_cmd]
|
local_cmd = [to_bytes(i, errors='surrogate_or_strict') for i in local_cmd]
|
||||||
|
|
||||||
call(local_cmd)
|
process = Popen(local_cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)
|
||||||
|
process.communicate()
|
||||||
|
|
||||||
def fetch_file(self, in_path, out_path):
|
def fetch_file(self, in_path, out_path):
|
||||||
""" fetch a file from lxd to local """
|
""" fetch a file from lxd to local """
|
||||||
|
@ -115,7 +116,8 @@ class Connection(ConnectionBase):
|
||||||
|
|
||||||
local_cmd = [to_bytes(i, errors='surrogate_or_strict') for i in local_cmd]
|
local_cmd = [to_bytes(i, errors='surrogate_or_strict') for i in local_cmd]
|
||||||
|
|
||||||
call(local_cmd)
|
process = Popen(local_cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)
|
||||||
|
process.communicate()
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
""" close the connection (nothing to do here) """
|
""" close the connection (nothing to do here) """
|
||||||
|
|
Loading…
Reference in a new issue