def generate_user_on_node(base_client, pool_id, node_id):
    generated_username = secure_utils.generate_random_string()
    ssh_key = RSA.generate(2048)
    ssh_pub_key = ssh_key.publickey().exportKey("OpenSSH").decode("utf-8")
    base_client.create_user_on_node(pool_id, node_id, generated_username,
                                    ssh_pub_key)
    return generated_username, ssh_key
Exemple #2
0
 def __generate_user_on_node(self, pool_id, node_id):
     generated_username = secure_utils.generate_random_string()
     ssh_key = RSA.generate(2048)
     ssh_pub_key = ssh_key.publickey().exportKey('OpenSSH').decode('utf-8')
     self.__create_user_on_node(generated_username, pool_id, node_id,
                                ssh_pub_key)
     return generated_username, ssh_key
def generate_user_on_cluster(base_operations, id, nodes):
    generated_username = secure_utils.generate_random_string()
    ssh_key = RSA.generate(2048)
    ssh_pub_key = ssh_key.publickey().exportKey("OpenSSH").decode("utf-8")
    with concurrent.futures.ThreadPoolExecutor() as executor:
        futures = {
            executor.submit(base_operations.create_user_on_node, id, node.id, generated_username, ssh_pub_key): node
            for node in nodes
        }
        concurrent.futures.wait(futures)

    return generated_username, ssh_key
Exemple #4
0
    def __generate_user_on_pool(self, pool_id, nodes):
        generated_username = secure_utils.generate_random_string()
        ssh_key = RSA.generate(2048)
        ssh_pub_key = ssh_key.publickey().exportKey('OpenSSH').decode('utf-8')
        with concurrent.futures.ThreadPoolExecutor() as executor:
            futures = {
                executor.submit(self.__create_user_on_node, generated_username,
                                pool_id, node.id, ssh_pub_key): node
                for node in nodes
            }
            concurrent.futures.wait(futures)

        return generated_username, ssh_key