Skip to content

Commit 9740383

Browse files
Merge pull request #1110 from allmightyspiff/issues1068
Support for -1 when changing port speed
2 parents 3f5e873 + e8a449d commit 9740383

File tree

16 files changed

+158
-77
lines changed

16 files changed

+158
-77
lines changed

CHANGELOG.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
# Change Log
22

3+
## [5.7.1] - 2019-02-26
4+
- https://github.com/softlayer/softlayer-python/compare/v5.7.0...v5.7.1
35

4-
## [5.7.0] - 2018-11-16
5-
- Changes: https://github.com/softlayer/softlayer-python/compare/v5.6.4...master
6+
+ #1089 removed legacy SL message queue commands
7+
+ Support for Hardware reflash firmware CLI/Manager method
8+
9+
## [5.7.0] - 2019-02-15
10+
- Changes: https://github.com/softlayer/softlayer-python/compare/v5.6.4...v5.7.0
611

712
+ #1099 Support for security group Ids
813
+ event-log cli command

SoftLayer/CLI/block/access/authorize.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
@click.option('--virtual-id', '-v', multiple=True,
1515
help='The id of one SoftLayer_Virtual_Guest to authorize')
1616
@click.option('--ip-address-id', '-i', multiple=True,
17-
help='The id of one SoftLayer_Network_Subnet_IpAddress'
18-
' to authorize')
17+
help='The id of one SoftLayer_Network_Subnet_IpAddress to authorize')
1918
@click.option('--ip-address', multiple=True,
2019
help='An IP address to authorize')
2120
@environment.pass_env
@@ -30,16 +29,11 @@ def cli(env, volume_id, hardware_id, virtual_id, ip_address_id, ip_address):
3029
for ip_address_value in ip_address:
3130
ip_address_object = network_manager.ip_lookup(ip_address_value)
3231
if ip_address_object == "":
33-
click.echo("IP Address not found on your account. " +
34-
"Please confirm IP and try again.")
32+
click.echo("IP Address not found on your account. Please confirm IP and try again.")
3533
raise exceptions.ArgumentError('Incorrect IP Address')
36-
else:
37-
ip_address_id_list.append(ip_address_object['id'])
34+
ip_address_id_list.append(ip_address_object['id'])
3835

39-
block_manager.authorize_host_to_volume(volume_id,
40-
hardware_id,
41-
virtual_id,
42-
ip_address_id_list)
36+
block_manager.authorize_host_to_volume(volume_id, hardware_id, virtual_id, ip_address_id_list)
4337

4438
# If no exception was raised, the command succeeded
4539
click.echo('The specified hosts were authorized to access %s' % volume_id)

