def ssh_copy_id(self): """Copy a fake key (key without passphrase) into a node.""" # If the ID is already there, do nothing if not self.key or self._copy_id: return def _interact(char, stdin): sys.stdout.write(char.encode()) _interact.aggregated += char if _interact.aggregated.endswith("Password: "******"%s\n" % self.password) elif char == "\n": _interact.aggregated = "" _interact.aggregated = "" sh.ssh_copy_id( "-i", self.key.pub_key(), "-o", "StrictHostKeyChecking=no", "-o", "UserKnownHostsFile=/dev/null", "%s@%s" % (self.user, self.host), _out=_interact, _out_bufsize=0, _tty_in=True, )
def ssh_copy_id(self): """Copy a fake key (key without passphrase) into a node.""" # If the ID is already there, do nothing if not self.key or self._copy_id: return def _interact(char, stdin): sys.stdout.write(char.encode()) _interact.aggregated += char if _interact.aggregated.endswith("Password: "): stdin.put('%s\n' % self.password) elif char == '\n': _interact.aggregated = '' _interact.aggregated = '' sh.ssh_copy_id('-i', self.key.pub_key(), '-o', 'StrictHostKeyChecking=no', '-o', 'UserKnownHostsFile=/dev/null', '%s@%s' % (self.user, self.host), _out=_interact, _out_bufsize=0, _tty_in=True)
def ssh_copy_id(self): """Copy a fake key (key without passphrase) into a node.""" # If the ID is already there, do nothing if self._copy_id: return def _interact(char, stdin): sys.stdout.write(char.encode()) _interact.aggregated += char if _interact.aggregated.endswith("Password: "): stdin.put('%s\n' % self.password) elif char == '\n': _interact.aggregated = '' _interact.aggregated = '' sh.ssh_copy_id('-i', self.key.pub_key(), '-o', 'StrictHostKeyChecking=no', '-o', 'UserKnownHostsFile=/dev/null', '%s@%s' % (self.user, self.host), _out=_interact, _out_bufsize=0, _tty_in=True)