Skip to content

Commit a556574

Browse files
authored
BugFix: Have rollback determine correct file system (#218)
1 parent db2c45c commit a556574

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

pyntc/devices/ios_device.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,8 +816,9 @@ def redundancy_state(self):
816816
return processor_redundancy_state
817817

818818
def rollback(self, rollback_to):
819+
819820
try:
820-
self.show("configure replace flash:%s force" % rollback_to)
821+
self.show("configure replace %s%s force" % (self._get_file_system(), rollback_to))
821822
except CommandError:
822823
raise RollbackError("Rollback unsuccessful. %s may not exist." % rollback_to)
823824

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,6 @@ exclude = '''
4848
| dist
4949
| blib2to3
5050
| tests/data
51+
| venv
5152
)/
5253
'''

test/unit/test_devices/test_ios_device.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,8 @@ def test_boot_options_show_run(self, mock_boot):
233233
self.assertEqual(boot_options, {"sys": BOOT_IMAGE})
234234
self.device.native.send_command.assert_called_with("show run | inc boot")
235235

236-
def test_rollback(self):
236+
@mock.patch.object(IOSDevice, "_get_file_system", return_value="flash:")
237+
def test_rollback(self, mock_boot):
237238
self.device.rollback("good_checkpoint")
238239
self.device.native.send_command.assert_called_with("configure replace flash:good_checkpoint force")
239240

0 commit comments

Comments
 (0)