示例#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)