|
1 | | -"""Cancel a dedicated server.""" |
| 1 | +"""Cancel an IPSec service.""" |
2 | 2 | # :license: MIT, see LICENSE for more details. |
3 | 3 |
|
4 | 4 | import click |
|
12 | 12 | @click.option('--immediate', |
13 | 13 | is_flag=True, |
14 | 14 | 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)") |
16 | 16 | @click.option('--reason', |
17 | 17 | 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") |
20 | 18 | @environment.pass_env |
21 | | -def cli(env, identifier, immediate, reason, comment): |
| 19 | +def cli(env, identifier, immediate, reason): |
22 | 20 | """Cancel a IPSEC VPN tunnel context.""" |
23 | 21 |
|
24 | 22 | manager = SoftLayer.IPSECManager(env.client) |
25 | 23 | context = manager.get_tunnel_context(identifier, mask='billingItem') |
26 | 24 |
|
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) |
28 | 29 |
|
29 | 30 | if result: |
30 | 31 | env.fout("Ipsec {} was cancelled.".format(identifier)) |
0 commit comments