Skip to content

Commit 687678c

Browse files
author
Rajarajan
committed
addressing nitpicky
1 parent 47e49e5 commit 687678c

File tree

7 files changed

+56
-56
lines changed

7 files changed

+56
-56
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,38 @@
1-
"""Failover an inaccessible file volume to its available replicant volume."""
1+
"""Failover an inaccessible block volume to its available replicant volume."""
22
# :license: MIT, see LICENSE for more details.
33

44
import click
55
import SoftLayer
66
from SoftLayer.CLI import environment
7-
from SoftLayer.CLI import formatting
87
from SoftLayer.CLI import exceptions
8+
from SoftLayer.CLI import formatting
99

1010

11-
@click.command(epilog="""Failover an inaccessible block/file volume to its available replicant volume.
12-
If a volume (with replication) becomes inaccessible due to a disaster event, this method can be used to immediately failover to an available replica in another location.
13-
This method does not allow for fail back via the API. To fail back to the original volume after using this method, open a support ticket.
14-
To test failover, use SoftLayer_Network_Storage::failoverToReplicant instead.""")
11+
@click.command(epilog="""Failover an inaccessible block volume to its available replicant volume.
12+
If a volume (with replication) becomes inaccessible due to a disaster event, this method can be used to immediately
13+
failover to an available replica in another location. This method does not allow for failback via API.
14+
After using this method, to failback to the original volume, please open a support ticket.
15+
If you wish to test failover, please use replica-failover.""")
1516
@click.argument('volume-id')
1617
@click.option('--replicant-id', help="ID of the replicant volume")
1718
@environment.pass_env
1819
def cli(env, volume_id, replicant_id):
19-
"""Failover an inaccessible file volume to its available replicant volume."""
20+
"""Failover an inaccessible block volume to its available replicant volume."""
2021
block_storage_manager = SoftLayer.BlockStorageManager(env.client)
2122

22-
click.secho("""WARNING : Failover an inaccessible block/file volume to its available replicant volume."""
23-
"""If a volume (with replication) becomes inaccessible due to a disaster event, this method can be used to immediately failover to an available replica in another location."""
24-
"""This method does not allow for fail back via the API."""
25-
"""To fail back to the original volume after using this method, open a support ticket."""
26-
"""To test failover, use SoftLayer_Network_Storage::failoverToReplicant instead.""",fg = 'red' )
27-
28-
if not (formatting.confirm('Are you sure you want to continue?')):
23+
click.secho("""WARNING : Failover an inaccessible block volume to its available replicant volume."""
24+
"""If a volume (with replication) becomes inaccessible due to a disaster event,"""
25+
"""this method can be used to immediately failover to an available replica in another location."""
26+
"""This method does not allow for failback via the API."""
27+
"""To failback to the original volume after using this method, open a support ticket."""
28+
"""If you wish to test failover, use replica-failover instead.""", fg='red')
29+
30+
if not formatting.confirm('Are you sure you want to continue?'):
2931
raise exceptions.CLIAbort('Aborted.')
3032

3133
block_storage_manager.disaster_recovery_failover_to_replicant(
3234
volume_id,
3335
replicant_id
3436
)
35-
37+
3638
click.echo("Disaster Recovery Failover to replicant is now in progress.")

SoftLayer/CLI/file/replication/disaster_recovery_failover.py

+17-14
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,36 @@
44
import click
55
import SoftLayer
66
from SoftLayer.CLI import environment
7-
from SoftLayer.CLI import formatting
87
from SoftLayer.CLI import exceptions
8+
from SoftLayer.CLI import formatting
99

1010

