Added the actual post request to upload

Change-Id: I4297ec4c44c84c2c7b1fefe5f65eac55e5a6845e
This commit is contained in:
Paul Van Eck 2015-01-13 15:14:42 -08:00 committed by David Lenwell
parent 456b885255
commit 38e6276737
2 changed files with 13 additions and 5 deletions

3
.gitignore vendored
View File

@ -8,3 +8,6 @@ cover/*
.project
.pydevproject
build
.tempest/
.venv/

View File

@ -29,6 +29,7 @@ import ConfigParser
import json
import logging
import os
import requests
import subprocess
import time
@ -93,7 +94,7 @@ class RefstackClient:
if not os.path.isfile(self.args.file):
self.logger.error("File not valid: %s" % self.args.file)
exit(1)
self.logger.setLevel(logging.DEBUG)
self.upload_file = self.args.file
def _get_next_stream_subunit_output_file(self, tempest_dir):
@ -164,11 +165,15 @@ class RefstackClient:
def post_results(self, url, content):
'''Post the combined results back to the server.'''
self.logger.debug('API request content: %s ' % content)
try:
url = '%s/v1/results/' % self.args.url
# TODO(cdiep): Post results once the API is available as outlined here:
# github.com/stackforge/refstack/blob/master/specs/approved/api-v1.md
json_content = json.dumps(content)
self.logger.debug('API request content: %s ' % json_content)
response = requests.post(url, data={'data': json.dumps(content)})
self.logger.info(url + " Response: " + str(response.text))
except Exception as e:
self.logger.critical('Failed to post %s - %s ' % (url, e))
raise
def test(self):
'''Execute Tempest test against the cloud.'''