mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-17 20:38:06 +00:00
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:
@ -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 """
|
||||
|
Reference in New Issue
Block a user