11-
@click.command(epilog="""Failover an inaccessible block/file volume to its available replicant volume.
12-
If a volume (with replication) becomes inaccessible due to a disaster event, this method can be used to immediately failover to an available replica in another location.
13-
This method does not allow for fail back via API. If you wish to test failover, please use SoftLayer_Network_Storage::failoverToReplicant.
14-
After using this method, to fail back to the original volume, please open a support ticket""")
11+
@click.command(epilog="""Failover an inaccessible file volume to its available replicant volume.
12+
If a volume (with replication) becomes inaccessible due to a disaster event, this method can be used to immediately
13+
failover to an available replica in another location. This method does not allow for failback via API.
14+
After using this method, to failback to the original volume, please open a support ticket.
15+
If you wish to test failover, please use replica-failover.
16+
""")
1517
@click.argument('volume-id')
1618
@click.option('--replicant-id', help="ID of the replicant volume")
1719
@environment.pass_env
1820
def cli(env, volume_id, replicant_id):
1921
"""Failover an inaccessible file volume to its available replicant volume."""
2022
file_storage_manager = SoftLayer.FileStorageManager(env.client)
2123

22-
click.secho("""WARNING : Failover an inaccessible block/file volume to its available replicant volume."""
23-
"""If a volume (with replication) becomes inaccessible due to a disaster event, this method can be used to immediately failover to an available replica in another location."""
24-
"""This method does not allow for fail back via the API."""
25-
"""To fail back to the original volume after using this method, open a support ticket."""
26-
"""To test failover, use SoftLayer_Network_Storage::failoverToReplicant instead.""",fg = 'red' )
27-
28-
if not (formatting.confirm('Are you sure you want to continue?')):
24+
click.secho("""WARNING : Failover an inaccessible file volume to its available replicant volume."""
25+
"""If a volume (with replication) becomes inaccessible due to a disaster event,"""
26+
"""this method can be used to immediately failover to an available replica in another location."""
27+
"""This method does not allow for failback via the API."""
28+
"""To failback to the original volume after using this method, open a support ticket."""
29+
"""If you wish to test failover, use replica-failover instead.""", fg='red')
30+
31+
if not formatting.confirm('Are you sure you want to continue?'):
2932
raise exceptions.CLIAbort('Aborted.')
3033

3134
file_storage_manager.disaster_recovery_failover_to_replicant(
3235
volume_id,
3336
replicant_id
3437
)
35-
36-
click.echo("Disaster Recovery Failover to replicant is now in progress.")
38+
39+
click.echo("Disaster Recovery Failover to replicant is now in progress.")

SoftLayer/managers/storage.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -405,15 +405,14 @@ def disaster_recovery_failover_to_replicant(self, volume_id, replicant_id):
405405
:param integer replicant: ID of replicant to failover to
406406
:return: Returns whether failover to successful or not
407407
"""
408-
return self.client.call('Network_Storage', 'disasterRecoveryFailoverToReplicant', replicant_id, id=volume_id)
408+
return self.client.call('Network_Storage', 'disasterRecoveryFailoverToReplicant', replicant_id, id=volume_id)
409409

410410
def failback_from_replicant(self, volume_id):
411411
"""Failback from a volume replicant.
412412
413413
:param integer volume_id: The id of the volume
414414
:return: Returns whether failback was successful or not
415415
"""
416-
417416
return self.client.call('Network_Storage', 'failbackFromReplicant', id=volume_id)
418417

419418
def cancel_volume(self, volume_id, reason='No longer needed', immediate=False):

tests/CLI/modules/block_tests.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
55
:license: MIT, see LICENSE for more details.
66
"""
7+
from SoftLayer.CLI import exceptions
78
from SoftLayer import SoftLayerAPIError
89
from SoftLayer import testing
9-
from SoftLayer.CLI import exceptions
10+
1011

1112
import json
1213
import mock
@@ -497,9 +498,8 @@ def test_replicant_failover(self):
497498
'--replicant-id=5678'])
498499

499500
self.assert_no_fail(result)
500-
self.assertEqual('Failover to replicant is now in progress.\n',
501-
result.output)
502-
501+
self.assertEqual('Failover to replicant is now in progress.\n', result.output)
502+
503503
@mock.patch('SoftLayer.CLI.formatting.confirm')
504504
@mock.patch('SoftLayer.BlockStorageManager.disaster_recovery_failover_to_replicant')
505505
def test_disaster_recovery_failover(self, disaster_recovery_failover_mock, confirm_mock):
@@ -509,8 +509,7 @@ def test_disaster_recovery_failover(self, disaster_recovery_failover_mock, confi
509509
'--replicant-id=5678'])
510510

