diff options
author | Peter Barabas <peter.barabas@ericsson.com> | 2015-12-08 13:05:57 +0100 |
---|---|---|
committer | Peter Barabas <peter.barabas@ericsson.com> | 2015-12-08 13:05:57 +0100 |
commit | faecd53622b233f72961ce626ef70788b8a12562 (patch) | |
tree | b693dfa9b8f5cb07f004cb420a1f7c0aa9c5fd4e /deploy/environments/libvirt_environment.py | |
parent | 8b7b4f8bde98b05ee68dbed04fa2861bbaaebc22 (diff) |
Refactor temporary directory creation
Use Python's tempfile instead of forking a shell for mktemp.
Change-Id: Icba442ea08d4098d67fb51575da16e85d4363beb
Signed-off-by: Peter Barabas <peter.barabas@ericsson.com>
Diffstat (limited to 'deploy/environments/libvirt_environment.py')
-rw-r--r-- | deploy/environments/libvirt_environment.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/deploy/environments/libvirt_environment.py b/deploy/environments/libvirt_environment.py index af2d3f8fb..c8a2ef529 100644 --- a/deploy/environments/libvirt_environment.py +++ b/deploy/environments/libvirt_environment.py @@ -11,6 +11,7 @@ from lxml import etree import glob from execution_environment import ExecutionEnvironment +import tempfile from common import ( exec_cmd, @@ -42,7 +43,7 @@ class LibvirtEnvironment(ExecutionEnvironment): exec_cmd('fallocate -l %s %s' % (disk_size, disk_path)) def create_vms(self): - temp_dir = exec_cmd('mktemp -d') + temp_dir = tempfile.mkdtemp() disk_sizes = self.dha.get_disks() for node_id in self.node_ids: vm_name = self.dha.get_node_property(node_id, 'libvirtName') |