Skip to content

Commit 3e8bd0e

Browse files
Merge pull request softlayer#2121 from allmightyspiff/issues2107
Removed requirements in volume-modify commands
2 parents ed587b5 + fead52b commit 3e8bd0e

File tree

7 files changed

+30
-31
lines changed

7 files changed

+30
-31
lines changed

SoftLayer/CLI/block/limit.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def cli(env, sortby, datacenter):
2323
Example::
2424
slcli block volume-limits
2525
This command lists the storage limits per datacenter for this account.
26-
"""
26+
"""
2727

2828
block_manager = SoftLayer.BlockStorageManager(env.client)
2929
block_volumes = block_manager.list_block_volume_limit()

SoftLayer/CLI/block/modify.py

+9-10
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,21 @@
2020
@click.option('--new-iops', '-i',
2121
type=int,
2222
help='Performance Storage IOPS, between 100 and 6000 in multiples of 100 [only for performance volumes] '
23-
'***If no IOPS value is specified, the original IOPS value of the volume will be used.***\n'
24-
'Requirements: [If original IOPS/GB for the volume is less than 0.3, new IOPS/GB must also be '
25-
'less than 0.3. If original IOPS/GB for the volume is greater than or equal to 0.3, new IOPS/GB '
26-
'for the volume must also be greater than or equal to 0.3.]')
23+
'***If no IOPS value is specified, the original IOPS value of the volume will be used.***')
2724
@click.option('--new-tier', '-t',
28-
help='Endurance Storage Tier (IOPS per GB) [only for endurance volumes] '
29-
'***If no tier is specified, the original tier of the volume will be used.***\n'
30-
'Requirements: [If original IOPS/GB for the volume is 0.25, new IOPS/GB for the volume must also '
31-
'be 0.25. If original IOPS/GB for the volume is greater than 0.25, new IOPS/GB for the volume '
32-
'must also be greater than 0.25.]',
25+
help='Endurance Storage Tier (IOPS per GB) [only for endurance volumes] Classic Choices: '
26+
'***If no tier is specified, the original tier of the volume will be used.***',
3327
type=click.Choice(['0.25', '2', '4', '10']))
3428
@environment.pass_env
3529
def cli(env, volume_id, new_size, new_iops, new_tier):
36-
"""Modify an existing block storage volume.
30+
"""Modify an existing block storage volume. Choices.
31+
32+
Valid size and iops options can be found here:
33+
https://cloud.ibm.com/docs/BlockStorage/index.html#provisioning-considerations
34+
https://cloud.ibm.com/docs/BlockStorage?topic=BlockStorage-orderingBlockStorage&interface=cli
3735
3836
Example::
37+
3938
slcli block volume-modify 12345678 --new-size 1000 --new-iops 4000
4039
This command modify a volume 12345678 with size is 1000GB, IOPS is 4000.
4140

SoftLayer/CLI/command.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class OptionHighlighter(RegexHighlighter):
2828
r"(?P<option>\-\-[\w\-]+)", # long options like --verbose
2929
r"(?P<default_option>\[[^\]]+\])", # anything between [], usually default options
3030
r"(?P<option_choices>Choices: )",
31+
r"(?P<example_block>Example::)",
32+
r"(?P<url>(file|https|http|ws|wss)://[-0-9a-zA-Z$_+!`(),.?/;:&=%#~]*)"
3133
r"(?P<args_keyword>^[A-Z]+$)",
3234
]
3335

@@ -91,7 +93,7 @@ def format_help_text(self, ctx: click.Context, formatter: click.formatting.HelpF
9193

9294
if text:
9395
text = inspect.cleandoc(text).partition("\f")[0]
94-
self.console.print(f"\n\t{text}\n")
96+
self.console.print(f"\n\t{text}\n", highlight=True)
9597

9698
def format_epilog(self, ctx: click.Context, formatter: click.formatting.HelpFormatter) -> None:
9799
"""Writes the epilog if it exists, then prints out any sub-commands if they exist."""
@@ -191,9 +193,10 @@ def format_help_text(self, ctx: click.Context, formatter: click.formatting.HelpF
191193
text = f"(Deprecated) {text}"
192194

193195
if text:
194-
text = inspect.cleandoc(text)
196+
text = f"\n\t{inspect.cleandoc(text)}\n"
195197

196-
self.console.print(f"\n\t{text}\n", highlight=False)
198+
# Can't use F-string here because it messes with highlights
199+
self.console.print(self.highlighter(text))
197200

198201
def format_epilog(self, ctx: click.Context, formatter: click.formatting.HelpFormatter) -> None:
199202
"""Writes the epilog if it exists, then prints out any sub-commands if they exist."""

SoftLayer/CLI/file/modify.py

+7-8
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,22 @@
2121
@click.option('--new-iops', '-i',
2222
type=int,
2323
help='Performance Storage IOPS, between 100 and 6000 in multiples of 100 [only for performance volumes] '
24-
'***If no IOPS value is specified, the original IOPS value of the volume will be used.***\n'
25-
'Requirements: [If original IOPS/GB for the volume is less than 0.3, new IOPS/GB must also be '
26-
'less than 0.3. If original IOPS/GB for the volume is greater than or equal to 0.3, new IOPS/GB '
27-
'for the volume must also be greater than or equal to 0.3.]')
24+
'***If no IOPS value is specified, the original IOPS value of the volume will be used.***')
2825
@click.option('--new-tier', '-t',
2926
help='Endurance Storage Tier (IOPS per GB) [only for endurance volumes] '
30-
'***If no tier is specified, the original tier of the volume will be used.***\n'
31-
'Requirements: [If original IOPS/GB for the volume is 0.25, new IOPS/GB for the volume must also '
32-
'be 0.25. If original IOPS/GB for the volume is greater than 0.25, new IOPS/GB for the volume '
33-
'must also be greater than 0.25.]',
27+
'***If no tier is specified, the original tier of the volume will be used.***',
3428
type=click.Choice(['0.25', '2', '4', '10']))
3529
@click.option('--force', default=False, is_flag=True, help="Force modify")
3630
@environment.pass_env
3731
def cli(env, volume_id, new_size, new_iops, new_tier, force):
3832
"""Modify an existing file storage volume.
3933
34+
Valid size and iops options can be found here:
35+
https://cloud.ibm.com/docs/FileStorage/index.html#provisioning-considerations
36+
https://cloud.ibm.com/docs/FileStorage?topic=FileStorage-orderingFileStorage&interface=cli
37+
4038
Example::
39+
4140
slcli file volume-modify 12345678 --new-size 1000 --new-iops 400
4241
"""
4342
if not force:

SoftLayer/managers/storage.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -313,11 +313,7 @@ def order_duplicate_volume(self,
313313

314314
return self.client.call('Product_Order', 'placeOrder', order)
315315

316-
def order_modified_volume(self,
317-
volume_id,
318-
new_size=None,
319-
new_iops=None,
320-
new_tier_level=None):
316+
def order_modified_volume(self, volume_id, new_size=None, new_iops=None, new_tier_level=None):
321317
"""Places an order for modifying an existing block volume.
322318
323319
:param volume_id: The ID of the volume to be modified

SoftLayer/managers/storage_utils.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,7 @@ def find_snapshot_schedule_id(volume, snapshot_schedule_keyname):
419419
if schedule['type']['keyname'] == snapshot_schedule_keyname:
420420
return schedule['id']
421421

422-
raise ValueError("The given snapshot schedule ID was not found for "
423-
"the given storage volume")
422+
raise ValueError("The given snapshot schedule ID was not found for the given storage volume")
424423

425424

426425
def prepare_snapshot_order_object(manager, volume, capacity, tier, upgrade, iops):
@@ -436,8 +435,7 @@ def prepare_snapshot_order_object(manager, volume, capacity, tier, upgrade, iops
436435
"""
437436
# Ensure the storage volume has not been cancelled
438437
if 'billingItem' not in volume:
439-
raise exceptions.SoftLayerError(
440-
'This volume has been cancelled; unable to order snapshot space')
438+
raise exceptions.SoftLayerError('This volume has been cancelled; unable to order snapshot space')
441439

442440
# Determine and validate the storage volume's billing item category
443441
billing_item_category_code = volume['billingItem']['categoryCode']

SoftLayer/utils.py

+4
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,8 @@ def console_color_themes(theme):
492492
"option_keyword": "bold dark_cyan",
493493
"args_keyword": "underline orange4",
494494
"option_choices": "gold3",
495+
"example_block": "underline deep_pink3",
496+
"url": "underline blue",
495497
})
496498
)
497499
return Console(theme=Theme(
@@ -509,6 +511,8 @@ def console_color_themes(theme):
509511
"option_keyword": "bold cyan",
510512
"args_keyword": "underline yellow",
511513
"option_choices": "gold3",
514+
"example_block": "underline light_coral",
515+
"url": "underline blue",
512516
})
513517
)
514518

0 commit comments

Comments
 (0)