summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Hesketh <josh@nitrotech.org>2014-01-22 15:02:45 +1100
committerJoshua Hesketh <josh@nitrotech.org>2014-01-22 15:02:45 +1100
commit5a2edd4767992eaaae87e72c25546f0d2aa52e3b (patch)
treed4b608bc4b69cc6f0fb371e6c92f47d62bcd6d67
parent7859fde57f53936f6a973f07687c9040f6e1e06d (diff)
downloadturbo-hipster-5a2edd4767992eaaae87e72c25546f0d2aa52e3b.tar.gz
Rename job_log_dir to results_set_name for clarity on parameter purpose
Change-Id: Iecb7ed77e264310dbbaddf88c9440dbd062834ae
-rw-r--r--turbo_hipster/lib/utils.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/turbo_hipster/lib/utils.py b/turbo_hipster/lib/utils.py
index 4a012ae..3bc2505 100644
--- a/turbo_hipster/lib/utils.py
+++ b/turbo_hipster/lib/utils.py
@@ -198,18 +198,18 @@ def execute_to_log(cmd, logfile, timeout=-1,
return p.returncode
-def push_file(job_log_dir, file_path, publish_config):
+def push_file(results_set_name, file_path, publish_config):
""" Push a log file to a server. Returns the public URL """
method = publish_config['type'] + '_push_file'
if method in globals() and hasattr(globals()[method], '__call__'):
- return globals()[method](job_log_dir, file_path, publish_config)
+ return globals()[method](results_set_name, file_path, publish_config)
-def swift_push_file(job_log_dir, file_path, swift_config):
+def swift_push_file(results_set_name, file_path, swift_config):
""" Push a log file to a swift server. """
- def _push_individual_file(job_log_dir, file_path, swift_config):
+ def _push_individual_file(results_set_name, file_path, swift_config):
with open(file_path, 'r') as fd:
- name = os.path.join(job_log_dir, os.path.basename(file_path))
+ name = os.path.join(results_set_name, os.path.basename(file_path))
con = swiftclient.client.Connection(
authurl=swift_config['authurl'],
user=swift_config['user'],
@@ -220,20 +220,20 @@ def swift_push_file(job_log_dir, file_path, swift_config):
con.put_object(swift_config['container'], name, fd)
if os.path.isfile(file_path):
- _push_individual_file(job_log_dir, file_path, swift_config)
+ _push_individual_file(results_set_name, file_path, swift_config)
elif os.path.isdir(file_path):
for path, folders, files in os.walk(file_path):
for f in files:
f_path = os.path.join(path, f)
- _push_individual_file(job_log_dir, f_path, swift_config)
+ _push_individual_file(results_set_name, f_path, swift_config)
return (swift_config['prepend_url'] +
- os.path.join(job_log_dir, os.path.basename(file_path)))
+ os.path.join(results_set_name, os.path.basename(file_path)))
-def local_push_file(job_log_dir, file_path, local_config):
+def local_push_file(results_set_name, file_path, local_config):
""" Copy the file locally somewhere sensible """
- dest_dir = os.path.join(local_config['path'], job_log_dir)
+ dest_dir = os.path.join(local_config['path'], results_set_name)
dest_filename = os.path.basename(file_path)
if not os.path.isdir(dest_dir):
os.makedirs(dest_dir)
@@ -244,11 +244,11 @@ def local_push_file(job_log_dir, file_path, local_config):
shutil.copyfile(file_path, dest_file)
elif os.path.isdir(file_path):
shutil.copytree(file_path, dest_file)
- return local_config['prepend_url'] + os.path.join(job_log_dir,
+ return local_config['prepend_url'] + os.path.join(results_set_name,
dest_filename)
-def scp_push_file(job_log_dir, file_path, local_config):
+def scp_push_file(results_set_name, file_path, local_config):
""" Copy the file remotely over ssh """
# TODO!
pass