Skip to content

Commit

Permalink
Fix export for configs without identity
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxbey committed Mar 14, 2018
1 parent cec28ab commit d98f0d0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
'paramiko>=1.16.0',
'pathlib2>=2.1.0',
'blinker>=1.4',
'google-measurement-protocol>=0.1.6',
'google-measurement-protocol==0.1.6',
]

# pylint: disable=invalid-name
Expand Down
4 changes: 2 additions & 2 deletions termius/core/commands/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def get_visible_identity(self, ssh_config_merger):
"""Return first of visible identity."""
stack = [
i.identity for i in ssh_config_merger.get_entry_stack()
if i.identity.get('is_visible')
if i.identity and i.identity.get('is_visible')
]
return (stack and stack[0]) or None

Expand All @@ -289,6 +289,6 @@ def get_identity_merger(self, ssh_config_merger):
"""Create identity merger for passed merger."""
stack = [
i for i in ssh_config_merger.get_entry_stack()
if not i.identity.get('is_visible')
if i.identity and not i.identity.get('is_visible')
]
return Merger(stack, 'identity', Identity())
4 changes: 2 additions & 2 deletions termius/porting/providers/ssh/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class SSHConfigHostAdapter(SshConfigMergerMixin):

def get_instance_ssh_key_label(self, ssh_config):
"""Helper to retrieve ssh_key lable."""
if ssh_config['identity'] and ssh_config['identity']['ssh_key']:
if ssh_config['identity'] and ssh_config['identity'].get('ssh_key'):
return ssh_config['identity']['ssh_key']['label']

return None
Expand Down Expand Up @@ -43,7 +43,7 @@ def adapt_instance_to_ssh_config_host(self, host_instance):

adapted = {
'hostname': host_instance['address'],
'user': ssh_config['identity']['username'],
'user': ssh_config['identity'].get('username'),
'port': ssh_config['port'] or 22
}

Expand Down

0 comments on commit d98f0d0

Please sign in to comment.