Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion coriolis/osmorphing/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ def _read_file_sudo(self, chroot_path):
if chroot_path.startswith("/") is False:
chroot_path = "/%s" % chroot_path
contents = self._exec_cmd_chroot(
'cat %s' % chroot_path)
'cat "%s"' % chroot_path)
return contents

def _read_grub_config(self, config):
Expand Down
2 changes: 1 addition & 1 deletion coriolis/providers/backup_writers.py
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ def _setup_certificates(self, ssh):

def _read_remote_file_sudo(self, remote_path):
contents = utils.exec_ssh_cmd(
self._ssh, "sudo cat %s" % remote_path, get_pty=True)
self._ssh, 'sudo cat "%s"' % remote_path, get_pty=True)
return contents

def _init_writer(self, ssh, cert_paths):
Expand Down
4 changes: 2 additions & 2 deletions coriolis/tests/osmorphing/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ def test__read_file_sudo(self, mock_exec_cmd_chroot):

result = self.os_morphing_tools._read_file_sudo(chroot_path)

mock_exec_cmd_chroot.assert_called_once_with('cat %s' % chroot_path)
mock_exec_cmd_chroot.assert_called_once_with('cat "%s"' % chroot_path)
self.assertEqual(result, mock_exec_cmd_chroot.return_value)

@mock.patch.object(base.BaseLinuxOSMorphingTools, '_exec_cmd_chroot')
Expand All @@ -817,7 +817,7 @@ def test__read_file_sudo_no_leading_slash(self, mock_exec_cmd_chroot):

result = self.os_morphing_tools._read_file_sudo(chroot_path)

mock_exec_cmd_chroot.assert_called_once_with('cat /%s' % chroot_path)
mock_exec_cmd_chroot.assert_called_once_with('cat "/%s"' % chroot_path)
self.assertEqual(result, mock_exec_cmd_chroot.return_value)

@mock.patch.object(base.BaseLinuxOSMorphingTools, '_read_file_sudo')
Expand Down
3 changes: 2 additions & 1 deletion coriolis/tests/providers/test_backup_writers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1325,7 +1325,8 @@ def test__read_remote_file_sudo(self, mock_exec_ssh_cmd):
mock.sentinel.remote_path)

mock_exec_ssh_cmd.assert_called_once_with(
self._ssh, "sudo cat %s" % mock.sentinel.remote_path, get_pty=True)
self._ssh, 'sudo cat "%s"' % mock.sentinel.remote_path,
get_pty=True)
self.assertEqual(
result, mock_exec_ssh_cmd.return_value)

Expand Down