mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix problem with jail and zone connection plugins and symlinks from within the jail/zone.
This commit is contained in:
parent
ca2f2c4ebd
commit
0777d02505
2 changed files with 18 additions and 7 deletions
|
@ -59,8 +59,6 @@ class Connection(object):
|
|||
# remove \n
|
||||
return stdout[:-1]
|
||||
|
||||
|
||||
|
||||
def __init__(self, runner, host, port, *args, **kwargs):
|
||||
self.jail = host
|
||||
self.runner = runner
|
||||
|
@ -137,7 +135,10 @@ class Connection(object):
|
|||
vvv("PUT %s TO %s" % (in_path, out_path), host=self.jail)
|
||||
|
||||
with open(in_path, 'rb') as in_file:
|
||||
p = self._buffered_exec_command('dd of=%s' % out_path, None, stdin=in_file)
|
||||
try:
|
||||
p = self._buffered_exec_command('dd of=%s' % out_path, None, stdin=in_file)
|
||||
except OSError:
|
||||
raise errors.AnsibleError("jail connection requires dd command in the jail")
|
||||
try:
|
||||
stdout, stderr = p.communicate()
|
||||
except:
|
||||
|
@ -152,7 +153,10 @@ class Connection(object):
|
|||
vvv("FETCH %s TO %s" % (in_path, out_path), host=self.jail)
|
||||
|
||||
|
||||
p = self._buffered_exec_command('dd if=%s bs=%s' % (in_path, BUFSIZE), None)
|
||||
try:
|
||||
p = self._buffered_exec_command('dd if=%s bs=%s' % (in_path, BUFSIZE), None)
|
||||
except OSError:
|
||||
raise errors.AnsibleError("jail connection requires dd command in the jail")
|
||||
|
||||
with open(out_path, 'wb+') as out_file:
|
||||
try:
|
||||
|
|
|
@ -148,7 +148,10 @@ class Connection(object):
|
|||
vvv("PUT %s TO %s" % (in_path, out_path), host=self.zone)
|
||||
|
||||
with open(in_path, 'rb') as in_file:
|
||||
p = self._buffered_exec_command('dd of=%s' % out_path, None, stdin=in_file)
|
||||
try:
|
||||
p = self._buffered_exec_command('dd of=%s' % out_path, None, stdin=in_file)
|
||||
except OSError:
|
||||
raise errors.AnsibleError("zone connection requires dd command in the zone")
|
||||
try:
|
||||
stdout, stderr = p.communicate()
|
||||
except:
|
||||
|
@ -163,7 +166,11 @@ class Connection(object):
|
|||
vvv("FETCH %s TO %s" % (in_path, out_path), host=self.zone)
|
||||
|
||||
|
||||
p = self._buffered_exec_command('dd if=%s bs=%s' % (in_path, BUFSIZE), None)
|
||||
try:
|
||||
p = self._buffered_exec_command('dd if=%s bs=%s' % (in_path, BUFSIZE), None)
|
||||
except OSError:
|
||||
raise errors.AnsibleError("zone connection requires dd command in the zone")
|
||||
|
||||
|
||||
with open(out_path, 'wb+') as out_file:
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue