civo / cli-rubygem

Command line interface for interacting with Civo's cloud API
https://www.civo.com
MIT License
15 stars 4 forks source link

Got stack trace when asking for the current key #45

Closed lucj closed 4 years ago

lucj commented 5 years ago

When playing with civo-cli I got a traceback when running the civo apikey current command just after setting my first key

$ civo apikey add demo-key xxxxxxxxx
Saved the API Key xxxxxxxxx as demo-key

$ civo apikey current
Traceback (most recent call last):
    14: from /Users/luc/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `<main>'
    13: from /Users/luc/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `eval'
    12: from /Users/luc/.rvm/gems/ruby-2.6.3/bin/civo:23:in `<main>'
    11: from /Users/luc/.rvm/gems/ruby-2.6.3/bin/civo:23:in `load'
    10: from /Users/luc/.rvm/gems/ruby-2.6.3/gems/civo_cli-0.4.4/exe/civo:6:in `<top (required)>'
     9: from /Users/luc/.rvm/gems/ruby-2.6.3/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
     8: from /Users/luc/.rvm/gems/ruby-2.6.3/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
     7: from /Users/luc/.rvm/gems/ruby-2.6.3/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
     6: from /Users/luc/.rvm/gems/ruby-2.6.3/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
     5: from /Users/luc/.rvm/gems/ruby-2.6.3/gems/thor-0.20.3/lib/thor.rb:238:in `block in subcommand'
     4: from /Users/luc/.rvm/gems/ruby-2.6.3/gems/thor-0.20.3/lib/thor/invocation.rb:115:in `invoke'
     3: from /Users/luc/.rvm/gems/ruby-2.6.3/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
     2: from /Users/luc/.rvm/gems/ruby-2.6.3/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
     1: from /Users/luc/.rvm/gems/ruby-2.6.3/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
/Users/luc/.rvm/gems/ruby-2.6.3/gems/civo_cli-0.4.4/lib/apikey.rb:42:in `current':

It does not happen once I've setup a current key

$ civo apikey current demo-key
The current API Key is now demo-key

$ civo apikey current
The current API Key is demo-key

The version I use:

$ civo version
You are running the current v0.4.4 of Civo CLI
kaihoffman commented 5 years ago

Good spot. It was missing a check for the current_apikey_name being nil which is what it was failing to print. I'll get it fixed.