Skip to content

Commit

Permalink
Add GCEState.get_ssh_host_keys
Browse files Browse the repository at this point in the history
This will let NixOps provide the host keys directly to the ssh
client, regardless of whether they've been saved to user dotfiles.

It solves a problem where the host keys were not known on systems
that retrieve the state from a remote state provider.

See NixOS/nixops#1464
  • Loading branch information
roberth committed Nov 18, 2021
1 parent 7124530 commit 53dfef4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions nixops_gcp/backends/gce.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,19 @@ def gen_metadata(self, metadata):
"items": [{"key": k, "value": v} for k, v in metadata.items()],
}

# invoked by nixops before calling ssh
def get_ssh_host_keys(self):
return (
self.private_ipv4
+ " "
+ self.public_host_key
+ "\n"
+ self.public_ipv4
+ " "
+ self.public_host_key
+ "\n"
)

def update_block_device_mapping(self, k, v):
x = self.block_device_mapping
if v == None:
Expand Down

0 comments on commit 53dfef4

Please sign in to comment.