diff --git a/CHANGELOG.md b/CHANGELOG.md index 389018f52..2ff0afc50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ # Change Log +## [5.8.5] - 2019-12-20 +https://github.com/softlayer/softlayer-python/compare/v5.8.3...v5.8.4 + +- #1199 Fix block storage failback and failover. +- #1202 Order a virtual server private. + + ## [5.8.3] - 2019-12-11 https://github.com/softlayer/softlayer-python/compare/v5.8.2...v5.8.3 diff --git a/SoftLayer/CLI/block/replication/failback.py b/SoftLayer/CLI/block/replication/failback.py index 3887c29c9..88ab6d627 100644 --- a/SoftLayer/CLI/block/replication/failback.py +++ b/SoftLayer/CLI/block/replication/failback.py @@ -8,16 +8,12 @@ @click.command() @click.argument('volume-id') -@click.option('--replicant-id', help="ID of the replicant volume") @environment.pass_env -def cli(env, volume_id, replicant_id): +def cli(env, volume_id): """Failback a block volume from the given replicant volume.""" block_storage_manager = SoftLayer.BlockStorageManager(env.client) - success = block_storage_manager.failback_from_replicant( - volume_id, - replicant_id - ) + success = block_storage_manager.failback_from_replicant(volume_id) if success: click.echo("Failback from replicant is now in progress.") diff --git a/SoftLayer/CLI/block/replication/failover.py b/SoftLayer/CLI/block/replication/failover.py index 545175c4a..cd36b2271 100644 --- a/SoftLayer/CLI/block/replication/failover.py +++ b/SoftLayer/CLI/block/replication/failover.py @@ -9,19 +9,14 @@ @click.command() @click.argument('volume-id') @click.option('--replicant-id', help="ID of the replicant volume") -@click.option('--immediate', - is_flag=True, - default=False, - help="Failover to replicant immediately.") @environment.pass_env -def cli(env, volume_id, replicant_id, immediate): +def cli(env, volume_id, replicant_id): """Failover a block volume to the given replicant volume.""" block_storage_manager = SoftLayer.BlockStorageManager(env.client) success = block_storage_manager.failover_to_replicant( volume_id, - replicant_id, - immediate + replicant_id ) if success: diff --git a/SoftLayer/__init__.py b/SoftLayer/__init__.py index 04ba36aaa..9e14ea38e 100644 --- a/SoftLayer/__init__.py +++ b/SoftLayer/__init__.py @@ -29,7 +29,7 @@ __author__ = 'SoftLayer Technologies, Inc.' __license__ = 'MIT' __copyright__ = 'Copyright 2016 SoftLayer Technologies, Inc.' -__all__ = [ +__all__ = [ # noqa: F405 'BaseClient', 'create_client_from_env', 'Client', diff --git a/SoftLayer/consts.py b/SoftLayer/consts.py index b25cff026..89bcf5187 100644 --- a/SoftLayer/consts.py +++ b/SoftLayer/consts.py @@ -5,7 +5,7 @@ :license: MIT, see LICENSE for more details. """ -VERSION = 'v5.8.3' +VERSION = 'v5.8.4' 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/SoftLayer/managers/block.py b/SoftLayer/managers/block.py index 42cc97e71..1f8c6ec5c 100644 --- a/SoftLayer/managers/block.py +++ b/SoftLayer/managers/block.py @@ -525,28 +525,25 @@ def cancel_block_volume(self, volume_id, reason, id=billing_item_id) - def failover_to_replicant(self, volume_id, replicant_id, immediate=False): + def failover_to_replicant(self, volume_id, replicant_id): """Failover to a volume replicant. :param integer volume_id: The id of the volume :param integer replicant_id: ID of replicant to failover to - :param boolean immediate: Flag indicating if failover is immediate :return: Returns whether failover was successful or not """ return self.client.call('Network_Storage', 'failoverToReplicant', - replicant_id, immediate, id=volume_id) + replicant_id, id=volume_id) - def failback_from_replicant(self, volume_id, replicant_id): + def failback_from_replicant(self, volume_id): """Failback from a volume replicant. :param integer volume_id: The id of the volume - :param integer replicant_id: ID of replicant to failback from :return: Returns whether failback was successful or not """ - return self.client.call('Network_Storage', 'failbackFromReplicant', - replicant_id, id=volume_id) + return self.client.call('Network_Storage', 'failbackFromReplicant', id=volume_id) def set_credential_password(self, access_id, password): """Sets the password for an access host diff --git a/SoftLayer/managers/ordering.py b/SoftLayer/managers/ordering.py index cc9a6344b..e86679f61 100644 --- a/SoftLayer/managers/ordering.py +++ b/SoftLayer/managers/ordering.py @@ -416,7 +416,7 @@ def get_item_capacity(self, items, item_keynames): for item_keyname in item_keynames: for item in items: if item['keyName'] == item_keyname: - if "GUEST_CORE" in item["keyName"]: + if "CORE" in item["keyName"]: item_capacity = item['capacity'] break if "TIER" in item["keyName"]: diff --git a/SoftLayer/shell/core.py b/SoftLayer/shell/core.py index 8946815e2..3762ed833 100644 --- a/SoftLayer/shell/core.py +++ b/SoftLayer/shell/core.py @@ -81,7 +81,7 @@ def cli(ctx, env): return except ShellExit: return - except Exception as ex: + except Exception: env.vars['last_exit_code'] = 1 traceback.print_exc(file=sys.stderr) diff --git a/SoftLayer/testing/xmlrpc.py b/SoftLayer/testing/xmlrpc.py index 1e3bf5f1d..208c1cb11 100644 --- a/SoftLayer/testing/xmlrpc.py +++ b/SoftLayer/testing/xmlrpc.py @@ -83,7 +83,7 @@ def do_POST(self): allow_none=True, methodresponse=True) self.wfile.write(response_body.encode('utf-8')) - except Exception as ex: + except Exception: self.send_response(500) logging.exception("Error while handling request") diff --git a/setup.py b/setup.py index 814d43269..e254b25c7 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ setup( name='SoftLayer', - version='5.8.3', + version='5.8.4', description=DESCRIPTION, long_description=LONG_DESCRIPTION, author='SoftLayer Technologies, Inc.', diff --git a/tests/CLI/helper_tests.py b/tests/CLI/helper_tests.py index 6da71c7d2..5c6656c21 100644 --- a/tests/CLI/helper_tests.py +++ b/tests/CLI/helper_tests.py @@ -154,29 +154,29 @@ def test_sort(self): class FormattedListTests(testing.TestCase): def test_init(self): - l = formatting.listing([1, 'two'], separator=':') - self.assertEqual([1, 'two'], list(l)) - self.assertEqual(':', l.separator) + listing = formatting.listing([1, 'two'], separator=':') + self.assertEqual([1, 'two'], list(listing)) + self.assertEqual(':', listing.separator) - l = formatting.listing([]) - self.assertEqual(',', l.separator) + listing = formatting.listing([]) + self.assertEqual(',', listing.separator) def test_to_python(self): - l = formatting.listing([1, 'two']) - result = l.to_python() + listing = formatting.listing([1, 'two']) + result = listing.to_python() self.assertEqual([1, 'two'], result) - l = formatting.listing(x for x in [1, 'two']) - result = l.to_python() + listing = formatting.listing(x for x in [1, 'two']) + result = listing.to_python() self.assertEqual([1, 'two'], result) def test_str(self): - l = formatting.listing([1, 'two']) - result = str(l) + listing = formatting.listing([1, 'two']) + result = str(listing) self.assertEqual('1,two', result) - l = formatting.listing((x for x in [1, 'two']), separator=':') - result = str(l) + listing = formatting.listing((x for x in [1, 'two']), separator=':') + result = str(listing) self.assertEqual('1:two', result) diff --git a/tests/CLI/modules/block_tests.py b/tests/CLI/modules/block_tests.py index 225476976..b8629de8a 100644 --- a/tests/CLI/modules/block_tests.py +++ b/tests/CLI/modules/block_tests.py @@ -440,7 +440,7 @@ def test_deauthorize_host_to_volume(self): def test_replicant_failover(self): result = self.run_command(['block', 'replica-failover', '12345678', - '--replicant-id=5678', '--immediate']) + '--replicant-id=5678']) self.assert_no_fail(result) self.assertEqual('Failover to replicant is now in progress.\n', @@ -506,8 +506,7 @@ def test_replicant_failover_unsuccessful(self, failover_mock): result.output) def test_replicant_failback(self): - result = self.run_command(['block', 'replica-failback', '12345678', - '--replicant-id=5678']) + result = self.run_command(['block', 'replica-failback', '12345678']) self.assert_no_fail(result) self.assertEqual('Failback from replicant is now in progress.\n', @@ -517,8 +516,7 @@ def test_replicant_failback(self): def test_replicant_failback_unsuccessful(self, failback_mock): failback_mock.return_value = False - result = self.run_command(['block', 'replica-failback', '12345678', - '--replicant-id=5678']) + result = self.run_command(['block', 'replica-failback', '12345678']) self.assertEqual('Failback operation could not be initiated.\n', result.output) diff --git a/tests/managers/block_tests.py b/tests/managers/block_tests.py index bd5ab9d37..f5b3b4371 100644 --- a/tests/managers/block_tests.py +++ b/tests/managers/block_tests.py @@ -328,26 +328,25 @@ def test_cancel_snapshot_exception_snapshot_billing_item_not_found(self): ) def test_replicant_failover(self): - result = self.block.failover_to_replicant(1234, 5678, immediate=True) + result = self.block.failover_to_replicant(1234, 5678) self.assertEqual( fixtures.SoftLayer_Network_Storage.failoverToReplicant, result) self.assert_called_with( 'SoftLayer_Network_Storage', 'failoverToReplicant', - args=(5678, True), + args=(5678,), identifier=1234, ) def test_replicant_failback(self): - result = self.block.failback_from_replicant(1234, 5678) + result = self.block.failback_from_replicant(1234) self.assertEqual( fixtures.SoftLayer_Network_Storage.failbackFromReplicant, result) self.assert_called_with( 'SoftLayer_Network_Storage', 'failbackFromReplicant', - args=(5678,), identifier=1234, ) diff --git a/tests/managers/hardware_tests.py b/tests/managers/hardware_tests.py index fbbdb2218..5710dd0ae 100644 --- a/tests/managers/hardware_tests.py +++ b/tests/managers/hardware_tests.py @@ -281,8 +281,7 @@ def test_cancel_hardware(self): def test_cancel_hardware_no_billing_item(self): mock = self.set_mock('SoftLayer_Hardware_Server', 'getObject') - mock.return_value = {'id': 987, 'openCancellationTicket': {'id': 1234}, - 'openCancellationTicket': {'id': 1234}} + mock.return_value = {'id': 987, 'openCancellationTicket': {'id': 1234}} ex = self.assertRaises(SoftLayer.SoftLayerError, self.hardware.cancel_hardware, diff --git a/tests/managers/vs/vs_capacity_tests.py b/tests/managers/vs/vs_capacity_tests.py index 5229ebec4..bb7178055 100644 --- a/tests/managers/vs/vs_capacity_tests.py +++ b/tests/managers/vs/vs_capacity_tests.py @@ -132,7 +132,6 @@ def test_create_guest(self): 'maxMemory': None, 'hostname': 'A1538172419', 'domain': 'test.com', - 'localDiskFlag': None, 'hourlyBillingFlag': True, 'supplementalCreateObjectOptions': { 'bootMode': None,