diff options
author | Jhon Honce <jhonce@redhat.com> | 2018-07-12 19:26:14 -0700 |
---|---|---|
committer | Jhon Honce <jhonce@redhat.com> | 2018-07-13 12:50:12 -0700 |
commit | 74ccd9ce5f29a1df4ffe70b4d8bd00c29d5d9d15 (patch) | |
tree | 75ba256d70545d79aa61d7c57c20df886be1555f /contrib/python/podman/libs/_containers_attach.py | |
parent | 44b523c946c88e540b50d7ba59f441b5f8e0bad0 (diff) | |
download | podman-74ccd9ce5f29a1df4ffe70b4d8bd00c29d5d9d15.tar.gz podman-74ccd9ce5f29a1df4ffe70b4d8bd00c29d5d9d15.tar.bz2 podman-74ccd9ce5f29a1df4ffe70b4d8bd00c29d5d9d15.zip |
Update python directories to better support setup.py
Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'contrib/python/podman/libs/_containers_attach.py')
-rw-r--r-- | contrib/python/podman/libs/_containers_attach.py | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/contrib/python/podman/libs/_containers_attach.py b/contrib/python/podman/libs/_containers_attach.py deleted file mode 100644 index df12fa998..000000000 --- a/contrib/python/podman/libs/_containers_attach.py +++ /dev/null @@ -1,75 +0,0 @@ -"""Exported method Container.attach().""" - -import collections -import fcntl -import logging -import struct -import sys -import termios - - -class Mixin: - """Publish attach() for inclusion in Container class.""" - - def attach(self, eot=4, stdin=None, stdout=None): - """Attach to container's PID1 stdin and stdout. - - stderr is ignored. - PseudoTTY work is done in start(). - """ - if stdin is None: - stdin = sys.stdin.fileno() - - if stdout is None: - stdout = sys.stdout.fileno() - - with self._client() as podman: - attach = podman.GetAttachSockets(self._id) - - # This is the UDS where all the IO goes - io_socket = attach['sockets']['io_socket'] - assert len(io_socket) <= 107,\ - 'Path length for sockets too long. {} > 107'.format( - len(io_socket) - ) - - # This is the control socket where resizing events are sent to conmon - # attach['sockets']['control_socket'] - self.pseudo_tty = collections.namedtuple( - 'PseudoTTY', - ['stdin', 'stdout', 'io_socket', 'control_socket', 'eot'])( - stdin, - stdout, - attach['sockets']['io_socket'], - attach['sockets']['control_socket'], - eot, - ) - - @property - def resize_handler(self): - """Send the new window size to conmon.""" - - def wrapped(signum, frame): - packed = fcntl.ioctl(self.pseudo_tty.stdout, termios.TIOCGWINSZ, - struct.pack('HHHH', 0, 0, 0, 0)) - rows, cols, _, _ = struct.unpack('HHHH', packed) - logging.debug('Resize window({}x{}) using {}'.format( - rows, cols, self.pseudo_tty.control_socket)) - - # TODO: Need some kind of timeout in case pipe is blocked - with open(self.pseudo_tty.control_socket, 'w') as skt: - # send conmon window resize message - skt.write('1 {} {}\n'.format(rows, cols)) - - return wrapped - - @property - def log_handler(self): - """Send command to reopen log to conmon.""" - - def wrapped(signum, frame): - with open(self.pseudo_tty.control_socket, 'w') as skt: - # send conmon reopen log message - skt.write('2\n') - - return wrapped |