Merge "Convert Int to String for shred execute"

This commit is contained in:
Jenkins 2015-07-06 23:49:37 +00:00 committed by Gerrit Code Review
commit a0f7485460
2 changed files with 5 additions and 5 deletions

View File

@ -457,7 +457,7 @@ class GenericHardwareManager(HardwareManager):
npasses = info.get('agent_erase_devices_iterations', 1) npasses = info.get('agent_erase_devices_iterations', 1)
try: try:
utils.execute('shred', '--force', '--zero', '--verbose', utils.execute('shred', '--force', '--zero', '--verbose',
'--iterations', npasses, block_device.name) '--iterations', str(npasses), block_device.name)
except (processutils.ProcessExecutionError, OSError) as e: except (processutils.ProcessExecutionError, OSError) as e:
msg = ("Erasing block device %(dev)s failed with error %(err)s ", msg = ("Erasing block device %(dev)s failed with error %(err)s ",
{'dev': block_device.name, 'err': e}) {'dev': block_device.name, 'err': e})

View File

@ -438,7 +438,7 @@ class TestGenericHardwareManager(test_base.BaseTestCase):
mocked_execute.assert_has_calls([ mocked_execute.assert_has_calls([
mock.call('hdparm', '-I', '/dev/sda'), mock.call('hdparm', '-I', '/dev/sda'),
mock.call('shred', '--force', '--zero', '--verbose', mock.call('shred', '--force', '--zero', '--verbose',
'--iterations', 2, '/dev/sda') '--iterations', '2', '/dev/sda')
]) ])
@mock.patch.object(utils, 'execute') @mock.patch.object(utils, 'execute')
@ -461,7 +461,7 @@ class TestGenericHardwareManager(test_base.BaseTestCase):
mocked_execute.assert_has_calls([ mocked_execute.assert_has_calls([
mock.call('hdparm', '-I', '/dev/sda'), mock.call('hdparm', '-I', '/dev/sda'),
mock.call('shred', '--force', '--zero', '--verbose', mock.call('shred', '--force', '--zero', '--verbose',
'--iterations', 1, '/dev/sda') '--iterations', '1', '/dev/sda')
]) ])
@mock.patch.object(hardware.GenericHardwareManager, @mock.patch.object(hardware.GenericHardwareManager,
@ -519,7 +519,7 @@ class TestGenericHardwareManager(test_base.BaseTestCase):
res = self.hardware._shred_block_device(self.node, block_device) res = self.hardware._shred_block_device(self.node, block_device)
self.assertFalse(res) self.assertFalse(res)
mocked_execute.assert_called_once_with('shred', '--force', '--zero', mocked_execute.assert_called_once_with('shred', '--force', '--zero',
'--verbose', '--iterations', 1, '/dev/sda') '--verbose', '--iterations', '1', '/dev/sda')
@mock.patch.object(utils, 'execute') @mock.patch.object(utils, 'execute')
def test_erase_block_device_shred_fail_processerror(self, mocked_execute): def test_erase_block_device_shred_fail_processerror(self, mocked_execute):
@ -529,7 +529,7 @@ class TestGenericHardwareManager(test_base.BaseTestCase):
res = self.hardware._shred_block_device(self.node, block_device) res = self.hardware._shred_block_device(self.node, block_device)
self.assertFalse(res) self.assertFalse(res)
mocked_execute.assert_called_once_with('shred', '--force', '--zero', mocked_execute.assert_called_once_with('shred', '--force', '--zero',
'--verbose', '--iterations', 1, '/dev/sda') '--verbose', '--iterations', '1', '/dev/sda')
@mock.patch.object(utils, 'execute') @mock.patch.object(utils, 'execute')
def test_erase_block_device_ata_security_enabled(self, mocked_execute): def test_erase_block_device_ata_security_enabled(self, mocked_execute):