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 }
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 }
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)
def __init__(self, instance): self.instance = instance self.username = nova.get_node_group_image_username( self.instance.node_group)