Skip to content

Commit 345ae1f

Browse files
caberoscaberos
authored andcommitted
Fix team code review
2 parents 2339404 + 0707fdb commit 345ae1f

25 files changed

+161
-134
lines changed

SoftLayer/CLI/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
def get_latest_version():
4545
"""Gets the latest version of the Softlayer library."""
4646
try:
47-
result = requests.get('https://pypi.org/pypi/SoftLayer/json')
47+
result = requests.get('https://pypi.org/pypi/SoftLayer/json', timeout=60)
4848
json_result = result.json()
4949
latest = 'v{}'.format(json_result['info']['version'])
5050
except Exception:

SoftLayer/CLI/hardware/guests.py

Lines changed: 0 additions & 40 deletions
This file was deleted.

SoftLayer/CLI/routes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@
214214
('ipsec:translation-update', 'SoftLayer.CLI.vpn.ipsec.translation.update:cli'),
215215
('ipsec:update', 'SoftLayer.CLI.vpn.ipsec.update:cli'),
216216
('ipsec:order', 'SoftLayer.CLI.vpn.ipsec.order:cli'),
217+
('ipsec:cancel', 'SoftLayer.CLI.vpn.ipsec.cancel:cli'),
217218

218219
('loadbal', 'SoftLayer.CLI.loadbal'),
219220
('loadbal:detail', 'SoftLayer.CLI.loadbal.detail:cli'),
@@ -273,7 +274,6 @@
273274
('hardware:detail', 'SoftLayer.CLI.hardware.detail:cli'),
274275
('hardware:billing', 'SoftLayer.CLI.hardware.billing:cli'),
275276
('hardware:edit', 'SoftLayer.CLI.hardware.edit:cli'),
276-
('hardware:guests', 'SoftLayer.CLI.hardware.guests:cli'),
277277
('hardware:list', 'SoftLayer.CLI.hardware.list:cli'),
278278
('hardware:power-cycle', 'SoftLayer.CLI.hardware.power:power_cycle'),
279279
('hardware:power-off', 'SoftLayer.CLI.hardware.power:power_off'),
@@ -334,6 +334,7 @@
334334
('subnet:lookup', 'SoftLayer.CLI.subnet.lookup:cli'),
335335
('subnet:edit-ip', 'SoftLayer.CLI.subnet.edit_ip:cli'),
336336
('subnet:route', 'SoftLayer.CLI.subnet.route:cli'),
337+
('subnet:clear-route', 'SoftLayer.CLI.subnet.clear_route:cli'),
337338

338339
('tags', 'SoftLayer.CLI.tags'),
339340
('tags:cleanup', 'SoftLayer.CLI.tags.cleanup:cli'),
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"""Remove the route of your Account Owned subnets."""
2+
# :license: MIT, see LICENSE for more details.
3+
4+
import click
5+
6+
import SoftLayer
7+
from SoftLayer.CLI import environment
8+
from SoftLayer.CLI import exceptions
9+
10+
11+
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
12+
@click.argument('identifier')
13+
@environment.pass_env
14+
def cli(env, identifier):
15+
"""Remove the route of your Account Owned subnets."""
16+
17+
mgr = SoftLayer.NetworkManager(env.client)
18+
19+
subnet = mgr.clear_route(identifier)
20+
21+
if subnet:
22+
click.secho("The transaction to clear the route is created, routes will be updated in one or two minutes.")
23+
else:
24+
raise exceptions.CLIAbort('Failed to clear the route for the subnet.')

SoftLayer/CLI/virt/access.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Command lines which modify power states."""
1+
"""Get user access details a virtual server."""
22
# :license: MIT, see LICENSE for more details.
33

44
import click

SoftLayer/CLI/virt/list.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,12 @@
3636
DEFAULT_COLUMNS = [
3737
'id',
3838
'hostname',
39+
'domain',
40+
'deviceStatus.name',
41+
'datacenter',
3942
'primary_ip',
4043
'backend_ip',
41-
'datacenter',
44+
'createDate',
4245
'action',
4346
]
4447

SoftLayer/CLI/vpn/ipsec/cancel.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"""Cancel an IPSec service."""
2+
# :license: MIT, see LICENSE for more details.
3+
4+
import click
5+
6+
import SoftLayer
7+
from SoftLayer.CLI import environment
8+
9+
10+
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
11+
@click.argument('identifier')
12+
@click.option('--immediate',
13+
is_flag=True,
14+
default=False,
15+
help="Cancels the service immediately (instead of on the billing anniversary)")
16+
@click.option('--reason',
17+
help="An optional cancellation reason. See cancel-reasons for a list of available options")
18+
@environment.pass_env
19+
def cli(env, identifier, immediate, reason):
20+
"""Cancel a IPSEC VPN tunnel context."""
21+
22+
manager = SoftLayer.IPSECManager(env.client)
23+
context = manager.get_tunnel_context(identifier, mask='billingItem')
24+
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)
29+
30+
if result:
31+
env.fout("Ipsec {} was cancelled.".format(identifier))

SoftLayer/fixtures/SoftLayer_Account.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@
845845
'createDate': '2015-05-05T16:23:52-06:00',
846846
'id': 11449,
847847
'modifyDate': '2015-05-05T16:24:09-06:00',
848-
'name': 'SLADC307608-1',
848+
'name': 'TEST307608-1',
849849
'typeId': 2,
850850
'description': 'Citrix NetScaler VPX 10.5 10Mbps Standard',
851851
'managementIpAddress': '10.11.11.112',

SoftLayer/fixtures/SoftLayer_Hardware_Server.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -278,26 +278,6 @@
278278
}
279279
]
280280

281-
getVirtualHost = {
282-
"accountId": 11111,
283-
"createDate": "2018-10-08T10:54:48-06:00",
284-
"description": "host16.vmware.chechu.com",
285-
"hardwareId": 22222,
286-
"id": 33333,
287-
"name": "host16.vmware.chechu.com",
288-
"uuid": "00000000-0000-0000-0000-0cc11111",
289-
"hardware": {
290-
"accountId": 11111,
291-
"domain": "chechu.com",
292-
"hostname": "host16.vmware",
293-
"id": 22222,
294-
"hardwareStatus": {
295-
"id": 5,
296-
"status": "ACTIVE"
297-
}
298-
}
299-
}
300-
301281
getUpgradeItemPrices = [
302282
{
303283
"id": 21525,

SoftLayer/fixtures/SoftLayer_Network_Application_Delivery_Controller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
'createDate': '2015-05-05T16:23:52-06:00',
44
'id': 11449,
55
'modifyDate': '2015-05-05T16:24:09-06:00',
6-
'name': 'SLADC307608-1',
6+
'name': 'TEST307608-1',
77
'typeId': 2,
88
'description': 'Citrix NetScaler VPX 10.5 10Mbps Standard',
99
'managementIpAddress': '10.11.11.112',

0 commit comments

Comments
 (0)