]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
qa/tasks/vstart_runner.py: remove write_file from LocalRemote
authorChristopher Hoffman <choffman@redhat.com>
Fri, 8 Aug 2025 13:36:37 +0000 (13:36 +0000)
committerChristopher Hoffman <choffman@redhat.com>
Fri, 15 Aug 2025 16:03:31 +0000 (16:03 +0000)
Instead of defining write_file in vstart_runner.py, use write_file
included in remote.py. That way we do not have to maintain two
different versions.

Fixes: https://tracker.ceph.com/issues/72463
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
qa/tasks/vstart_runner.py

index 755ea642d95da27845c191f8d30f63c37a685aea..1aaedb6a8c70141bba3581f644afc6ab582c54c9 100644 (file)
@@ -378,26 +378,6 @@ class LocalRemote(RemoteShell):
         except shutil.SameFileError:
             pass
 
-    def write_file(self, path, data, owner=None,
-                   mode='0644', mkdir=False, append=False, sudo=False):
-        dd = 'sudo dd' if sudo else 'dd'
-        args = dd + ' of=' + path
-        if append:
-            args += ' conv=notrunc oflag=append'
-        if mkdir:
-            mkdirp = 'sudo mkdir -p' if sudo else 'mkdir -p'
-            dirpath = os.path.dirname(path)
-            if dirpath:
-                args = mkdirp + ' ' + dirpath + '\n' + args
-        if mode:
-            chmod = 'sudo chmod' if sudo else 'chmod'
-            args += '\n' + chmod + ' ' + mode + ' ' + path
-        if owner:
-            chown = 'sudo chown' if sudo else 'chown'
-            args += '\n' + chown + ' ' + owner + ' ' + path
-        args = 'set -ex' + '\n' + args
-        self.run(args=args, stdin=data, quiet=True)
-
     def _expand_teuthology_tools(self, args):
         assert isinstance(args, list)
         for tool in self.rewrite_helper_tools: