Add ssh keys to nodes on demand (#411)

Our existing model has a per-scaleset SSH key.  This update moves towards using user provided SSH keys when they need to connect to a given node.
This commit is contained in:
bmc-msft
2021-01-06 14:29:38 -05:00
committed by GitHub
parent dae1759b57
commit f345bd239d
14 changed files with 313 additions and 11 deletions

View File

@ -1187,6 +1187,26 @@ class Node(Endpoint):
),
)
def add_ssh_key(
self, machine_id: UUID_EXPANSION, *, public_key: str
) -> responses.BoolResult:
self.logger.debug("add ssh public key to node: %s", machine_id)
machine_id_expanded = self._disambiguate_uuid(
"machine_id",
machine_id,
lambda: [str(x.machine_id) for x in self.list()],
)
return self._req_model(
"POST",
responses.BoolResult,
data=requests.NodeAddSshKey(
machine_id=machine_id_expanded,
public_key=public_key,
),
alternate_endpoint="node/add_ssh_key",
)
class Scaleset(Endpoint):
""" Interact with managed scaleset pools """