예제 #1
0
def _generate_user_data_script(node_group):
    script_template = """#!/bin/bash
echo "%(public_key)s" >> %(user_home)s/.ssh/authorized_keys
echo "%(private_key)s" > %(user_home)s/.ssh/id_rsa
"""
    cluster = node_group.cluster
    if nova.get_node_group_image_username(node_group) == "root":
        user_home = "/root/"
    else:
        user_home = "/home/%s/" % nova.get_node_group_image_username(
            node_group)

    return script_template % {
        "public_key": crypto.private_key_to_public_key(cluster.private_key),
        "private_key": cluster.private_key,
        "user_home": user_home
    }
예제 #2
0
def _generate_user_data_script(node_group):
    script_template = """#!/bin/bash
echo "%(public_key)s" >> %(user_home)s/.ssh/authorized_keys
echo "%(private_key)s" > %(user_home)s/.ssh/id_rsa
"""
    cluster = node_group.cluster
    if nova.get_node_group_image_username(node_group) == "root":
        user_home = "/root/"
    else:
        user_home = "/home/%s/" % nova.get_node_group_image_username(
            node_group)

    return script_template % {
        "public_key": cluster.management_public_key,
        "private_key": cluster.management_private_key,
        "user_home": user_home
    }
예제 #3
0
파일: remote.py 프로젝트: simedcn/savanna
 def ssh_connection(self):
     username = nova.get_node_group_image_username(self.instance.node_group)
     return setup_ssh_connection(
         self.instance.management_ip, username,
         self.instance.node_group.cluster.private_key)
예제 #4
0
 def ssh_connection(self):
     username = nova.get_node_group_image_username(self.instance.node_group)
     return setup_ssh_connection(
         self.instance.management_ip, username,
         self.instance.node_group.cluster.private_key)
예제 #5
0
 def __init__(self, instance):
     self.instance = instance
     self.username = nova.get_node_group_image_username(
         self.instance.node_group)
예제 #6
0
 def __init__(self, instance):
     self.instance = instance
     self.username = nova.get_node_group_image_username(
         self.instance.node_group)