Skip to content

Commit 4f26b75

Browse files
authored
BugFix: get filesystem dynamically on rollback (#219)
1 parent 56a2563 commit 4f26b75

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

pyntc/devices/ios_device.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ def rollback(self, rollback_to):
922922
RollbackError: Error if unable to rollback to configuration.
923923
"""
924924
try:
925-
self.show("configure replace flash:%s force" % rollback_to)
925+
self.show("configure replace %s%s force" % (self._get_file_system(), rollback_to))
926926
except CommandError:
927927
raise RollbackError("Rollback unsuccessful. %s may not exist." % rollback_to)
928928

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)