Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# Change Log

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

## [5.7.0] - 2018-11-16
- Changes: https://github.com/softlayer/softlayer-python/compare/v5.6.4...master
+ #1089 removed legacy SL message queue commands
+ Support for Hardware reflash firmware CLI/Manager method

## [5.7.0] - 2019-02-15
- Changes: https://github.com/softlayer/softlayer-python/compare/v5.6.4...v5.7.0

+ #1099 Support for security group Ids
+ event-log cli command
Expand Down
14 changes: 4 additions & 10 deletions SoftLayer/CLI/block/access/authorize.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
@click.option('--virtual-id', '-v', multiple=True,
help='The id of one SoftLayer_Virtual_Guest to authorize')
@click.option('--ip-address-id', '-i', multiple=True,
help='The id of one SoftLayer_Network_Subnet_IpAddress'
' to authorize')
help='The id of one SoftLayer_Network_Subnet_IpAddress to authorize')
@click.option('--ip-address', multiple=True,
help='An IP address to authorize')
@environment.pass_env
Expand All @@ -30,16 +29,11 @@ def cli(env, volume_id, hardware_id, virtual_id, ip_address_id, ip_address):
for ip_address_value in ip_address:
ip_address_object = network_manager.ip_lookup(ip_address_value)
if ip_address_object == "":
click.echo("IP Address not found on your account. " +
"Please confirm IP and try again.")
click.echo("IP Address not found on your account. Please confirm IP and try again.")
raise exceptions.ArgumentError('Incorrect IP Address')
else:
ip_address_id_list.append(ip_address_object['id'])
ip_address_id_list.append(ip_address_object['id'])

block_manager.authorize_host_to_volume(volume_id,
hardware_id,
virtual_id,
ip_address_id_list)
block_manager.authorize_host_to_volume(volume_id, hardware_id, virtual_id, ip_address_id_list)

