Get UUID from ansible environment variables
Get the uuid set by ansible if exist for logging file creation on disk. validations-common is using this uuid set by ansible from ansible-libs in order to share the same id for logging. Since the tripleo-validations callback plugin will be used for tripleo releases for some times, we need to set this here as well nb: fix doc for pep8 Change-Id: I24ee8fead53dcb9b480447c5fc1d4e2b49e0a8ec
This commit is contained in:
parent
a4882cc2ea
commit
d69e3d763b
@ -20,7 +20,7 @@ __metaclass__ = type
|
||||
import datetime
|
||||
import json
|
||||
import time
|
||||
import os.path
|
||||
import os
|
||||
|
||||
from functools import partial
|
||||
|
||||
@ -75,7 +75,8 @@ class CallbackModule(CallbackBase):
|
||||
'host': play.get_name(),
|
||||
'validation_id': self.env['playbook_name'],
|
||||
'validation_path': self.env['playbook_path'],
|
||||
'id': str(play._uuid),
|
||||
'id': (os.getenv('ANSIBLE_UUID') if os.getenv('ANSIBLE_UUID')
|
||||
else str(play._uuid)),
|
||||
'duration': {
|
||||
'start': current_time()
|
||||
}
|
||||
@ -147,7 +148,8 @@ class CallbackModule(CallbackBase):
|
||||
|
||||
log_file = "{}/{}_{}_{}.json".format(
|
||||
VALIDATIONS_LOG_DIR,
|
||||
self.results[0].get('play').get('id'),
|
||||
(os.getenv('ANSIBLE_UUID') if os.getenv('ANSIBLE_UUID') else
|
||||
self.results[0].get('play').get('id')),
|
||||
self.env['playbook_name'],
|
||||
self.current_time)
|
||||
|
||||
|
@ -103,7 +103,6 @@ Role documentation
|
||||
name=validation['name'],
|
||||
desc=validation['description'],
|
||||
groups=', '.join(validation['groups']),
|
||||
metadata=format_dict(validation['metadata']),
|
||||
hosts=validation['hosts'],
|
||||
parameters=format_dict(validation['parameters']),
|
||||
roles=validation['roles']
|
||||
|
Loading…
x
Reference in New Issue
Block a user