]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
orchestra/remote: add a method to create temporary directory 1301/head
authorRishabh Dave <ridave@redhat.com>
Wed, 7 Aug 2019 09:48:19 +0000 (15:18 +0530)
committerRishabh Dave <ridave@redhat.com>
Wed, 7 Aug 2019 14:04:38 +0000 (19:34 +0530)
Signed-off-by: Rishabh Dave <ridave@redhat.com>
teuthology/orchestra/remote.py

index db8317b99ea4566babb8cd9583b0e50f57d012e6..9ca1c9e1bffedfdedf8d8850c7e4e0ddb3c7ff91 100644 (file)
@@ -206,6 +206,19 @@ class Remote(object):
         r.remote = self
         return r
 
+    def mkdtemp(self, suffix=None, parentdir=None):
+        """
+        Create a temporary directory on remote machine and return it's path.
+        """
+        args = ['mktemp', '-d']
+
+        if suffix:
+            args.append('--suffix=%s' % suffix)
+        if parentdir:
+            args.append('--tmpdir=%s' % parentdir)
+
+        return self.sh(args).strip()
+
     def mktemp(self):
         """
         Make a remote temporary file