Skip to content

Commit bf8c308

Browse files
RajarajanRajarajan
authored andcommitted
Refactoring the disaster recovery method
1 parent 0f48d23 commit bf8c308

File tree

3 files changed

+6
-22
lines changed

3 files changed

+6
-22
lines changed

SoftLayer/CLI/block/replication/disaster_recovery_failover.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,9 @@ def cli(env, volume_id, replicant_id):
2424
if not (formatting.confirm('Are you sure you want to continue?')):
2525
raise exceptions.CLIAbort('Aborted.')
2626

27-
success = block_storage_manager.disaster_recovery_failover_to_replicant(
27+
block_storage_manager.disaster_recovery_failover_to_replicant(
2828
volume_id,
2929
replicant_id
3030
)
31-
if success:
32-
click.echo("Disaster Recovery Failover to replicant is now in progress.")
33-
else:
34-
click.echo("Disaster Recovery Failover operation could not be initiated.")
31+
32+
click.echo("Disaster Recovery Failover to replicant is now in progress.")

SoftLayer/CLI/file/replication/disaster_recovery_failover.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,9 @@ def cli(env, volume_id, replicant_id):
2424
if not (formatting.confirm('Are you sure you want to continue?')):
2525
raise exceptions.CLIAbort('Aborted.')
2626

27-
success = file_storage_manager.disaster_recovery_failover_to_replicant(
27+
file_storage_manager.disaster_recovery_failover_to_replicant(
2828
volume_id,
2929
replicant_id
3030
)
31-
if success:
32-
click.echo("Disaster Recovery Failover to replicant is now in progress.")
33-
else:
34-
click.echo("Disaster Recovery Failover operation could not be initiated.")
31+
32+
click.echo("Disaster Recovery Failover to replicant is now in progress.")

tests/CLI/modules/block_tests.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -571,18 +571,6 @@ def test_replicant_failover_unsuccessful(self, failover_mock):
571571
self.assertEqual('Failover operation could not be initiated.\n',
572572
result.output)
573573

574-
@mock.patch('SoftLayer.CLI.formatting.confirm')
575-
@mock.patch('SoftLayer.BlockStorageManager.disaster_recovery_failover_to_replicant')
576-
def test_disaster_recovery_failover_unsuccesful(self, disaster_recovery_failover_mock, confirm_mock):
577-
confirm_mock.return_value = True
578-
disaster_recovery_failover_mock.return_value = False
579-
580-
result = self.run_command(['block', 'disaster-recovery-failover', '12345678',
581-
'--replicant-id=5678'])
582-
583-
self.assertIn('Disaster Recovery Failover operation could not be initiated.\n',
584-
result.output)
585-
586574
@mock.patch('SoftLayer.CLI.formatting.confirm')
587575
def test_disaster_recovery_failover_aborted(self, confirm_mock):
588576
confirm_mock.return_value = False

0 commit comments

Comments
 (0)