# If no exception was raised, the command succeeded
click.echo('The specified hosts were authorized to access %s' % volume_id)
6 changes: 2 additions & 4 deletions SoftLayer/CLI/file/access/authorize.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,9 @@ def cli(env, volume_id, hardware_id, virtual_id, ip_address_id,
for ip_address_value in ip_address:
ip_address_object = network_manager.ip_lookup(ip_address_value)
if ip_address_object == "":
click.echo("IP Address not found on your account. " +
"Please confirm IP and try again.")
click.echo("IP Address not found on your account. Please confirm IP and try again.")
raise exceptions.ArgumentError('Incorrect IP Address')
else:
ip_address_id_list.append(ip_address_object['id'])
ip_address_id_list.append(ip_address_object['id'])

file_manager.authorize_host_to_volume(volume_id,
hardware_id,
Expand Down
23 changes: 8 additions & 15 deletions SoftLayer/CLI/hardware/edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,18 @@
@click.command()
@click.argument('identifier')
@click.option('--domain', '-D', help="Domain portion of the FQDN")
@click.option('--userfile', '-F',
help="Read userdata from file",
type=click.Path(exists=True, readable=True, resolve_path=True))
@click.option('--tag', '-g',
multiple=True,
@click.option('--userfile', '-F', type=click.Path(exists=True, readable=True, resolve_path=True),
help="Read userdata from file")
@click.option('--tag', '-g', multiple=True,
help="Tags to set or empty string to remove all")
@click.option('--hostname', '-H', help="Host portion of the FQDN")
@click.option('--userdata', '-u', help="User defined metadata string")
@click.option('--public-speed',
help="Public port speed.",
default=None,
type=click.Choice(['0', '10', '100', '1000', '10000']))
@click.option('--private-speed',
help="Private port speed.",
default=None,
type=click.Choice(['0', '10', '100', '1000', '10000']))
@click.option('--public-speed', default=None, type=click.Choice(['0', '10', '100', '1000', '10000', '-1']),
help="Public port speed. -1 is best speed available")
@click.option('--private-speed', default=None, type=click.Choice(['0', '10', '100', '1000', '10000', '-1']),
help="Private port speed. -1 is best speed available")
@environment.pass_env
def cli(env, identifier, domain, userfile, tag, hostname, userdata,
public_speed, private_speed):
def cli(env, identifier, domain, userfile, tag, hostname, userdata, public_speed, private_speed):
"""Edit hardware details."""

if userdata and userfile:
Expand Down
23 changes: 8 additions & 15 deletions SoftLayer/CLI/ticket/attach.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,25 @@

@click.command()
@click.argument('identifier', type=int)
@click.option('--hardware',
'hardware_identifier',
@click.option('--hardware', 'hardware_identifier',
help="The identifier for hardware to attach")
@click.option('--virtual',
'virtual_identifier',
@click.option('--virtual', 'virtual_identifier',
help="The identifier for a virtual server to attach")
@environment.pass_env
def cli(env, identifier, hardware_identifier, virtual_identifier):
"""Attach devices to a ticket."""
ticket_mgr = SoftLayer.TicketManager(env.client)

if hardware_identifier and virtual_identifier:
raise exceptions.ArgumentError(
"Cannot attach hardware and a virtual server at the same time")
elif hardware_identifier:
raise exceptions.ArgumentError("Cannot attach hardware and a virtual server at the same time")

if hardware_identifier:
hardware_mgr = SoftLayer.HardwareManager(env.client)
hardware_id = helpers.resolve_id(hardware_mgr.resolve_ids,
hardware_identifier,
'hardware')
hardware_id = helpers.resolve_id(hardware_mgr.resolve_ids, hardware_identifier, 'hardware')
ticket_mgr.attach_hardware(identifier, hardware_id)
elif virtual_identifier:
vs_mgr = SoftLayer.VSManager(env.client)
vs_id = helpers.resolve_id(vs_mgr.resolve_ids,
virtual_identifier,
'VS')
vs_id = helpers.resolve_id(vs_mgr.resolve_ids, virtual_identifier, 'VS')
ticket_mgr.attach_virtual_server(identifier, vs_id)
else:
raise exceptions.ArgumentError(
"Must have a hardware or virtual server identifier to attach")
raise exceptions.ArgumentError("Must have a hardware or virtual server identifier to attach")
23 changes: 8 additions & 15 deletions SoftLayer/CLI/ticket/detach.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,25 @@

@click.command()
@click.argument('identifier', type=int)
@click.option('--hardware',
'hardware_identifier',
@click.option('--hardware', 'hardware_identifier',
help="The identifier for hardware to detach")
@click.option('--virtual',
'virtual_identifier',
@click.option('--virtual', 'virtual_identifier',
help="The identifier for a virtual server to detach")
@environment.pass_env
def cli(env, identifier, hardware_identifier, virtual_identifier):
"""Detach devices from a ticket."""
ticket_mgr = SoftLayer.TicketManager(env.client)

if hardware_identifier and virtual_identifier:
raise exceptions.ArgumentError(
"Cannot detach hardware and a virtual server at the same time")
elif hardware_identifier:
raise exceptions.ArgumentError("Cannot detach hardware and a virtual server at the same time")

if hardware_identifier:
hardware_mgr = SoftLayer.HardwareManager(env.client)
hardware_id = helpers.resolve_id(hardware_mgr.resolve_ids,
hardware_identifier,
'hardware')
hardware_id = helpers.resolve_id(hardware_mgr.resolve_ids, hardware_identifier, 'hardware')
ticket_mgr.detach_hardware(identifier, hardware_id)
elif virtual_identifier:
vs_mgr = SoftLayer.VSManager(env.client)
vs_id = helpers.resolve_id(vs_mgr.resolve_ids,
virtual_identifier,
'VS')
vs_id = helpers.resolve_id(vs_mgr.resolve_ids, virtual_identifier, 'VS')
ticket_mgr.detach_virtual_server(identifier, vs_id)
else:
raise exceptions.ArgumentError(
"Must have a hardware or virtual server identifier to detach")
raise exceptions.ArgumentError("Must have a hardware or virtual server identifier to detach")
2 changes: 1 addition & 1 deletion SoftLayer/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

:license: MIT, see LICENSE for more details.
"""
VERSION = 'v5.7.0'
VERSION = 'v5.7.1'
API_PUBLIC_ENDPOINT = 'https://api.softlayer.com/xmlrpc/v3.1/'
API_PRIVATE_ENDPOINT = 'https://api.service.softlayer.com/xmlrpc/v3.1/'
API_PUBLIC_ENDPOINT_REST = 'https://api.softlayer.com/rest/v3.1/'
Expand Down
9 changes: 4 additions & 5 deletions SoftLayer/managers/vs.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,14 +428,13 @@ def _create_network_components(
if public_subnet:
if public_vlan is None:
raise exceptions.SoftLayerError("You need to specify a public_vlan with public_subnet")
else:
parameters['primaryNetworkComponent']['networkVlan']['primarySubnet'] = {'id': int(public_subnet)}

parameters['primaryNetworkComponent']['networkVlan']['primarySubnet'] = {'id': int(public_subnet)}
if private_subnet:
if private_vlan is None:
raise exceptions.SoftLayerError("You need to specify a private_vlan with private_subnet")
else:
parameters['primaryBackendNetworkComponent']['networkVlan']['primarySubnet'] = {
"id": int(private_subnet)}

parameters['primaryBackendNetworkComponent']['networkVlan']['primarySubnet'] = {'id': int(private_subnet)}

return parameters

Expand Down
8 changes: 6 additions & 2 deletions SoftLayer/managers/vs_placement.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,18 @@ def list(self, mask=None):
def create(self, placement_object):
"""Creates a placement group

:param dictionary placement_object: Below are the fields you can specify, taken from
https://softlayer.github.io/reference/datatypes/SoftLayer_Virtual_PlacementGroup/
A placement_object is defined as::

placement_object = {
'backendRouterId': 12345,
'name': 'Test Name',
'ruleId': 12345
}

- https://softlayer.github.io/reference/datatypes/SoftLayer_Virtual_PlacementGroup/

:param dictionary placement_object:

"""
return self.client.call('SoftLayer_Virtual_PlacementGroup', 'createObject', placement_object)

Expand Down
4 changes: 2 additions & 2 deletions SoftLayer/transports.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,8 @@ def __call__(self, request):
except ValueError as json_ex:
if ex.response.text == "":
raise exceptions.SoftLayerAPIError(resp.status_code, "Empty response.")
else:
raise exceptions.SoftLayerAPIError(resp.status_code, str(json_ex))

raise exceptions.SoftLayerAPIError(resp.status_code, str(json_ex))

raise exceptions.SoftLayerAPIError(ex.response.status_code, message)
except requests.RequestException as ex:
Expand Down
5 changes: 5 additions & 0 deletions docs/api/managers/vs_placement.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.. _vs_placement:

.. automodule:: SoftLayer.managers.vs_placement
:members:
:inherited-members:
5 changes: 3 additions & 2 deletions docs/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ functionality not fully documented here.

cli/ipsec
cli/vs
cli/hardware
cli/ordering
cli/users

Expand All @@ -34,7 +35,7 @@ To update the configuration, you can use `slcli setup`.
:..............:..................................................................:
: Username : username :
: API Key : oyVmeipYQCNrjVS4rF9bHWV7D75S6pa1fghFl384v7mwRCbHTfuJ8qRORIqoVnha :
: Endpoint URL : https://api.softlayer.com/xmlrpc/v3/ :
: Endpoint URL : https://api.softlayer.com/xmlrpc/v3.1/ :
:..............:..................................................................:
Are you sure you want to write settings to "/home/me/.softlayer"? [y/N]: y

Expand All @@ -47,7 +48,7 @@ To check the configuration, you can use `slcli config show`.
:..............:..................................................................:
: Username : username :
: API Key : oyVmeipYQCNrjVS4rF9bHWV7D75S6pa1fghFl384v7mwRCbHTfuJ8qRORIqoVnha :
: Endpoint URL : https://api.softlayer.com/xmlrpc/v3/ :
: Endpoint URL : https://api.softlayer.com/xmlrpc/v3.1/ :
:..............:..................................................................:


Expand Down
95 changes: 95 additions & 0 deletions docs/cli/hardware.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
.. _cli_hardware:

Interacting with Hardware
==============================


.. click:: SoftLayer.CLI.hardware.cancel_reasons:cli
:prog: hw cancel-reasons
:show-nested:

.. click:: SoftLayer.CLI.hardware.cancel:cli
:prog: hw cancel
:show-nested:

.. click:: SoftLayer.CLI.hardware.create_options:cli
:prog: hw create-options
:show-nested:

.. click:: SoftLayer.CLI.hardware.create:cli
:prog: hw create
:show-nested:


Provides some basic functionality to order a server. `slcli order` has a more full featured method of ordering servers. This command only supports the FAST_PROVISION type.

.. click:: SoftLayer.CLI.hardware.credentials:cli
:prog: hw credentials
:show-nested:


.. click:: SoftLayer.CLI.hardware.detail:cli
:prog: hw detail
:show-nested:


.. click:: SoftLayer.CLI.hardware.edit:cli
:prog: hw edit
:show-nested:

When setting port speed, use "-1" to indicate best possible configuration. Using 10/100/1000/10000 on a server with a redundant interface may result the interface entering a degraded state. See `setPublicNetworkInterfaceSpeed <http://sldn.softlayer.com/reference/services/SoftLayer_Hardware_Server/setPublicNetworkInterfaceSpeed/>`_ for more information.


.. click:: SoftLayer.CLI.hardware.list:cli
:prog: hw list
:show-nested:

.. click:: SoftLayer.CLI.hardware.power:power_cycle
:prog: hw power-cycle
:show-nested:

.. click:: SoftLayer.CLI.hardware.power:power_off
:prog: hw power-off
:show-nested:

.. click:: SoftLayer.CLI.hardware.power:power_on
:prog: hw power-on
:show-nested:

.. click:: SoftLayer.CLI.hardware.power:reboot
:prog: hw reboot
:show-nested:

.. click:: SoftLayer.CLI.hardware.reload:cli
:prog: hw reload
:show-nested:

.. click:: SoftLayer.CLI.hardware.power:rescue
:prog: hw rescue

.. click:: SoftLayer.CLI.hardware.reflash_firmware:cli
:prog: hw reflash-firmware
:show-nested:


Reflash here means the current version of the firmware running on your server will be re-flashed onto the selected hardware. This does require a reboot. See `slcli hw update-firmware` if you want the newest version.

.. click:: SoftLayer.CLI.hardware.update_firmware:cli
:prog: hw update-firmware
:show-nested:


This function updates the firmware of a server. If already at the latest version, no software is installed.

.. click:: SoftLayer.CLI.hardware.toggle_ipmi:cli
:prog: hw toggle-ipmi
:show-nested:


:show-nested:


.. click:: SoftLayer.CLI.hardware.ready:cli
:prog: hw ready
:show-nested:

5 changes: 3 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.coverage',
'sphinx.ext.viewcode']
'sphinx.ext.viewcode',
'sphinx_click.ext']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand All @@ -48,7 +49,7 @@
project = u'SoftLayer API Python Client'
# Hack to avoid the "Redefining built-in 'copyright'" error from static
# analysis tools
globals()['copyright'] = u'2017, SoftLayer Technologies, Inc.'
globals()['copyright'] = u'2019, SoftLayer Technologies, Inc.'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

setup(
name='SoftLayer',
version='5.7.0',
version='5.7.1',
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
author='SoftLayer Technologies, Inc.',
Expand Down
2 changes: 1 addition & 1 deletion snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: slcli # check to see if it's available
version: '5.7.0+git' # check versioning
version: '5.7.1+git' # check versioning
summary: Python based SoftLayer API Tool. # 79 char long summary
description: |
A command-line interface is also included and can be used to manage various SoftLayer products and services.
Expand Down