From f0a64542367d0e689cfc19ccf19c72954334a415 Mon Sep 17 00:00:00 2001 From: try Date: Thu, 13 Aug 2020 16:12:45 +0530 Subject: [PATCH 1/4] Review the change --- SoftLayer/CLI/block/refresh.py | 7 ++++--- SoftLayer/fixtures/SoftLayer_Network_Storage.py | 4 ++-- SoftLayer/managers/storage.py | 8 +++++--- tests/CLI/modules/block_tests.py | 2 +- tests/managers/block_tests.py | 8 ++++---- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/SoftLayer/CLI/block/refresh.py b/SoftLayer/CLI/block/refresh.py index 66a2f3c22..aebc5e668 100644 --- a/SoftLayer/CLI/block/refresh.py +++ b/SoftLayer/CLI/block/refresh.py @@ -1,4 +1,4 @@ -"""Refresh a dependent duplicate volume with a snapshot from its parent.""" +"""Refresh a duplicate volume with a snapshot from its parent.""" # :license: MIT, see LICENSE for more details. import click @@ -11,8 +11,9 @@ @click.argument('snapshot_id') @environment.pass_env def cli(env, volume_id, snapshot_id): - """"Refresh a dependent duplicate volume with a snapshot from its parent.""" + """"Refresh a duplicate volume with a snapshot from its parent.""" block_manager = SoftLayer.BlockStorageManager(env.client) - resp = block_manager.refresh_dep_dupe(volume_id, snapshot_id) + resp = block_manager.refresh_dupe(volume_id, snapshot_id) #remove dep_ in refresh_dep_dupe click.echo(resp) + diff --git a/SoftLayer/fixtures/SoftLayer_Network_Storage.py b/SoftLayer/fixtures/SoftLayer_Network_Storage.py index 611e88005..6fc9ed3e3 100644 --- a/SoftLayer/fixtures/SoftLayer_Network_Storage.py +++ b/SoftLayer/fixtures/SoftLayer_Network_Storage.py @@ -234,8 +234,8 @@ 'provisionedCount': 100 } -refreshDependentDuplicate = { - 'dependentDuplicate': 1 +refreshDuplicate = { #remove Dependent from refreshDependentDuplicate + 'DependentDuplicate': 1 } convertCloneDependentToIndependent = { diff --git a/SoftLayer/managers/storage.py b/SoftLayer/managers/storage.py index fb5190d85..9f750272c 100644 --- a/SoftLayer/managers/storage.py +++ b/SoftLayer/managers/storage.py @@ -415,13 +415,15 @@ def cancel_volume(self, volume_id, reason='No longer needed', immediate=False): return self.client.call('SoftLayer_Billing_Item', 'cancelItem', immediate, True, reason, id=billing_item_id) - def refresh_dep_dupe(self, volume_id, snapshot_id): - """"Refresh a dependent duplicate volume with a snapshot from its parent. + def refresh_dupe(self, volume_id, snapshot_id): #remove dep + """"Refresh a duplicate volume with a snapshot from its parent. :param integer volume_id: The id of the volume :param integer snapshot_id: The id of the snapshot """ - return self.client.call('Network_Storage', 'refreshDependentDuplicate', snapshot_id, id=volume_id) + return self.client.call('Network_Storage', 'refreshDuplicate', snapshot_id, id=volume_id) #remove Dependent + + def convert_dep_dupe(self, volume_id): """Convert a dependent duplicate volume to an independent volume. diff --git a/tests/CLI/modules/block_tests.py b/tests/CLI/modules/block_tests.py index e5f6ba8c5..3aeaa0dc6 100644 --- a/tests/CLI/modules/block_tests.py +++ b/tests/CLI/modules/block_tests.py @@ -717,7 +717,7 @@ def test_volume_limit(self, list_mock): result = self.run_command(['block', 'volume-limits']) self.assert_no_fail(result) - def test_dep_dupe_refresh(self): + def test_dupe_refresh(self): #remove _dep in test_dep_dupe_refresh result = self.run_command(['block', 'volume-refresh', '102', '103']) self.assert_no_fail(result) diff --git a/tests/managers/block_tests.py b/tests/managers/block_tests.py index 1ba644236..cd99f6221 100644 --- a/tests/managers/block_tests.py +++ b/tests/managers/block_tests.py @@ -1043,13 +1043,13 @@ def test_get_ids_from_username_empty(self): self.assert_called_with('SoftLayer_Account', 'getIscsiNetworkStorage') self.assertEqual([], result) - def test_refresh_block_depdupe(self): - result = self.block.refresh_dep_dupe(123, snapshot_id=321) - self.assertEqual(SoftLayer_Network_Storage.refreshDependentDuplicate, result) + def test_refresh_block_dupe(self): #remove dep in block_depdupe + result = self.block.refresh_dupe(123, snapshot_id=321) #remove dep in refresh_dep_dupe + self.assertEqual(SoftLayer_Network_Storage.refreshDuplicate, result) #remove Dependent in refreshDependentDuplicate self.assert_called_with( 'SoftLayer_Network_Storage', - 'refreshDependentDuplicate', + 'refreshDuplicate', #remove Dependent in refreshDependentDuplicate identifier=123 ) From f84b4b66e993d24d66510a94667650d92e141c32 Mon Sep 17 00:00:00 2001 From: try Date: Tue, 1 Sep 2020 22:00:23 +0530 Subject: [PATCH 2/4] Please review slcli --- SoftLayer/CLI/block/refresh.py | 2 +- SoftLayer/CLI/file/refresh.py | 4 ++-- SoftLayer/fixtures/SoftLayer_Network_Storage.py | 4 ++-- SoftLayer/managers/storage.py | 4 ++-- tests/CLI/modules/block_tests.py | 2 +- tests/CLI/modules/file_tests.py | 2 +- tests/managers/block_tests.py | 8 ++++---- tests/managers/file_tests.py | 8 ++++---- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/SoftLayer/CLI/block/refresh.py b/SoftLayer/CLI/block/refresh.py index aebc5e668..0c94ae67f 100644 --- a/SoftLayer/CLI/block/refresh.py +++ b/SoftLayer/CLI/block/refresh.py @@ -13,7 +13,7 @@ def cli(env, volume_id, snapshot_id): """"Refresh a duplicate volume with a snapshot from its parent.""" block_manager = SoftLayer.BlockStorageManager(env.client) - resp = block_manager.refresh_dupe(volume_id, snapshot_id) #remove dep_ in refresh_dep_dupe + resp = block_manager.refresh_dupe(volume_id, snapshot_id) click.echo(resp) diff --git a/SoftLayer/CLI/file/refresh.py b/SoftLayer/CLI/file/refresh.py index c566dac91..765e82730 100644 --- a/SoftLayer/CLI/file/refresh.py +++ b/SoftLayer/CLI/file/refresh.py @@ -11,8 +11,8 @@ @click.argument('snapshot_id') @environment.pass_env def cli(env, volume_id, snapshot_id): - """"Refresh a dependent duplicate volume with a snapshot from its parent.""" + """"Refresh a duplicate volume with a snapshot from its parent.""" file_manager = SoftLayer.FileStorageManager(env.client) - resp = file_manager.refresh_dep_dupe(volume_id, snapshot_id) + resp = file_manager.refresh_dupe(volume_id, snapshot_id) click.echo(resp) diff --git a/SoftLayer/fixtures/SoftLayer_Network_Storage.py b/SoftLayer/fixtures/SoftLayer_Network_Storage.py index 6fc9ed3e3..8f9de6dc2 100644 --- a/SoftLayer/fixtures/SoftLayer_Network_Storage.py +++ b/SoftLayer/fixtures/SoftLayer_Network_Storage.py @@ -234,8 +234,8 @@ 'provisionedCount': 100 } -refreshDuplicate = { #remove Dependent from refreshDependentDuplicate - 'DependentDuplicate': 1 +refreshDuplicate = { + 'dependentDuplicate': 1 } convertCloneDependentToIndependent = { diff --git a/SoftLayer/managers/storage.py b/SoftLayer/managers/storage.py index 9f750272c..cd582701d 100644 --- a/SoftLayer/managers/storage.py +++ b/SoftLayer/managers/storage.py @@ -415,13 +415,13 @@ def cancel_volume(self, volume_id, reason='No longer needed', immediate=False): return self.client.call('SoftLayer_Billing_Item', 'cancelItem', immediate, True, reason, id=billing_item_id) - def refresh_dupe(self, volume_id, snapshot_id): #remove dep + def refresh_dupe(self, volume_id, snapshot_id): """"Refresh a duplicate volume with a snapshot from its parent. :param integer volume_id: The id of the volume :param integer snapshot_id: The id of the snapshot """ - return self.client.call('Network_Storage', 'refreshDuplicate', snapshot_id, id=volume_id) #remove Dependent + return self.client.call('Network_Storage', 'refreshDuplicate', snapshot_id, id=volume_id) diff --git a/tests/CLI/modules/block_tests.py b/tests/CLI/modules/block_tests.py index 3aeaa0dc6..672bd3922 100644 --- a/tests/CLI/modules/block_tests.py +++ b/tests/CLI/modules/block_tests.py @@ -717,7 +717,7 @@ def test_volume_limit(self, list_mock): result = self.run_command(['block', 'volume-limits']) self.assert_no_fail(result) - def test_dupe_refresh(self): #remove _dep in test_dep_dupe_refresh + def test_dupe_refresh(self): result = self.run_command(['block', 'volume-refresh', '102', '103']) self.assert_no_fail(result) diff --git a/tests/CLI/modules/file_tests.py b/tests/CLI/modules/file_tests.py index 1d64f54ae..f29809646 100644 --- a/tests/CLI/modules/file_tests.py +++ b/tests/CLI/modules/file_tests.py @@ -696,7 +696,7 @@ def test_volume_limit(self, list_mock): result = self.run_command(['file', 'volume-limits']) self.assert_no_fail(result) - def test_dep_dupe_refresh(self): + def test_dupe_refresh(self): result = self.run_command(['file', 'volume-refresh', '102', '103']) self.assert_no_fail(result) diff --git a/tests/managers/block_tests.py b/tests/managers/block_tests.py index cd99f6221..6d155345e 100644 --- a/tests/managers/block_tests.py +++ b/tests/managers/block_tests.py @@ -1043,13 +1043,13 @@ def test_get_ids_from_username_empty(self): self.assert_called_with('SoftLayer_Account', 'getIscsiNetworkStorage') self.assertEqual([], result) - def test_refresh_block_dupe(self): #remove dep in block_depdupe - result = self.block.refresh_dupe(123, snapshot_id=321) #remove dep in refresh_dep_dupe - self.assertEqual(SoftLayer_Network_Storage.refreshDuplicate, result) #remove Dependent in refreshDependentDuplicate + def test_refresh_block_dupe(self): + result = self.block.refresh_dupe(123, snapshot_id=321) + self.assertEqual(SoftLayer_Network_Storage.refreshDuplicate, result) self.assert_called_with( 'SoftLayer_Network_Storage', - 'refreshDuplicate', #remove Dependent in refreshDependentDuplicate + 'refreshDuplicate', identifier=123 ) diff --git a/tests/managers/file_tests.py b/tests/managers/file_tests.py index 6df2b8721..141ab9602 100644 --- a/tests/managers/file_tests.py +++ b/tests/managers/file_tests.py @@ -892,13 +892,13 @@ def test_get_ids_from_username_empty(self): self.assert_called_with('SoftLayer_Account', 'getNasNetworkStorage') self.assertEqual([], result) - def test_refresh_file_depdupe(self): - result = self.file.refresh_dep_dupe(123, snapshot_id=321) - self.assertEqual(SoftLayer_Network_Storage.refreshDependentDuplicate, result) + def test_refresh_file_dupe(self): + result = self.file.refresh_dupe(123, snapshot_id=321) + self.assertEqual(SoftLayer_Network_Storage.refreshDuplicate, result) self.assert_called_with( 'SoftLayer_Network_Storage', - 'refreshDependentDuplicate', + 'refreshDuplicate', identifier=123 ) From a96c034f1609d2d4612c64b0c27d1ec62fd809b3 Mon Sep 17 00:00:00 2001 From: try Date: Thu, 10 Sep 2020 22:12:09 +0530 Subject: [PATCH 3/4] final repo-modified the help console comments --- SoftLayer/CLI/block/refresh.py | 2 +- SoftLayer/CLI/file/refresh.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SoftLayer/CLI/block/refresh.py b/SoftLayer/CLI/block/refresh.py index 0c94ae67f..9e610f04a 100644 --- a/SoftLayer/CLI/block/refresh.py +++ b/SoftLayer/CLI/block/refresh.py @@ -11,7 +11,7 @@ @click.argument('snapshot_id') @environment.pass_env def cli(env, volume_id, snapshot_id): - """"Refresh a duplicate volume with a snapshot from its parent.""" + """Refresh a duplicate volume with a snapshot from its parent.""" block_manager = SoftLayer.BlockStorageManager(env.client) resp = block_manager.refresh_dupe(volume_id, snapshot_id) diff --git a/SoftLayer/CLI/file/refresh.py b/SoftLayer/CLI/file/refresh.py index 765e82730..8e2b1c543 100644 --- a/SoftLayer/CLI/file/refresh.py +++ b/SoftLayer/CLI/file/refresh.py @@ -11,7 +11,7 @@ @click.argument('snapshot_id') @environment.pass_env def cli(env, volume_id, snapshot_id): - """"Refresh a duplicate volume with a snapshot from its parent.""" + """Refresh a duplicate volume with a snapshot from its parent.""" file_manager = SoftLayer.FileStorageManager(env.client) resp = file_manager.refresh_dupe(volume_id, snapshot_id) From 77248dc2569ea3c890a27d605bef24df9ef89e7c Mon Sep 17 00:00:00 2001 From: try Date: Fri, 11 Sep 2020 17:57:28 +0530 Subject: [PATCH 4/4] removed extra line --- SoftLayer/CLI/block/refresh.py | 1 - SoftLayer/managers/storage.py | 2 -- 2 files changed, 3 deletions(-) diff --git a/SoftLayer/CLI/block/refresh.py b/SoftLayer/CLI/block/refresh.py index 9e610f04a..369a6c815 100644 --- a/SoftLayer/CLI/block/refresh.py +++ b/SoftLayer/CLI/block/refresh.py @@ -16,4 +16,3 @@ def cli(env, volume_id, snapshot_id): resp = block_manager.refresh_dupe(volume_id, snapshot_id) click.echo(resp) - diff --git a/SoftLayer/managers/storage.py b/SoftLayer/managers/storage.py index cd582701d..8a3c816d2 100644 --- a/SoftLayer/managers/storage.py +++ b/SoftLayer/managers/storage.py @@ -423,8 +423,6 @@ def refresh_dupe(self, volume_id, snapshot_id): """ return self.client.call('Network_Storage', 'refreshDuplicate', snapshot_id, id=volume_id) - - def convert_dep_dupe(self, volume_id): """Convert a dependent duplicate volume to an independent volume.