From 58b246e9fb4f3110f40b9160bab17ec7cae6a4d8 Mon Sep 17 00:00:00 2001 From: Rishabh Dave Date: Wed, 7 Aug 2019 15:18:19 +0530 Subject: [PATCH] orchestra/remote: add a method to create temporary directory Signed-off-by: Rishabh Dave --- teuthology/orchestra/remote.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/teuthology/orchestra/remote.py b/teuthology/orchestra/remote.py index db8317b99e..9ca1c9e1bf 100644 --- a/teuthology/orchestra/remote.py +++ b/teuthology/orchestra/remote.py @@ -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 -- 2.39.5