Skip to content

Commit

Permalink
merge updated ssh parameter function
Browse files Browse the repository at this point in the history
  • Loading branch information
kiekerjan committed Mar 23, 2024
1 parent 00f6e0a commit be7434e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions management/dns_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,9 @@ def build_sshfp_records():
# specify that port to sshkeyscan.

port = get_ssh_port()
# If nothing returned, assume default
# If nothing returned, assume ssh not installed
if not port:
port = 22
return

keys = shell("check_output", ["ssh-keyscan", "-4", "-t", "rsa,dsa,ecdsa,ed25519", "-p", str(port), "localhost"])
keys = sorted(keys.split("\n"))
Expand Down
13 changes: 6 additions & 7 deletions management/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,12 @@ def get_ssh_config_value(parameter_name):
# error while calling shell command
return None

returnNext = False
for e in output.split():
if returnNext:
return e
if e == parameter_name.lower():
returnNext = True

for line in output.split("\n"):
if " " not in line: continue # there's a blank line at the end
key, values = line.split(" ", 1)
if key == parameter_name:
return values # space-delimited if there are multiple values

# Did not find the parameter!
return None

Expand Down

0 comments on commit be7434e

Please sign in to comment.