511511
self.assert_no_fail(result)
512-
self.assertIn('Disaster Recovery Failover to replicant is now in progress.\n',
513-
result.output)
512+
self.assertIn('Disaster Recovery Failover to replicant is now in progress.\n', result.output)
514513

515514
def test_replication_locations(self):
516515
result = self.run_command(['block', 'replica-locations', '1234'])
@@ -579,7 +578,7 @@ def test_disaster_recovery_failover_aborted(self, confirm_mock):
579578
'--replicant-id=5678'])
580579

581580
self.assertEqual(result.exit_code, 2)
582-
self.assertIsInstance(result.exception, exceptions.CLIAbort)
581+
self.assertIsInstance(result.exception, exceptions.CLIAbort)
583582

584583
def test_replicant_failback(self):
585584
result = self.run_command(['block', 'replica-failback', '12345678'])

tests/CLI/modules/file_tests.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
55
:license: MIT, see LICENSE for more details.
66
"""
7+
from SoftLayer.CLI import exceptions
78
from SoftLayer import SoftLayerError
89
from SoftLayer import testing
9-
from SoftLayer.CLI import exceptions
1010

1111
import json
1212
import mock
@@ -499,12 +499,10 @@ def test_replicant_failover_unsuccessful(self, failover_mock):
499499
def test_disaster_recovery_failover(self, disaster_recovery_failover_mock, confirm_mock):
500500
confirm_mock.return_value = True
501501
disaster_recovery_failover_mock.return_value = True
502-
result = self.run_command(['file', 'disaster-recovery-failover', '12345678',
503-
'--replicant-id=5678'])
502+
result = self.run_command(['file', 'disaster-recovery-failover', '12345678', '--replicant-id=5678'])
504503

505504
self.assert_no_fail(result)
506-
self.assertIn('Disaster Recovery Failover to replicant is now in progress.\n',
507-
result.output)
505+
self.assertIn('Disaster Recovery Failover to replicant is now in progress.\n', result.output)
508506

509507
@mock.patch('SoftLayer.CLI.formatting.confirm')
510508
def test_disaster_recovery_failover_aborted(self, confirm_mock):
@@ -514,8 +512,7 @@ def test_disaster_recovery_failover_aborted(self, confirm_mock):
514512
'--replicant-id=5678'])
515513

516514
self.assertEqual(result.exit_code, 2)
517-
self.assertIsInstance(result.exception, exceptions.CLIAbort)
518-
515+
self.assertIsInstance(result.exception, exceptions.CLIAbort)
519516

520517
def test_replicant_failback(self):
521518
result = self.run_command(['file', 'replica-failback', '12345678'])

tests/managers/block_tests.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ def test_disaster_recovery_failover(self):
394394
'disasterRecoveryFailoverToReplicant',
395395
args=(5678,),
396396
identifier=1234,
397-
)
397+
)
398398

399399
def test_replicant_failback(self):
400400
result = self.block.failback_from_replicant(1234)

tests/managers/file_tests.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -290,16 +290,16 @@ def test_replicant_failover(self):
290290
)
291291

292292
def test_disaster_recovery_failover(self):
293-
result = self.file.disaster_recovery_failover_to_replicant(1234, 5678)
294-
295-
self.assertEqual(
296-
SoftLayer_Network_Storage.disasterRecoveryFailoverToReplicant, result)
297-
self.assert_called_with(
298-
'SoftLayer_Network_Storage',
299-
'disasterRecoveryFailoverToReplicant',
300-
args=(5678,),
301-
identifier=1234,
302-
)
293+
result = self.file.disaster_recovery_failover_to_replicant(1234, 5678)
294+
295+
self.assertEqual(
296+
SoftLayer_Network_Storage.disasterRecoveryFailoverToReplicant, result)
297+
self.assert_called_with(
298+
'SoftLayer_Network_Storage',
299+
'disasterRecoveryFailoverToReplicant',
300+
args=(5678,),
301+
identifier=1234,
302+
)
303303

304304
def test_replicant_failback(self):
305305
result = self.file.failback_from_replicant(1234)

0 commit comments

Comments
 (0)