From: Rishabh Dave Date: Mon, 29 Jul 2019 17:56:51 +0000 (+0530) Subject: qa/vstart_runner.py: add a method to create a temporary directory X-Git-Tag: v15.1.0~639^2~11 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=06c6d5c9bc81b5061609b418fd5aa0fc226530cb;p=ceph-ci.git qa/vstart_runner.py: add a method to create a temporary directory Add a method that creates a temporary directory and returns the path to it. Signed-off-by: Rishabh Dave --- diff --git a/qa/tasks/vstart_runner.py b/qa/tasks/vstart_runner.py index b5b07f8cefa..df1ab39692c 100644 --- a/qa/tasks/vstart_runner.py +++ b/qa/tasks/vstart_runner.py @@ -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...