Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

slcli vlan detail should be graceful in handling cases when hardware/vsi have no hostname/domain attribute #996

Closed
flavio-fernandes opened this issue Jul 5, 2018 · 1 comment

Comments

@flavio-fernandes
Copy link

Expected Behavior

slcli vlan detail should be more graceful in handling cases when hardware/vsi have no hostname/domain attribute

$ slcli vlan detail 1499927
$ echo $?
0

Actual Behavior

    $ slcli vlan detail 1499927
    An unexpected error has occured:
    Traceback (most recent call last):
      File "/home/vagrant/.venv/local/lib/python2.7/site-packages/SoftLayer/CLI/core.py", line 176, in main
        cli.main(**kwargs)
      File "/home/vagrant/.venv/local/lib/python2.7/site-packages/click/core.py", line 697, in main
        rv = self.invoke(ctx)
      File "/home/vagrant/.venv/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "/home/vagrant/.venv/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "/home/vagrant/.venv/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "/home/vagrant/.venv/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
        return callback(*args, **kwargs)
      File "/home/vagrant/.venv/local/lib/python2.7/site-packages/click/decorators.py", line 64, in new_func
        return ctx.invoke(f, obj, *args[1:], **kwargs)
      File "/home/vagrant/.venv/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
        return callback(*args, **kwargs)
      File "/home/vagrant/.venv/local/lib/python2.7/site-packages/SoftLayer/CLI/vlan/detail.py", line 76, in cli
        hardware['domain'],
    KeyError: 'domain'

Environment Information

Operating System: Ubuntu Xenial
softlayer-python version (slcli --version): slcli (SoftLayer Command-line), version 5.4.4

@flavio-fernandes
Copy link
Author

Proposed fix is in: #997

flavio-fernandes referenced this issue in flavio-fernandes/softlayer-python Jul 5, 2018
Avoid exceptions in cases when IMS returns hardware or VSI instances
that have no 'hostname' and 'domain' attributes.

An example of such:

$ slcli vlan detail 1499927
An unexpected error has occured:
Traceback (most recent call last):
  File "/home/vagrant/.venv/local/lib/python2.7/site-packages/SoftLayer/CLI/core.py", line 176, in main
    cli.main(**kwargs)
  File "/home/vagrant/.venv/local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/vagrant/.venv/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/vagrant/.venv/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/vagrant/.venv/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/vagrant/.venv/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/vagrant/.venv/local/lib/python2.7/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/home/vagrant/.venv/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/vagrant/.venv/local/lib/python2.7/site-packages/SoftLayer/CLI/vlan/detail.py", line 76, in cli
    hardware['domain'],
KeyError: 'domain'

Feel free to report this error as it is likely a bug:
    https://github.com/softlayer/softlayer-python/issues
The following snippet should be able to reproduce the error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants