def test_prepare_ssh_sharing_not_master(self): args = prepare_ssh_sharing() self.assertEquals(args, [ "-o", "ControlPath " + self.home + "/.juju/ssh/master-%r@%h:%p", "-o", "ControlMaster no", ]) self.assertFalse(os.path.exists(self.home + "/.juju/ssh"))
def test_prepare_ssh_sharing_auto_master(self): args = prepare_ssh_sharing(auto_master=True) self.assertEquals(args, [ "-o", "ControlPath " + self.home + "/.juju/ssh/master-%r@%h:%p", "-o", "ControlMaster auto", ]) self.assertTrue(os.path.isdir(self.home + "/.juju/ssh"))
def open_ssh(flags, ip_address, ssh_command): # XXX - TODO - Might be nice if we had the ability to get the user's # private key path and utilize it here, ie the symmetric end to # get user public key. args = ["ssh"] args.extend(prepare_ssh_sharing()) args.extend(flags) args.extend(["ubuntu@%s" % ip_address]) args.extend(ssh_command) os.execvp("ssh", args)