diff --git a/epuharness/fixture.py b/epuharness/fixture.py index 5c7c5e9..5943b48 100644 --- a/epuharness/fixture.py +++ b/epuharness/fixture.py @@ -1,3 +1,4 @@ +import os import tempfile from socket import timeout @@ -105,7 +106,8 @@ def make_fake_libcloud_site(self): Also creates an instance of the MockEC2NodeDriver for convenience """ from epu.mocklibcloud import MockEC2NodeDriver - _, self.fake_libcloud_db = tempfile.mkstemp() + fh, self.fake_libcloud_db = tempfile.mkstemp() + os.close(fh) site_name = 'ec2-fake' fake_site = { 'name': site_name, diff --git a/epuharness/harness.py b/epuharness/harness.py index e2c1ca4..ac2f6a6 100644 --- a/epuharness/harness.py +++ b/epuharness/harness.py @@ -236,6 +236,7 @@ def _build_phantom_authz_file(self, users): pw_file_contents += "%s\n%s\n" % (user.get('user', ''), user.get('password', '')) (os_handle, pw_filename) = tempfile.mkstemp() + os.close(os_handle) with open(pw_filename, "w") as pw_f: pw_f.write(pw_file_contents) @@ -269,6 +270,7 @@ def _build_phantom_config(self, name, exchange, config, authz_file, logfile=None config_yaml = yaml.dump(merged_config) (os_handle, config_filename) = tempfile.mkstemp(suffix='.yml') + os.close(os_handle) with open(config_filename, "w") as config_f: config_f.write(config_yaml) @@ -340,6 +342,7 @@ def _build_epum_config(self, name, exchange, config, logfile=None, instance=None config_yaml = yaml.dump(merged_config) (os_handle, config_filename) = tempfile.mkstemp(suffix='.yml') + os.close(os_handle) with open(config_filename, "w") as config_f: config_f.write(config_yaml) @@ -415,6 +418,7 @@ def _build_provisioner_config(self, name, exchange, config, logfile=None, instan config_yaml = yaml.dump(merged_config) (os_handle, config_filename) = tempfile.mkstemp(suffix='.yml') + os.close(os_handle) with open(config_filename, "w") as config_f: config_f.write(config_yaml) @@ -485,6 +489,7 @@ def _build_dtrs_config(self, name, exchange, config, logfile=None, instance=None config_yaml = yaml.dump(merged_config) (os_handle, config_filename) = tempfile.mkstemp(suffix='.yml') + os.close(os_handle) with open(config_filename, "w") as config_f: config_f.write(config_yaml) @@ -565,6 +570,7 @@ def _build_process_dispatcher_config(self, exchange, name, config, config_yaml = yaml.dump(merged_config) (os_handle, config_filename) = tempfile.mkstemp(prefix="%s_" % name, suffix='.yml') + os.close(os_handle) with open(config_filename, "w") as config_f: config_f.write(config_yaml) @@ -680,6 +686,7 @@ def _build_eeagent_config(self, exchange, name, process_dispatcher, config_yaml = yaml.dump(config) (os_handle, config_filename) = tempfile.mkstemp(suffix='.yml') + os.close(os_handle) with open(config_filename, "w") as config_f: config_f.write(config_yaml) @@ -817,6 +824,7 @@ def _start_rel(self, name=None, module=None, cls=None, config=None, rel_yaml = yaml.dump(rel) (os_handle, rel_filename) = tempfile.mkstemp(suffix='.yml') + os.close(os_handle) with open(rel_filename, "w") as rel_f: rel_f.write(rel_yaml)