]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
qa/vstart_runner.py: add a method to create a temporary directory
authorRishabh Dave <ridave@redhat.com>
Mon, 29 Jul 2019 17:56:51 +0000 (23:26 +0530)
committerRishabh Dave <ridave@redhat.com>
Wed, 6 Nov 2019 06:06:09 +0000 (11:36 +0530)
Add a method that creates a temporary directory and returns the path to
it.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
qa/tasks/vstart_runner.py

index b5b07f8cefa656470d30f1a1ac5204233b863ea6..df1ab39692c5ced2738294aedda005c124e1be66 100644 (file)
@@ -259,6 +259,19 @@ class LocalRemote(object):
                 return
             raise e
 
+    # XXX: accepts only two arugments to maintain compatibility with
+    # teuthology's mkdtemp.
+    def mkdtemp(self, suffix='', parentdir=None):
+        from tempfile import mkdtemp
+
+        # XXX: prefix had to be set without that this method failed against
+        # Python2.7 -
+        # > /usr/lib64/python2.7/tempfile.py(337)mkdtemp()
+        # -> file = _os.path.join(dir, prefix + name + suffix)
+        # (Pdb) p prefix
+        # None
+        return mkdtemp(suffix=suffix, prefix='', dir=parentdir)
+
     def _perform_checks_and_return_list_of_args(self, args, omit_sudo):
         # Since Python's shell simulation can only work when commands are
         # provided as a list of argumensts...