Ejemplo n.º 1
0
    def do(self):
        register_builtin_keys()

        #FIXME: Pick a VM:
        #  - if there is more than 1 defined, must be specified
        #  - if there is only 1 defined, ssh into that
        #  - if there is only 1 defined and the name is specified it
        #    must be right
        nodes = self.get_current_cluster().get_nodes()
        node = list(nodes)[0]

        #if not vm.is_running():
        #    raise errors.VmNotRunning()

        command = [
            "ssh", "-A", "-o", "UserKnownHostsFile /dev/null", "-o",
            "StrictHostKeyChecking no"
        ]

        #["-o", "IdentifyFile %s" % "path/to/key"]

        user, host, port = node.get_ssh_details()

        command.extend(["-l", user, "-p", str(port), host])
        os.execv("/usr/bin/ssh", command)
Ejemplo n.º 2
0
    def provision(self, **kwargs):
        register_builtin_keys()

        self.bootstrap()

        conf = Config()

        sk = dict(sidekick={
            "host": {
                "ips": dict(util.interfaces()),
                },
            "primaryip": self.machine.get_ip(),
            })
        conf.load(StringIO.StringIO(dump(sk)))

        if "recipe" in kwargs:
            conf.load_uri(kwargs['recipe'])

        if "conf" in kwargs:
            conf.load(StringIO.StringIO(kwargs['conf']))

        class opts:
            log_level = "info"
            logfile = "-"
            host = "%s@%s:%s" % self.machine.get_ssh_details()
            user = "******"
            ypath = kwargs.get("path", [])
            simulate = False
            verbose = False
            resume = True
            no_resume = False
            env_passthrough = []

        ctx = RunContext([], opts)
        ctx.set_config(conf)


        r = RemoteRunner()
        #r.load_host_keys(
        r.set_missing_host_key_policy("no")

        rv = r.run(ctx)

        return rv
Ejemplo n.º 3
0
    def provision(self, **kwargs):
        register_builtin_keys()

        self.bootstrap()

        conf = Config()

        sk = dict(
            sidekick={
                "host": {
                    "ips": dict(util.interfaces()),
                },
                "primaryip": self.machine.get_ip(),
            })
        conf.load(StringIO.StringIO(dump(sk)))

        if "recipe" in kwargs:
            conf.load_uri(kwargs['recipe'])

        if "conf" in kwargs:
            conf.load(StringIO.StringIO(kwargs['conf']))

        class opts:
            log_level = "info"
            logfile = "-"
            host = "%s@%s:%s" % self.machine.get_ssh_details()
            user = "******"
            ypath = kwargs.get("path", [])
            simulate = False
            verbose = False
            resume = True
            no_resume = False
            env_passthrough = []

        ctx = RunContext([], opts)
        ctx.set_config(conf)

        r = RemoteRunner()
        #r.load_host_keys(
        r.set_missing_host_key_policy("no")

        rv = r.run(ctx)

        return rv
Ejemplo n.º 4
0
    def do(self):
        register_builtin_keys()

        #FIXME: Pick a VM:
        #  - if there is more than 1 defined, must be specified
        #  - if there is only 1 defined, ssh into that
        #  - if there is only 1 defined and the name is specified it
        #    must be right
        nodes = self.get_current_cluster().get_nodes()
        node = list(nodes)[0]

        #if not vm.is_running():
        #    raise errors.VmNotRunning()


        command = ["ssh", "-A", "-o", "UserKnownHostsFile /dev/null", "-o", "StrictHostKeyChecking no"]

        #["-o", "IdentifyFile %s" % "path/to/key"]

        user, host, port = node.get_ssh_details()

        command.extend(["-l", user, "-p", str(port), host])
        os.execv("/usr/bin/ssh", command)