Beispiel #1
0
def launch_spec(spec_name):
    config = configuration.get_config()
    spec = configuration.get_single_kube_spec(spec_name).encode()
    for node in config.nodes:
        if node.kind == "supervisor":
            ssh.check_ssh(node, "mkdir", "-p", DEPLOYQUEUE)
            ssh.upload_bytes(
                node, spec,
                "%s/%d.%s" % (DEPLOYQUEUE, int(time.time()), spec_name))
            print("Uploaded spec to deployqueue.")
Beispiel #2
0
 def safe_upload_keytab(node=node):
     if not overwrite_keytab:
         try:
             existing_keytab = ssh.check_ssh_output(node, "cat", KEYTAB_PATH)
         except subprocess.CalledProcessError as e_test:
             # if there is no existing keytab, cat will fail with error code 1
             if e_test.returncode != 1:
                 command.fail(e_test)
             print("no existing keytab found, uploading local keytab")
         else:
             if existing_keytab != decrypted:
                 command.fail("existing keytab does not match local keytab")
             return # existing keytab matches local keytab, no action required
     ssh.upload_bytes(node, decrypted, KEYTAB_PATH)
Beispiel #3
0
def launch_spec(path, extra_kvs: dict = None, export=False):
    config = configuration.get_config()
    spec = configuration.get_single_kube_spec(path, extra_kvs).encode()
    assert path[:2] == '//'
    yamlname = path[2:].replace(":", "-")
    if export:
        util.writefile(yamlname, spec)
    else:
        for node in config.nodes:
            if node.kind == "supervisor":
                ssh.check_ssh(node, "mkdir", "-p", DEPLOYQUEUE)
                ssh.upload_bytes(
                    node, spec,
                    "%s/%f.%s" % (DEPLOYQUEUE, time.time(), yamlname))
                print("Uploaded spec to deployqueue.")
Beispiel #4
0
def ssh_upload_bytes(ops, name: str, node: configuration.Node, source_bytes: bytes, dest_path: str) -> None:
    ops.add_operation(name.replace('@HOST', node.hostname),
                      lambda: ssh.upload_bytes(node, source_bytes, dest_path))
Beispiel #5
0
 def ssh_upload_bytes(self, name: str, node: configuration.Node,
                      source_bytes: bytes, dest_path: str) -> None:
     self.add_operation(
         name,
         lambda: ssh.upload_bytes(node, source_bytes, dest_path),
         node=node)