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 <ridave@redhat.com>
This commit is contained in:
Rishabh Dave 2019-07-29 23:26:51 +05:30
parent b205cf9973
commit 06c6d5c9bc

View 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...