nir0s/ghost

Bad error when using `ghost ssh` on a non-existing key

nir0s opened this issue · 0 comments

nir0s commented
$ ghost ssh non-existing-key
Stash: tinydb at ~/Dropbox/work/strigo/stash.json[main]
Traceback (most recent call last):
  File "/home/nir0s/.virtualenvs/strigo/bin/ghost", line 11, in <module>
    sys.exit(main())
  File "/home/nir0s/.virtualenvs/strigo/lib/python3.5/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/nir0s/.virtualenvs/strigo/lib/python3.5/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/nir0s/.virtualenvs/strigo/lib/python3.5/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/nir0s/.virtualenvs/strigo/lib/python3.5/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/nir0s/.virtualenvs/strigo/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/nir0s/.virtualenvs/strigo/lib/python3.5/site-packages/ghost.py", line 1556, in ssh
    if not key.get('type') == 'ssh':
AttributeError: 'NoneType' object has no attribute 'get'

That's because we should check that key is actually something before we try to get its type.