Skip to content

Exception during slcli file volume-cancel --immediate #1081

@greglanthier

Description

@greglanthier

I think this is a recurrence of related to #880.

I have an IBM Kubernetes Service cluster in which I had allocated a collection of persistent volumes that were mapped to SoftLayer volumes.

When the Kubernetes persistent volumes were deleted the SoftLayer volumes were not - so I ran the following slcli command to request an immediate file volume-cancel.

slcli --format json file volume-list --columns notes,id | jq --raw-output '.[] | select(.notes != null) | select(.notes | contains("<my-kubernetes-namespace>")) | .id' | xargs -n1 slcli -y file volume-cancel --immediate

*I understand this isn't the ideal technique for cleaning lingering volumes.

Expected Behavior

A message on the console reporting that the volume-cancel request had been serviced.

Actual Behavior

Stack trace similar to the following:

An unexpected error has occured:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/SoftLayer/CLI/core.py", line 182, in main
    cli.main(**kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/SoftLayer/CLI/file/cancel.py", line 29, in cli
    reason, immediate)
  File "/usr/local/lib/python3.7/site-packages/SoftLayer/managers/file.py", line 485, in cancel_file_volume
    billing_item_id = file_volume['billingItem']['id']
KeyError: 'billingItem'

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

Environment Information

Operating System:

$ uname -a
Darwin lappy 17.7.0 Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64 x86_64`

softlayer-python version (slcli --version): slcli (SoftLayer Command-line), version 5.6.4

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions