Skip to content

Commit c048566

Browse files
Ramkishor ChaladiRamkishor Chaladi
authored andcommitted
added force flag
1 parent 5798373 commit c048566

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

SoftLayer/CLI/hardware/cancel.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
2020
help="An optional comment to add to the cancellation ticket")
2121
@click.option('--reason',
2222
help="An optional cancellation reason. See cancel-reasons for a list of available options")
23+
@click.option('--force', default=False, is_flag=True, help="Force modify")
2324
@environment.pass_env
24-
def cli(env, identifier, immediate, comment, reason):
25+
def cli(env, identifier, immediate, comment, reason, force):
2526
"""Cancel a dedicated server."""
2627

2728
mgr = SoftLayer.HardwareManager(env.client)
@@ -30,4 +31,9 @@ def cli(env, identifier, immediate, comment, reason):
3031
if not (env.skip_confirmations or formatting.no_going_back(hw_id)):
3132
raise exceptions.CLIAbort('Aborted')
3233

34+
if not force:
35+
if not (env.skip_confirmations or
36+
formatting.confirm("This action will incur charges on your account. Continue?")):
37+
raise exceptions.CLIAbort('Aborted')
38+
3339
mgr.cancel_hardware(hw_id, reason, comment, immediate)

SoftLayer/CLI/hardware/create.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@
3737
help="The ID of the private ROUTER on which you want the virtual server placed")
3838
@helpers.multi_option('--key', '-k', help="SSH keys to add to the root user")
3939
@helpers.multi_option('--extra', '-e', help="Extra option Key Names")
40+
@click.option('--force', default=False, is_flag=True, help="Force modify")
4041
@environment.pass_env
41-
def cli(env, **args):
42+
def cli(env, force, **args):
4243
"""Order/create a dedicated server."""
4344
mgr = SoftLayer.HardwareManager(env.client)
4445
network = SoftLayer.NetworkManager(env.client)
@@ -105,9 +106,10 @@ def cli(env, **args):
105106
for pod in pods:
106107
if args.get('datacenter') in pod['name']:
107108
click.secho(f"Warning: Closed soon: {pod['name']}", fg='yellow')
108-
if not (env.skip_confirmations or formatting.confirm(
109-
"This action will incur charges on your account. Continue?")):
110-
raise exceptions.CLIAbort('Aborting dedicated server order.')
109+
if not force:
110+
if not (env.skip_confirmations or formatting.confirm(
111+
"This action will incur charges on your account. Continue?")):
112+
raise exceptions.CLIAbort('Aborting dedicated server order.')
111113

112114
result = mgr.place_order(**order)
113115

0 commit comments

Comments
 (0)