Пример #1
0
 def _get_ssh_public_key(self):
     """Generate SSH public key from private key."""
     key = ipa_utils.get_public_ssh_key(self.ssh_private_key_file)
     return '{user}:{key} {user}'.format(
         user=self.ssh_user,
         key=key.decode()
     )
Пример #2
0
    def _get_user_data(self):
        """
        Return formatted bash script string.

        The public ssh key is added by instance initialization code
        to the instance. The public key is generated from the
        private key file.
        """
        key = ipa_utils.get_public_ssh_key(self.ssh_private_key_file).decode()

        script = BASH_SSH_SCRIPT.format(user=self.ssh_user, key=key)
        return script
Пример #3
0
 def _get_ssh_public_key(self):
     """Generate SSH public key from private key."""
     key = ipa_utils.get_public_ssh_key(self.ssh_private_key_file)
     return key.decode()