Adding the possibility to pass the log url to tempestmail

Tempestmail is being used in other CI that don't work like the
openstack upstream ci, and logs are stored somewhere else.
This patch allows the possibility to pass --log-url option
to tempestmail script override the default log path.

Change-Id: Iab9b448551d1a2ed59b47f91d5a9bcc204e0a703
This commit is contained in:
Arx Cruz 2017-11-07 14:15:07 +01:00
parent 5af9bf1b3f
commit 00f5c97bd9
4 changed files with 11 additions and 4 deletions

View File

@ -28,6 +28,7 @@ Role Variables
* `tempest_until_failure`: false/true - default is false, repeat the run again and again until failure occurs
* `tempest_exit_on_failure`: true/false - whether to exit from role with tempest exit code (default: true)
* `tempestmail_config`: config.yaml - name of config file for tempestmail script
* `tempestmail_log_server`: string - Server where the logs are saved
* `tempest_track_resources`: true/false - whether to save the state of resources after tempest run (default: true)
* `check_tempest_bugs`: true/false - Will check every bugzilla and launchpad bug in the yaml skip file
* `tempest_plugins`: list - List of openstack services tempest plugins to be

View File

@ -37,6 +37,7 @@ tempest_exit_on_failure: true
tempest_version_dict: { 'newton': 'newton', 'ocata': '16.0.0', 'pike': '16.1.0', 'master': 'master'}
tempest_version: "{{ tempest_version_dict[release] }}"
tempestmail_config: config.yaml
tempestmail_log_server: http://logs.openstack.org
tempest_track_resources: true
tempest_test_image_path: http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img
# A dict containing values to be removed from tempest.conf

View File

@ -195,6 +195,8 @@ class TempestMailCmd(object):
help='List of skip files')
parser.add_argument('--output', dest='output',
help='Save the email content in a file')
parser.add_argument('--log-url', dest='log_url',
help='Set log url')
self.args = parser.parse_args(args)
def setup_logging(self):
@ -230,11 +232,13 @@ class TempestMailCmd(object):
console = f.read()
log_path = os.environ.get('LOG_PATH', None)
if log_path:
log_path = urljoin(self.config.default_log_url,
log_path)
if self.args.log_url:
log_path = urljoin(self.args.log_url, log_path)
else:
log_path = urljoin(self.config.default_log_url,
log_path)
else:
log_path = ('Not available yet. Check '
'https://logs.openstack.org')
log_path = ('Not available yet.')
return (console, datetime.datetime.now(), log_path)
except IOError:
return (None, None, None)

View File

@ -52,6 +52,7 @@
./tempestmail.py -c {{ tempestmail_config }} --job
"{{ lookup('env', 'JOB_NAME')|default('Periodic job', true) }}"
--file "{{ working_dir }}/{{ tempest_log_file }}"
{% if tempestmail_log_url %} --log-url "{{ tempestmail_log_url }}" {% endif %}
--skip-file "{{ working_dir }}/tempestmail/tempest_skip_{{ release }}.yml"
args:
chdir: "{{ working_dir }}/tempestmail"