-
Notifications
You must be signed in to change notification settings - Fork 194
Fixed cancel block storage issue #982
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
Fixed cancel block storage issue #982
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To get the tox -e analysis
check to pass, heres how you handle the following complaints.
C:515, 0: Unnecessary parens after 'print' keyword (superfluous-parens)
Should be removed once you switch from print to throw exception
C:513, 8: Variable name "billingItem" doesn't conform to snake_case naming style (invalid-name)
change billingItem to billing_item
R:501, 4: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
Removing the else:
block should fix this.
Also, please add a unit test for this new if condition so test coverage doesn't go down.
Thanks :)
SoftLayer/managers/block.py
Outdated
billing_item_id = block_volume['billingItem']['id'] | ||
billingItem = 'billingItem' in block_volume | ||
if billingItem is False: | ||
print('The block storage was cancelled') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The managers should not print out anything. I'd rather we raise an exception here.
https://github.com/softlayer/softlayer-python/blob/master/SoftLayer/managers/hardware.py#L87 has a good example of how to handle this sort of logic.
SoftLayer/managers/block.py
Outdated
billingItem = 'billingItem' in block_volume | ||
if billingItem is False: | ||
print('The block storage was cancelled') | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since were going to throw an exception if we don't have a billing item, the else bits are not really needed and can be reverted back.
Cancel block storage issue #880