Skip to content

Commit a8da6ec

Browse files
caberoscaberos
authored andcommitted
fix the team code review comments
1 parent 8f1be5e commit a8da6ec

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

SoftLayer/CLI/vpn/ipsec/cancel.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Cancel a dedicated server."""
1+
"""Cancel an IPSec service."""
22
# :license: MIT, see LICENSE for more details.
33

44
import click
@@ -12,19 +12,20 @@
1212
@click.option('--immediate',
1313
is_flag=True,
1414
default=False,
15-
help="Cancels the server immediately (instead of on the billing anniversary)")
15+
help="Cancels the service immediately (instead of on the billing anniversary)")
1616
@click.option('--reason',
1717
help="An optional cancellation reason. See cancel-reasons for a list of available options")
18-
@click.option('--comment',
19-
help="An optional comment to add to the cancellation ticket")
2018
@environment.pass_env
21-
def cli(env, identifier, immediate, reason, comment):
19+
def cli(env, identifier, immediate, reason):
2220
"""Cancel a IPSEC VPN tunnel context."""
2321

2422
manager = SoftLayer.IPSECManager(env.client)
2523
context = manager.get_tunnel_context(identifier, mask='billingItem')
2624

27-
result = manager.cancel_item(context['billingItem']['id'], immediate, reason, comment)
25+
if 'billingItem' not in context:
26+
raise SoftLayer.SoftLayerError("Cannot locate billing. May already be cancelled.")
27+
28+
result = manager.cancel_item(context['billingItem']['id'], immediate, reason)
2829

2930
if result:
3031
env.fout("Ipsec {} was cancelled.".format(identifier))

SoftLayer/managers/ipsec.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def order(self, datacenter, item_package):
300300
complex_type=complex_type,
301301
hourly=False)
302302

303-
def cancel_item(self, identifier, immediate, reason, comment):
303+
def cancel_item(self, identifier, immediate, reason):
304304
"""Cancels the specified billing item Ipsec.
305305
306306
Example::
@@ -313,8 +313,7 @@ def cancel_item(self, identifier, immediate, reason, comment):
313313
:func:`get_cancellation_reasons`.
314314
:param bool immediate: If set to True, will automatically update the cancelation ticket to request
315315
the resource be reclaimed asap. This request still has to be reviewed by a human
316-
:param string comment: An optional comment to include with the cancellation
317316
:returns: True on success or an exception
318317
"""
319318
return self.client.call('SoftLayer_Billing_Item', 'cancelItem',
320-
True, immediate, reason, comment, id=identifier)
319+
True, immediate, reason, id=identifier)

0 commit comments

Comments
 (0)