Cluster definition
part of context, Cluster is used to save connection information.
"""
-import teuthology.misc
from teuthology.orchestra import run
class Cluster(object):
remotes = sorted(self.remotes.keys(), key=lambda rem: rem.name)
for remote in remotes:
if sudo:
- teuthology.misc.sudo_write_file(remote, file_name, content, perms=perms, owner=owner)
+ remote.write_file(file_name, content,
+ sudo=True, mode=perms, owner=owner)
else:
if perms is not None or owner is not None:
raise ValueError("To specify perms or owner, sudo must be True")
- teuthology.misc.write_file(remote, file_name, content)
+ remote.write_file(file_name, content)
def only(self, *roles):
"""
],
)
- @patch("teuthology.misc.write_file")
+ @patch("teuthology.orchestra.remote.RemoteShell.write_file")
def test_write_file(self, m_write_file):
self.c.write_file("filename", "content")
- m_write_file.assert_called_with(self.r1, "filename", "content")
+ m_write_file.assert_called_with("filename", "content")
- @patch("teuthology.misc.write_file")
+ @patch("teuthology.orchestra.remote.RemoteShell.write_file")
def test_fails_with_invalid_perms(self, m_write_file):
with pytest.raises(ValueError):
self.c.write_file("filename", "content", sudo=False, perms="invalid")
- @patch("teuthology.misc.write_file")
+ @patch("teuthology.orchestra.remote.RemoteShell.write_file")
def test_fails_with_invalid_owner(self, m_write_file):
with pytest.raises(ValueError):
self.c.write_file("filename", "content", sudo=False, owner="invalid")
- @patch("teuthology.misc.sudo_write_file")
- def test_with_sudo(self, m_sudo_write_file):
+ @patch("teuthology.orchestra.remote.RemoteShell.write_file")
+ def test_with_sudo(self, m_write_file):
self.c.write_file("filename", "content", sudo=True)
- m_sudo_write_file.assert_called_with(self.r1, "filename", "content", owner=None, perms=None)
+ m_write_file.assert_called_with("filename", "content", sudo=True, owner=None, mode=None)