mirror of
https://github.com/Rudd-O/ansible-qubes.git
synced 2025-03-01 14:22:33 +01:00
Properly fix the connection plugin.
This commit is contained in:
parent
8a4477fba4
commit
25a088550d
@ -63,7 +63,7 @@ class x(object):
|
|||||||
display = x()
|
display = x()
|
||||||
|
|
||||||
|
|
||||||
BUFSIZE = 1024*1024
|
BUFSIZE = 128*1024 # any bigger and it causes issues because we don't read multiple chunks until completion
|
||||||
CONNECTION_TRANSPORT = "qubes"
|
CONNECTION_TRANSPORT = "qubes"
|
||||||
CONNECTION_OPTIONS = {
|
CONNECTION_OPTIONS = {
|
||||||
'management_proxy': '--management-proxy',
|
'management_proxy': '--management-proxy',
|
||||||
@ -139,6 +139,7 @@ def put(out_path):
|
|||||||
if chunksize == 0:
|
if chunksize == 0:
|
||||||
break
|
break
|
||||||
chunk = sys.stdin.read(chunksize)
|
chunk = sys.stdin.read(chunksize)
|
||||||
|
assert len(chunk) == chunksize, ("Mismatch in chunk length", len(chunk), chunksize)
|
||||||
try:
|
try:
|
||||||
f.write(chunk)
|
f.write(chunk)
|
||||||
sys.stdout.write(b'Y\n')
|
sys.stdout.write(b'Y\n')
|
||||||
@ -152,9 +153,9 @@ def put(out_path):
|
|||||||
except (IOError, OSError) as e:
|
except (IOError, OSError) as e:
|
||||||
sys.stdout.write(b'N\n')
|
sys.stdout.write(b'N\n')
|
||||||
encode_exception(e, sys.stdout)
|
encode_exception(e, sys.stdout)
|
||||||
f.close()
|
|
||||||
return
|
return
|
||||||
f.close()
|
finally:
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
def fetch(in_path, bufsize):
|
def fetch(in_path, bufsize):
|
||||||
@ -179,7 +180,8 @@ def fetch(in_path, bufsize):
|
|||||||
break
|
break
|
||||||
sys.stdout.write(data)
|
sys.stdout.write(data)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
f.close()
|
finally:
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
@ -290,10 +292,6 @@ class Connection(ConnectionBase):
|
|||||||
'''
|
'''
|
||||||
display.vvv("CONNECTING %s %s %s" % (os.getppid(), id(self), self.get_option("management_proxy")), host=self._play_context.remote_addr)
|
display.vvv("CONNECTING %s %s %s" % (os.getppid(), id(self), self.get_option("management_proxy")), host=self._play_context.remote_addr)
|
||||||
super(Connection, self)._connect()
|
super(Connection, self)._connect()
|
||||||
#if self._play_context.remote_addr == 'ring2-buildserver':
|
|
||||||
# assert 0, dir(self)
|
|
||||||
# assert 0, self._play_context.serialize()
|
|
||||||
# assert 0, [x for x in dir(self._play_context) if callable(getattr(self._play_context, x))]
|
|
||||||
if not self._connected:
|
if not self._connected:
|
||||||
remote_cmd = [to_bytes(x, errors='surrogate_or_strict') for x in [
|
remote_cmd = [to_bytes(x, errors='surrogate_or_strict') for x in [
|
||||||
# 'strace', '-s', '2048', '-o', '/tmp/log',
|
# 'strace', '-s', '2048', '-o', '/tmp/log',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user