Skip to content

Commit

Permalink
Appending ~/.ssh/config.keep to ~/.ssh/config
Browse files Browse the repository at this point in the history
  • Loading branch information
John Pfuntner committed Apr 5, 2024
1 parent dc1222c commit 50c59f2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bin/instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
ssh_root_raw = '~/.ssh'
ssh_root = os.path.expanduser(ssh_root_raw)
ssh_config_filename = os.path.join(ssh_root, 'config')
ssh_config_keep_filename = os.path.join(ssh_root, 'config.keep')

private_ssh_keyfile = os.path.join(ssh_root, 'id_rsa')
private_ssh_keyfile_raw = os.path.join(ssh_root_raw, 'id_rsa')
Expand Down Expand Up @@ -637,6 +638,9 @@ def get_instances(self):
with open(ssh_config_filename, 'w') as stream:
for instance in instances:
stream.write(f'Host {instance.name}\n\tHostname {instance.ip}\n\tUser {instance.user}\n\tIdentityFile {instance.key_filename}\n\tProxyCommand nc -X connect -x proxy.esl.cisco.com:80 %h %p\n')
if os.path.exists(ssh_config_keep_filename):
with open(ssh_config_keep_filename) as keep_config:
stream.write(keep_config.read())

active_instances = [instance.name for instance in instances if instance.active]
if active_instances and not args.no_fingerprints:
Expand Down

0 comments on commit 50c59f2

Please sign in to comment.