From 7506faf79aed891000b93c8956b0daa2109dbc83 Mon Sep 17 00:00:00 2001 From: Christopher Gallo Date: Tue, 26 Feb 2019 21:23:35 -0600 Subject: [PATCH 1/5] 5.7.1 release --- CHANGELOG.md | 9 +++++++-- SoftLayer/consts.py | 2 +- setup.py | 2 +- snap/snapcraft.yaml | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f1d3c128..cb06a9ec7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/SoftLayer/consts.py b/SoftLayer/consts.py index 0400a719c..f3120e27e 100644 --- a/SoftLayer/consts.py +++ b/SoftLayer/consts.py @@ -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/' diff --git a/setup.py b/setup.py index e0ff8b169..12835570f 100644 --- a/setup.py +++ b/setup.py @@ -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.', diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index ce6931ed3..c464f9693 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -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. From ba2ad90bcf090bca221f43ac3fd5917953b17373 Mon Sep 17 00:00:00 2001 From: allmightyspiff Date: Thu, 28 Feb 2019 12:15:02 -0600 Subject: [PATCH 2/5] #1068 doc updates --- SoftLayer/CLI/hardware/edit.py | 25 ++++++++++--------------- SoftLayer/managers/vs_placement.py | 8 ++++++-- docs/api/managers/vs_placement.rst | 5 +++++ docs/cli.rst | 5 +++-- docs/cli/hardware.rst | 3 +++ docs/conf.py | 5 +++-- 6 files changed, 30 insertions(+), 21 deletions(-) create mode 100644 docs/api/managers/vs_placement.rst create mode 100644 docs/cli/hardware.rst diff --git a/SoftLayer/CLI/hardware/edit.py b/SoftLayer/CLI/hardware/edit.py index beca22b3a..e01c23190 100644 --- a/SoftLayer/CLI/hardware/edit.py +++ b/SoftLayer/CLI/hardware/edit.py @@ -12,25 +12,20 @@ @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: diff --git a/SoftLayer/managers/vs_placement.py b/SoftLayer/managers/vs_placement.py index d40a845e9..7fefc3fde 100644 --- a/SoftLayer/managers/vs_placement.py +++ b/SoftLayer/managers/vs_placement.py @@ -50,13 +50,17 @@ 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) diff --git a/docs/api/managers/vs_placement.rst b/docs/api/managers/vs_placement.rst new file mode 100644 index 000000000..d5898f1f0 --- /dev/null +++ b/docs/api/managers/vs_placement.rst @@ -0,0 +1,5 @@ +.. _vs_placement: + +.. automodule:: SoftLayer.managers.vs_placement + :members: + :inherited-members: diff --git a/docs/cli.rst b/docs/cli.rst index bf79aa697..6d8b18218 100644 --- a/docs/cli.rst +++ b/docs/cli.rst @@ -14,6 +14,7 @@ functionality not fully documented here. cli/ipsec cli/vs + cli/hardware cli/ordering cli/users @@ -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 @@ -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/ : :..............:..................................................................: diff --git a/docs/cli/hardware.rst b/docs/cli/hardware.rst new file mode 100644 index 000000000..577de4d1a --- /dev/null +++ b/docs/cli/hardware.rst @@ -0,0 +1,3 @@ +.. click:: SoftLayer.CLI.hardware.list:cli + :prog: slcli hw list + :show-nested: \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index 8c885c2d2..9e4c5205f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -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'] @@ -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 From 555dd702d747ec04f8a57377f98354b86931d4aa Mon Sep 17 00:00:00 2001 From: allmightyspiff Date: Thu, 28 Feb 2019 18:05:44 -0600 Subject: [PATCH 3/5] slcli hw documentation udpates --- SoftLayer/CLI/hardware/edit.py | 14 ++++++-------- docs/cli/hardware.rst | 14 +++++++++++--- docs/cli/hardware/cancel-reasons.rst | 3 +++ docs/cli/hardware/cancel.rst | 3 +++ docs/cli/hardware/create-options.rst | 3 +++ docs/cli/hardware/create.rst | 6 ++++++ docs/cli/hardware/credentials.rst | 3 +++ docs/cli/hardware/detail.rst | 3 +++ docs/cli/hardware/edit.rst | 5 +++++ docs/cli/hardware/list.rst | 3 +++ docs/cli/hardware/power-cycle.rst | 3 +++ docs/cli/hardware/power-off.rst | 3 +++ docs/cli/hardware/power-on.rst | 3 +++ docs/cli/hardware/ready.rst | 3 +++ docs/cli/hardware/reboot.rst | 3 +++ docs/cli/hardware/reflash-firmware.rst | 6 ++++++ docs/cli/hardware/reload.rst | 3 +++ docs/cli/hardware/rescue.rst | 3 +++ docs/cli/hardware/toggle-ipmi.rst | 3 +++ docs/cli/hardware/update-firmware.rst | 6 ++++++ 20 files changed, 82 insertions(+), 11 deletions(-) create mode 100644 docs/cli/hardware/cancel-reasons.rst create mode 100644 docs/cli/hardware/cancel.rst create mode 100644 docs/cli/hardware/create-options.rst create mode 100644 docs/cli/hardware/create.rst create mode 100644 docs/cli/hardware/credentials.rst create mode 100644 docs/cli/hardware/detail.rst create mode 100644 docs/cli/hardware/edit.rst create mode 100644 docs/cli/hardware/list.rst create mode 100644 docs/cli/hardware/power-cycle.rst create mode 100644 docs/cli/hardware/power-off.rst create mode 100644 docs/cli/hardware/power-on.rst create mode 100644 docs/cli/hardware/ready.rst create mode 100644 docs/cli/hardware/reboot.rst create mode 100644 docs/cli/hardware/reflash-firmware.rst create mode 100644 docs/cli/hardware/reload.rst create mode 100644 docs/cli/hardware/rescue.rst create mode 100644 docs/cli/hardware/toggle-ipmi.rst create mode 100644 docs/cli/hardware/update-firmware.rst diff --git a/SoftLayer/CLI/hardware/edit.py b/SoftLayer/CLI/hardware/edit.py index e01c23190..708d1463d 100644 --- a/SoftLayer/CLI/hardware/edit.py +++ b/SoftLayer/CLI/hardware/edit.py @@ -12,18 +12,16 @@ @click.command() @click.argument('identifier') @click.option('--domain', '-D', help="Domain portion of the FQDN") -@click.option('--userfile', '-F', type=click.Path(exists=True, readable=True, resolve_path=True, - help="Read userdata from file")) +@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', 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")) +@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): """Edit hardware details.""" diff --git a/docs/cli/hardware.rst b/docs/cli/hardware.rst index 577de4d1a..f4a848bb9 100644 --- a/docs/cli/hardware.rst +++ b/docs/cli/hardware.rst @@ -1,3 +1,11 @@ -.. click:: SoftLayer.CLI.hardware.list:cli - :prog: slcli hw list - :show-nested: \ No newline at end of file +.. _cli_hardware: + +Interacting with Hardware +============================== + + +.. toctree:: + :maxdepth: 1 + :glob: + + hardware/* diff --git a/docs/cli/hardware/cancel-reasons.rst b/docs/cli/hardware/cancel-reasons.rst new file mode 100644 index 000000000..21cf30ef6 --- /dev/null +++ b/docs/cli/hardware/cancel-reasons.rst @@ -0,0 +1,3 @@ +.. click:: SoftLayer.CLI.hardware.cancel_reasons:cli + :prog: hw cancel-reasons + :show-nested: \ No newline at end of file diff --git a/docs/cli/hardware/cancel.rst b/docs/cli/hardware/cancel.rst new file mode 100644 index 000000000..6843c0544 --- /dev/null +++ b/docs/cli/hardware/cancel.rst @@ -0,0 +1,3 @@ +.. click:: SoftLayer.CLI.hardware.cancel:cli + :prog: hw cancel + :show-nested: \ No newline at end of file diff --git a/docs/cli/hardware/create-options.rst b/docs/cli/hardware/create-options.rst new file mode 100644 index 000000000..535bc944d --- /dev/null +++ b/docs/cli/hardware/create-options.rst @@ -0,0 +1,3 @@ +.. click:: SoftLayer.CLI.hardware.create_options:cli + :prog: hw create-options + :show-nested: \ No newline at end of file diff --git a/docs/cli/hardware/create.rst b/docs/cli/hardware/create.rst new file mode 100644 index 000000000..6e8102d2c --- /dev/null +++ b/docs/cli/hardware/create.rst @@ -0,0 +1,6 @@ +.. 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. \ No newline at end of file diff --git a/docs/cli/hardware/credentials.rst b/docs/cli/hardware/credentials.rst new file mode 100644 index 000000000..f16175ea7 --- /dev/null +++ b/docs/cli/hardware/credentials.rst @@ -0,0 +1,3 @@ +.. click:: SoftLayer.CLI.hardware.credentials:cli + :prog: hw credentials + :show-nested: \ No newline at end of file diff --git a/docs/cli/hardware/detail.rst b/docs/cli/hardware/detail.rst new file mode 100644 index 000000000..1f78111b5 --- /dev/null +++ b/docs/cli/hardware/detail.rst @@ -0,0 +1,3 @@ +.. click:: SoftLayer.CLI.hardware.detail:cli + :prog: hw detail + :show-nested: \ No newline at end of file diff --git a/docs/cli/hardware/edit.rst b/docs/cli/hardware/edit.rst new file mode 100644 index 000000000..2f40e4bd5 --- /dev/null +++ b/docs/cli/hardware/edit.rst @@ -0,0 +1,5 @@ +.. 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 `_ for more information. \ No newline at end of file diff --git a/docs/cli/hardware/list.rst b/docs/cli/hardware/list.rst new file mode 100644 index 000000000..175c96ccd --- /dev/null +++ b/docs/cli/hardware/list.rst @@ -0,0 +1,3 @@ +.. click:: SoftLayer.CLI.hardware.list:cli + :prog: hw list + :show-nested: \ No newline at end of file diff --git a/docs/cli/hardware/power-cycle.rst b/docs/cli/hardware/power-cycle.rst new file mode 100644 index 000000000..9959b14dd --- /dev/null +++ b/docs/cli/hardware/power-cycle.rst @@ -0,0 +1,3 @@ +.. click:: SoftLayer.CLI.hardware.power:power_cycle + :prog: hw power-cycle + :show-nested: \ No newline at end of file diff --git a/docs/cli/hardware/power-off.rst b/docs/cli/hardware/power-off.rst new file mode 100644 index 000000000..3a34cbfbf --- /dev/null +++ b/docs/cli/hardware/power-off.rst @@ -0,0 +1,3 @@ +.. click:: SoftLayer.CLI.hardware.power:power_off + :prog: hw power-off + :show-nested: \ No newline at end of file diff --git a/docs/cli/hardware/power-on.rst b/docs/cli/hardware/power-on.rst new file mode 100644 index 000000000..aff596242 --- /dev/null +++ b/docs/cli/hardware/power-on.rst @@ -0,0 +1,3 @@ +.. click:: SoftLayer.CLI.hardware.power:power_on + :prog: hw power-on + :show-nested: \ No newline at end of file diff --git a/docs/cli/hardware/ready.rst b/docs/cli/hardware/ready.rst new file mode 100644 index 000000000..8ef18946f --- /dev/null +++ b/docs/cli/hardware/ready.rst @@ -0,0 +1,3 @@ +.. click:: SoftLayer.CLI.hardware.ready:cli + :prog: hw ready + :show-nested: \ No newline at end of file diff --git a/docs/cli/hardware/reboot.rst b/docs/cli/hardware/reboot.rst new file mode 100644 index 000000000..c68c188c4 --- /dev/null +++ b/docs/cli/hardware/reboot.rst @@ -0,0 +1,3 @@ +.. click:: SoftLayer.CLI.hardware.power:reboot + :prog: hw reboot + :show-nested: \ No newline at end of file diff --git a/docs/cli/hardware/reflash-firmware.rst b/docs/cli/hardware/reflash-firmware.rst new file mode 100644 index 000000000..da0ffa3e1 --- /dev/null +++ b/docs/cli/hardware/reflash-firmware.rst @@ -0,0 +1,6 @@ +.. 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. \ No newline at end of file diff --git a/docs/cli/hardware/reload.rst b/docs/cli/hardware/reload.rst new file mode 100644 index 000000000..91ddc4247 --- /dev/null +++ b/docs/cli/hardware/reload.rst @@ -0,0 +1,3 @@ +.. click:: SoftLayer.CLI.hardware.reload:cli + :prog: hw reload + :show-nested: \ No newline at end of file diff --git a/docs/cli/hardware/rescue.rst b/docs/cli/hardware/rescue.rst new file mode 100644 index 000000000..7602eecd6 --- /dev/null +++ b/docs/cli/hardware/rescue.rst @@ -0,0 +1,3 @@ +.. click:: SoftLayer.CLI.hardware.power:rescue + :prog: hw rescue + :show-nested: \ No newline at end of file diff --git a/docs/cli/hardware/toggle-ipmi.rst b/docs/cli/hardware/toggle-ipmi.rst new file mode 100644 index 000000000..b92eacc3e --- /dev/null +++ b/docs/cli/hardware/toggle-ipmi.rst @@ -0,0 +1,3 @@ +.. click:: SoftLayer.CLI.hardware.toggle_ipmi:cli + :prog: hw toggle-ipmi + :show-nested: \ No newline at end of file diff --git a/docs/cli/hardware/update-firmware.rst b/docs/cli/hardware/update-firmware.rst new file mode 100644 index 000000000..3c105d0bf --- /dev/null +++ b/docs/cli/hardware/update-firmware.rst @@ -0,0 +1,6 @@ +.. 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. \ No newline at end of file From 1606f9a34e56d624d3e5568e22c948bd2e730f1c Mon Sep 17 00:00:00 2001 From: allmightyspiff Date: Thu, 28 Feb 2019 18:32:40 -0600 Subject: [PATCH 4/5] #1068 fixed a bunch of 'no-else-raise' warnings --- SoftLayer/CLI/block/access/authorize.py | 14 ++++---------- SoftLayer/CLI/file/access/authorize.py | 6 ++---- SoftLayer/CLI/hardware/edit.py | 2 +- SoftLayer/CLI/ticket/attach.py | 23 ++++++++--------------- SoftLayer/CLI/ticket/detach.py | 23 ++++++++--------------- SoftLayer/managers/vs.py | 9 ++++----- SoftLayer/managers/vs_placement.py | 4 ++-- SoftLayer/transports.py | 4 ++-- 8 files changed, 31 insertions(+), 54 deletions(-) diff --git a/SoftLayer/CLI/block/access/authorize.py b/SoftLayer/CLI/block/access/authorize.py index df76b60e6..bf2da3af3 100644 --- a/SoftLayer/CLI/block/access/authorize.py +++ b/SoftLayer/CLI/block/access/authorize.py @@ -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 @@ -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) diff --git a/SoftLayer/CLI/file/access/authorize.py b/SoftLayer/CLI/file/access/authorize.py index 92fe03653..835f5995f 100644 --- a/SoftLayer/CLI/file/access/authorize.py +++ b/SoftLayer/CLI/file/access/authorize.py @@ -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, diff --git a/SoftLayer/CLI/hardware/edit.py b/SoftLayer/CLI/hardware/edit.py index 708d1463d..e4aca4dcc 100644 --- a/SoftLayer/CLI/hardware/edit.py +++ b/SoftLayer/CLI/hardware/edit.py @@ -18,7 +18,7 @@ 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', default=None, type=click.Choice(['0', '10', '100', '1000', '10000', '-1']), +@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") diff --git a/SoftLayer/CLI/ticket/attach.py b/SoftLayer/CLI/ticket/attach.py index 98adaa65b..c3086659f 100644 --- a/SoftLayer/CLI/ticket/attach.py +++ b/SoftLayer/CLI/ticket/attach.py @@ -11,11 +11,9 @@ @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): @@ -23,20 +21,15 @@ def cli(env, identifier, hardware_identifier, virtual_identifier): 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") diff --git a/SoftLayer/CLI/ticket/detach.py b/SoftLayer/CLI/ticket/detach.py index 8c8cae058..94a6f72ea 100644 --- a/SoftLayer/CLI/ticket/detach.py +++ b/SoftLayer/CLI/ticket/detach.py @@ -11,11 +11,9 @@ @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): @@ -23,20 +21,15 @@ def cli(env, identifier, hardware_identifier, virtual_identifier): 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") diff --git a/SoftLayer/managers/vs.py b/SoftLayer/managers/vs.py index a3f26126e..00b738d0c 100644 --- a/SoftLayer/managers/vs.py +++ b/SoftLayer/managers/vs.py @@ -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 diff --git a/SoftLayer/managers/vs_placement.py b/SoftLayer/managers/vs_placement.py index 7fefc3fde..d492b2a1e 100644 --- a/SoftLayer/managers/vs_placement.py +++ b/SoftLayer/managers/vs_placement.py @@ -57,10 +57,10 @@ def create(self, placement_object): 'name': 'Test Name', 'ruleId': 12345 } - + - https://softlayer.github.io/reference/datatypes/SoftLayer_Virtual_PlacementGroup/ - :param dictionary placement_object: + :param dictionary placement_object: """ return self.client.call('SoftLayer_Virtual_PlacementGroup', 'createObject', placement_object) diff --git a/SoftLayer/transports.py b/SoftLayer/transports.py index eaee84716..56eb14e7c 100644 --- a/SoftLayer/transports.py +++ b/SoftLayer/transports.py @@ -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: From 32d0bbe7b53c00dd1e852042a30e6fe39cecf864 Mon Sep 17 00:00:00 2001 From: allmightyspiff Date: Wed, 6 Mar 2019 15:41:59 -0600 Subject: [PATCH 5/5] moved hardware commands into a single file --- docs/cli/hardware.rst | 92 ++++++++++++++++++++++++-- docs/cli/hardware/cancel-reasons.rst | 3 - docs/cli/hardware/cancel.rst | 3 - docs/cli/hardware/create-options.rst | 3 - docs/cli/hardware/create.rst | 6 -- docs/cli/hardware/credentials.rst | 3 - docs/cli/hardware/detail.rst | 3 - docs/cli/hardware/edit.rst | 5 -- docs/cli/hardware/list.rst | 3 - docs/cli/hardware/power-cycle.rst | 3 - docs/cli/hardware/power-off.rst | 3 - docs/cli/hardware/power-on.rst | 3 - docs/cli/hardware/ready.rst | 3 - docs/cli/hardware/reboot.rst | 3 - docs/cli/hardware/reflash-firmware.rst | 6 -- docs/cli/hardware/reload.rst | 3 - docs/cli/hardware/rescue.rst | 3 - docs/cli/hardware/toggle-ipmi.rst | 3 - docs/cli/hardware/update-firmware.rst | 6 -- 19 files changed, 88 insertions(+), 69 deletions(-) delete mode 100644 docs/cli/hardware/cancel-reasons.rst delete mode 100644 docs/cli/hardware/cancel.rst delete mode 100644 docs/cli/hardware/create-options.rst delete mode 100644 docs/cli/hardware/create.rst delete mode 100644 docs/cli/hardware/credentials.rst delete mode 100644 docs/cli/hardware/detail.rst delete mode 100644 docs/cli/hardware/edit.rst delete mode 100644 docs/cli/hardware/list.rst delete mode 100644 docs/cli/hardware/power-cycle.rst delete mode 100644 docs/cli/hardware/power-off.rst delete mode 100644 docs/cli/hardware/power-on.rst delete mode 100644 docs/cli/hardware/ready.rst delete mode 100644 docs/cli/hardware/reboot.rst delete mode 100644 docs/cli/hardware/reflash-firmware.rst delete mode 100644 docs/cli/hardware/reload.rst delete mode 100644 docs/cli/hardware/rescue.rst delete mode 100644 docs/cli/hardware/toggle-ipmi.rst delete mode 100644 docs/cli/hardware/update-firmware.rst diff --git a/docs/cli/hardware.rst b/docs/cli/hardware.rst index f4a848bb9..5b3f480b1 100644 --- a/docs/cli/hardware.rst +++ b/docs/cli/hardware.rst @@ -4,8 +4,92 @@ Interacting with Hardware ============================== -.. toctree:: - :maxdepth: 1 - :glob: +.. 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 `_ 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: - hardware/* diff --git a/docs/cli/hardware/cancel-reasons.rst b/docs/cli/hardware/cancel-reasons.rst deleted file mode 100644 index 21cf30ef6..000000000 --- a/docs/cli/hardware/cancel-reasons.rst +++ /dev/null @@ -1,3 +0,0 @@ -.. click:: SoftLayer.CLI.hardware.cancel_reasons:cli - :prog: hw cancel-reasons - :show-nested: \ No newline at end of file diff --git a/docs/cli/hardware/cancel.rst b/docs/cli/hardware/cancel.rst deleted file mode 100644 index 6843c0544..000000000 --- a/docs/cli/hardware/cancel.rst +++ /dev/null @@ -1,3 +0,0 @@ -.. click:: SoftLayer.CLI.hardware.cancel:cli - :prog: hw cancel - :show-nested: \ No newline at end of file diff --git a/docs/cli/hardware/create-options.rst b/docs/cli/hardware/create-options.rst deleted file mode 100644 index 535bc944d..000000000 --- a/docs/cli/hardware/create-options.rst +++ /dev/null @@ -1,3 +0,0 @@ -.. click:: SoftLayer.CLI.hardware.create_options:cli - :prog: hw create-options - :show-nested: \ No newline at end of file diff --git a/docs/cli/hardware/create.rst b/docs/cli/hardware/create.rst deleted file mode 100644 index 6e8102d2c..000000000 --- a/docs/cli/hardware/create.rst +++ /dev/null @@ -1,6 +0,0 @@ -.. 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. \ No newline at end of file diff --git a/docs/cli/hardware/credentials.rst b/docs/cli/hardware/credentials.rst deleted file mode 100644 index f16175ea7..000000000 --- a/docs/cli/hardware/credentials.rst +++ /dev/null @@ -1,3 +0,0 @@ -.. click:: SoftLayer.CLI.hardware.credentials:cli - :prog: hw credentials - :show-nested: \ No newline at end of file diff --git a/docs/cli/hardware/detail.rst b/docs/cli/hardware/detail.rst deleted file mode 100644 index 1f78111b5..000000000 --- a/docs/cli/hardware/detail.rst +++ /dev/null @@ -1,3 +0,0 @@ -.. click:: SoftLayer.CLI.hardware.detail:cli - :prog: hw detail - :show-nested: \ No newline at end of file diff --git a/docs/cli/hardware/edit.rst b/docs/cli/hardware/edit.rst deleted file mode 100644 index 2f40e4bd5..000000000 --- a/docs/cli/hardware/edit.rst +++ /dev/null @@ -1,5 +0,0 @@ -.. 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 `_ for more information. \ No newline at end of file diff --git a/docs/cli/hardware/list.rst b/docs/cli/hardware/list.rst deleted file mode 100644 index 175c96ccd..000000000 --- a/docs/cli/hardware/list.rst +++ /dev/null @@ -1,3 +0,0 @@ -.. click:: SoftLayer.CLI.hardware.list:cli - :prog: hw list - :show-nested: \ No newline at end of file diff --git a/docs/cli/hardware/power-cycle.rst b/docs/cli/hardware/power-cycle.rst deleted file mode 100644 index 9959b14dd..000000000 --- a/docs/cli/hardware/power-cycle.rst +++ /dev/null @@ -1,3 +0,0 @@ -.. click:: SoftLayer.CLI.hardware.power:power_cycle - :prog: hw power-cycle - :show-nested: \ No newline at end of file diff --git a/docs/cli/hardware/power-off.rst b/docs/cli/hardware/power-off.rst deleted file mode 100644 index 3a34cbfbf..000000000 --- a/docs/cli/hardware/power-off.rst +++ /dev/null @@ -1,3 +0,0 @@ -.. click:: SoftLayer.CLI.hardware.power:power_off - :prog: hw power-off - :show-nested: \ No newline at end of file diff --git a/docs/cli/hardware/power-on.rst b/docs/cli/hardware/power-on.rst deleted file mode 100644 index aff596242..000000000 --- a/docs/cli/hardware/power-on.rst +++ /dev/null @@ -1,3 +0,0 @@ -.. click:: SoftLayer.CLI.hardware.power:power_on - :prog: hw power-on - :show-nested: \ No newline at end of file diff --git a/docs/cli/hardware/ready.rst b/docs/cli/hardware/ready.rst deleted file mode 100644 index 8ef18946f..000000000 --- a/docs/cli/hardware/ready.rst +++ /dev/null @@ -1,3 +0,0 @@ -.. click:: SoftLayer.CLI.hardware.ready:cli - :prog: hw ready - :show-nested: \ No newline at end of file diff --git a/docs/cli/hardware/reboot.rst b/docs/cli/hardware/reboot.rst deleted file mode 100644 index c68c188c4..000000000 --- a/docs/cli/hardware/reboot.rst +++ /dev/null @@ -1,3 +0,0 @@ -.. click:: SoftLayer.CLI.hardware.power:reboot - :prog: hw reboot - :show-nested: \ No newline at end of file diff --git a/docs/cli/hardware/reflash-firmware.rst b/docs/cli/hardware/reflash-firmware.rst deleted file mode 100644 index da0ffa3e1..000000000 --- a/docs/cli/hardware/reflash-firmware.rst +++ /dev/null @@ -1,6 +0,0 @@ -.. 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. \ No newline at end of file diff --git a/docs/cli/hardware/reload.rst b/docs/cli/hardware/reload.rst deleted file mode 100644 index 91ddc4247..000000000 --- a/docs/cli/hardware/reload.rst +++ /dev/null @@ -1,3 +0,0 @@ -.. click:: SoftLayer.CLI.hardware.reload:cli - :prog: hw reload - :show-nested: \ No newline at end of file diff --git a/docs/cli/hardware/rescue.rst b/docs/cli/hardware/rescue.rst deleted file mode 100644 index 7602eecd6..000000000 --- a/docs/cli/hardware/rescue.rst +++ /dev/null @@ -1,3 +0,0 @@ -.. click:: SoftLayer.CLI.hardware.power:rescue - :prog: hw rescue - :show-nested: \ No newline at end of file diff --git a/docs/cli/hardware/toggle-ipmi.rst b/docs/cli/hardware/toggle-ipmi.rst deleted file mode 100644 index b92eacc3e..000000000 --- a/docs/cli/hardware/toggle-ipmi.rst +++ /dev/null @@ -1,3 +0,0 @@ -.. click:: SoftLayer.CLI.hardware.toggle_ipmi:cli - :prog: hw toggle-ipmi - :show-nested: \ No newline at end of file diff --git a/docs/cli/hardware/update-firmware.rst b/docs/cli/hardware/update-firmware.rst deleted file mode 100644 index 3c105d0bf..000000000 --- a/docs/cli/hardware/update-firmware.rst +++ /dev/null @@ -1,6 +0,0 @@ -.. 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. \ No newline at end of file