Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a get method to retrieve the SSH public key contents. #438

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions lago/prefix.py
Original file line number Diff line number Diff line change
Expand Up @@ -1435,6 +1435,19 @@ def get_nets(self):
"""
return self.virt_env.get_nets()

def get_ssh_pub_key(self):
"""
Returns the contents of the SSH public key.
To be used to install hosts with public key, or
set cloud-init configuration with public key, or
for Ansible integration

Returns:
str: SSH public key
"""
with open(self.paths.ssh_id_rsa_pub()) as pub_key:
return pub_key.read()

@classmethod
def resolve_prefix_path(cls, start_path=None):
"""
Expand Down