From a497d3a48f4dbcc809560ce4e873970adf796ab5 Mon Sep 17 00:00:00 2001 From: Michael Still Date: Thu, 12 Dec 2013 15:44:40 +1100 Subject: [PATCH] Fix swift push Change-Id: I86c814330b32aa9f27868d5b815f969f5545171f --- turbo_hipster/lib/utils.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/turbo_hipster/lib/utils.py b/turbo_hipster/lib/utils.py index e39e7fd..f9da679 100644 --- a/turbo_hipster/lib/utils.py +++ b/turbo_hipster/lib/utils.py @@ -196,10 +196,14 @@ def push_file(job_log_dir, file_path, publish_config): def swift_push_file(job_log_dir, file_path, swift_config): """ Push a log file to a swift server. """ with open(file_path, 'r') as fd: - name = job_log_dir + '_' + os.path.basename(file_path) - con = swiftclient.client.Connection(swift_config['authurl'], - swift_config['user'], - swift_config['apikey']) + name = os.path.join(job_log_dir, os.path.basename(file_path)) + con = swiftclient.client.Connection( + authurl=swift_config['authurl'], + user=swift_config['user'], + key=swift_config['password'], + os_options={'region_name': swift_config['region']}, + tenant_name=swift_config['tenant'], + auth_version=2.0) obj = con.put_object(swift_config['container'], name, fd) return obj