-
Notifications
You must be signed in to change notification settings - Fork 194
Closed
Labels
Description
The Problem
When a user tries to use the volume username as an identifier, they get a 500 internal server error. Ideally, the username should be resolved to an ID first. This effects a lot of the block and file commands, but specifically snapshot-list here.
$ ./slcli block snapshot-list SL01SEL307608-11
SoftLayerAPIError(SOAP-ENV:Server): Internal ErrorTODO
All of the block and file commands that take in a volume id should be refactored to use the storage manager resolver to also allow volume usernames. The change is pretty simple, but there are a lot of these commands.
$ git diff SoftLayer/CLI/block/snapshot/list.py
diff --git a/SoftLayer/CLI/block/snapshot/list.py b/SoftLayer/CLI/block/snapshot/list.py
index b47f5949..bb25a230 100644
--- a/SoftLayer/CLI/block/snapshot/list.py
+++ b/SoftLayer/CLI/block/snapshot/list.py
@@ -6,6 +6,7 @@ import SoftLayer
from SoftLayer.CLI import columns as column_helper
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
+from SoftLayer.CLI import helpers
COLUMNS = [
@@ -38,14 +39,16 @@ DEFAULT_COLUMNS = [
def cli(env, volume_id, sortby, columns):
"""List block storage snapshots."""
block_manager = SoftLayer.BlockStorageManager(env.client)
+ resolved_id = helpers.resolve_id(block_manager.resolve_ids, volume_id, 'Volume Id')
snapshots = block_manager.get_block_volume_snapshot_list(
- volume_id,
+ resolved_id,
mask=columns.mask()
)