SoftLayer/CLI/file/access/authorize.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,9 @@ def cli(env, volume_id, hardware_id, virtual_id, ip_address_id,
3333
for ip_address_value in ip_address:
3434
ip_address_object = network_manager.ip_lookup(ip_address_value)
3535
if ip_address_object == "":
36-
click.echo("IP Address not found on your account. " +
37-
"Please confirm IP and try again.")
36+
click.echo("IP Address not found on your account. Please confirm IP and try again.")
3837
raise exceptions.ArgumentError('Incorrect IP Address')
39-
else:
40-
ip_address_id_list.append(ip_address_object['id'])
38+
ip_address_id_list.append(ip_address_object['id'])
4139

4240
file_manager.authorize_host_to_volume(volume_id,
4341
hardware_id,

SoftLayer/CLI/hardware/edit.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,18 @@
1212
@click.command()
1313
@click.argument('identifier')
1414
@click.option('--domain', '-D', help="Domain portion of the FQDN")
15-
@click.option('--userfile', '-F',
16-
help="Read userdata from file",
17-
type=click.Path(exists=True, readable=True, resolve_path=True))
18-
@click.option('--tag', '-g',
19-
multiple=True,
15+
@click.option('--userfile', '-F', type=click.Path(exists=True, readable=True, resolve_path=True),
16+
help="Read userdata from file")
17+
@click.option('--tag', '-g', multiple=True,
2018
help="Tags to set or empty string to remove all")
2119
@click.option('--hostname', '-H', help="Host portion of the FQDN")
2220
@click.option('--userdata', '-u', help="User defined metadata string")
23-
@click.option('--public-speed',
24-
help="Public port speed.",
25-
default=None,
26-
type=click.Choice(['0', '10', '100', '1000', '10000']))
27-
@click.option('--private-speed',
28-
help="Private port speed.",
29-
default=None,
30-
type=click.Choice(['0', '10', '100', '1000', '10000']))
21+
@click.option('--public-speed', default=None, type=click.Choice(['0', '10', '100', '1000', '10000', '-1']),
22+
help="Public port speed. -1 is best speed available")
23+
@click.option('--private-speed', default=None, type=click.Choice(['0', '10', '100', '1000', '10000', '-1']),
24+
help="Private port speed. -1 is best speed available")
3125
@environment.pass_env
32-
def cli(env, identifier, domain, userfile, tag, hostname, userdata,
33-
public_speed, private_speed):
26+
def cli(env, identifier, domain, userfile, tag, hostname, userdata, public_speed, private_speed):
3427
"""Edit hardware details."""
3528

3629
if userdata and userfile:

SoftLayer/CLI/ticket/attach.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,25 @@
1111

1212
@click.command()
1313
@click.argument('identifier', type=int)
14-
@click.option('--hardware',
15-
'hardware_identifier',
14+
@click.option('--hardware', 'hardware_identifier',
1615
help="The identifier for hardware to attach")
17-
@click.option('--virtual',
18-
'virtual_identifier',
16+
@click.option('--virtual', 'virtual_identifier',
1917
help="The identifier for a virtual server to attach")
2018
@environment.pass_env
2119
def cli(env, identifier, hardware_identifier, virtual_identifier):
2220
"""Attach devices to a ticket."""
2321
ticket_mgr = SoftLayer.TicketManager(env.client)
2422

2523
if hardware_identifier and virtual_identifier:
26-
raise exceptions.ArgumentError(
27-
"Cannot attach hardware and a virtual server at the same time")
28-
elif hardware_identifier:
24+
raise exceptions.ArgumentError("Cannot attach hardware and a virtual server at the same time")
25+
26+
if hardware_identifier:
2927
hardware_mgr = SoftLayer.HardwareManager(env.client)
30-
hardware_id = helpers.resolve_id(hardware_mgr.resolve_ids,
31-
hardware_identifier,
32-
'hardware')
28+
hardware_id = helpers.resolve_id(hardware_mgr.resolve_ids, hardware_identifier, 'hardware')
3329
ticket_mgr.attach_hardware(identifier, hardware_id)
3430
elif virtual_identifier:
3531
vs_mgr = SoftLayer.VSManager(env.client)
36-
vs_id = helpers.resolve_id(vs_mgr.resolve_ids,
37-
virtual_identifier,
38-
'VS')
32+
vs_id = helpers.resolve_id(vs_mgr.resolve_ids, virtual_identifier, 'VS')
3933
ticket_mgr.attach_virtual_server(identifier, vs_id)
4034
else:
41-
raise exceptions.ArgumentError(
42-
"Must have a hardware or virtual server identifier to attach")
35+
raise exceptions.ArgumentError("Must have a hardware or virtual server identifier to attach")

SoftLayer/CLI/ticket/detach.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,25 @@
1111

1212
@click.command()
1313
@click.argument('identifier', type=int)
14-
@click.option('--hardware',
15-
'hardware_identifier',
14+
@click.option('--hardware', 'hardware_identifier',
1615
help="The identifier for hardware to detach")
17-
@click.option('--virtual',
18-
'virtual_identifier',
16+
@click.option('--virtual', 'virtual_identifier',
1917
help="The identifier for a virtual server to detach")
2018
@environment.pass_env
2119
def cli(env, identifier, hardware_identifier, virtual_identifier):
2220
"""Detach devices from a ticket."""
2321
ticket_mgr = SoftLayer.TicketManager(env.client)
2422

2523
if hardware_identifier and virtual_identifier:
26-
raise exceptions.ArgumentError(
27-
"Cannot detach hardware and a virtual server at the same time")
28-
elif hardware_identifier:
24+
raise exceptions.ArgumentError("Cannot detach hardware and a virtual server at the same time")
25+
26+
if hardware_identifier:
2927
hardware_mgr = SoftLayer.HardwareManager(env.client)
30-
hardware_id = helpers.resolve_id(hardware_mgr.resolve_ids,
31-
hardware_identifier,
32-
'hardware')
28+
hardware_id = helpers.resolve_id(hardware_mgr.resolve_ids, hardware_identifier, 'hardware')
3329
ticket_mgr.detach_hardware(identifier, hardware_id)
3430
elif virtual_identifier:
3531
vs_mgr = SoftLayer.VSManager(env.client)
36-
vs_id = helpers.resolve_id(vs_mgr.resolve_ids,
37-
virtual_identifier,
38-
'VS')
32+
vs_id = helpers.resolve_id(vs_mgr.resolve_ids, virtual_identifier, 'VS')
3933
ticket_mgr.detach_virtual_server(identifier, vs_id)
4034
else:
41-
raise exceptions.ArgumentError(
42-
"Must have a hardware or virtual server identifier to detach")
35+
raise exceptions.ArgumentError("Must have a hardware or virtual server identifier to detach")

SoftLayer/consts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
:license: MIT, see LICENSE for more details.
77
"""
8-
VERSION = 'v5.7.0'
8+
VERSION = 'v5.7.1'
99
API_PUBLIC_ENDPOINT = 'https://api.softlayer.com/xmlrpc/v3.1/'
1010
API_PRIVATE_ENDPOINT = 'https://api.service.softlayer.com/xmlrpc/v3.1/'
1111
API_PUBLIC_ENDPOINT_REST = 'https://api.softlayer.com/rest/v3.1/'

SoftLayer/managers/vs.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -428,14 +428,13 @@ def _create_network_components(
428428
if public_subnet:
429429
if public_vlan is None:
430430
raise exceptions.SoftLayerError("You need to specify a public_vlan with public_subnet")
431-
else:
432-
parameters['primaryNetworkComponent']['networkVlan']['primarySubnet'] = {'id': int(public_subnet)}
431+
432+
parameters['primaryNetworkComponent']['networkVlan']['primarySubnet'] = {'id': int(public_subnet)}
433433
if private_subnet:
434434
if private_vlan is None:
435435
raise exceptions.SoftLayerError("You need to specify a private_vlan with private_subnet")
436-
else:
437-
parameters['primaryBackendNetworkComponent']['networkVlan']['primarySubnet'] = {
438-
"id": int(private_subnet)}
436+
437+
parameters['primaryBackendNetworkComponent']['networkVlan']['primarySubnet'] = {'id': int(private_subnet)}
439438

440439
return parameters
441440

SoftLayer/managers/vs_placement.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,18 @@ def list(self, mask=None):
5050
def create(self, placement_object):
5151
"""Creates a placement group
5252
53-
:param dictionary placement_object: Below are the fields you can specify, taken from
54-
https://softlayer.github.io/reference/datatypes/SoftLayer_Virtual_PlacementGroup/
53+
A placement_object is defined as::
54+
5555
placement_object = {
5656
'backendRouterId': 12345,
5757
'name': 'Test Name',
5858
'ruleId': 12345
5959
}
6060
61+
- https://softlayer.github.io/reference/datatypes/SoftLayer_Virtual_PlacementGroup/
62+
63+
:param dictionary placement_object:
64+
6165
"""
6266
return self.client.call('SoftLayer_Virtual_PlacementGroup', 'createObject', placement_object)
6367

SoftLayer/transports.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,8 @@ def __call__(self, request):
402402
except ValueError as json_ex:
403403
if ex.response.text == "":
404404
raise exceptions.SoftLayerAPIError(resp.status_code, "Empty response.")
405-
else:
406-
raise exceptions.SoftLayerAPIError(resp.status_code, str(json_ex))
405+
406+
raise exceptions.SoftLayerAPIError(resp.status_code, str(json_ex))
407407

408408
raise exceptions.SoftLayerAPIError(ex.response.status_code, message)
409409
except requests.RequestException as ex:

0 commit comments

Comments
 (0)