Commit aa74a8a5 by Jesse Zoldak

DO NOT MERGE: hard code the ansible timing log file name

parent 96e0320f
......@@ -9,7 +9,7 @@ Originally written by 'Jharrod LaFon'
"""
ANSIBLE_TIMER_LOG = os.environ.get('ANSIBLE_TIMER_LOG')
ANSIBLE_TIMER_LOG = os.environ.get('ANSIBLE_TIMER_LOG', 'ansible_timing.log')
class Timestamp(object):
......@@ -83,8 +83,9 @@ class CallbackModule(object):
# python logging infrastructure.
if ANSIBLE_TIMER_LOG is not None:
log_path = self.playbook_start.strftime(ANSIBLE_TIMER_LOG)
print('log_path for timing: {}'.format(log_path))
if not exists(dirname(log_path)):
print('creating directories: {}'.format(dirname(log_path)))
os.makedirs(dirname(log_path))
with open(log_path, 'a') as outfile:
......@@ -119,3 +120,9 @@ class CallbackModule(object):
sort_keys=True,
)
outfile.write('\n')
print('full path to log file: {}'.format(os.path.abspath(log_path)))
print("contents of log file are: ")
with open(log_path, 'r') as log_file:
print log_file.read()
print("end contents of log file.")
......@@ -2,6 +2,7 @@
"variables": {
"aws_access_key": "{{env `AWS_ACCESS_KEY_ID`}}",
"aws_secret_key": "{{env `AWS_SECRET_ACCESS_KEY`}}",
"ansible_timer_log": "{{env `ANSIBLE_TIMER_LOG`}}",
"playbook_remote_dir": "/tmp/packer-edx-playbooks",
"ami": "{{env `JENKINS_WORKER_AMI`}}",
"test_platform_version": "{{env `TEST_PLATFORM_VERSION`}}"
......@@ -61,7 +62,7 @@
"type": "ansible-local",
"playbook_file": "../../playbooks/edx-east/jenkins_worker.yml",
"playbook_dir": "../../playbooks",
"command": "source {{user `playbook_remote_dir`}}/packer-venv/bin/activate && ANSIBLE_TIMER_LOG='log/ansible_timing.log' ansible-playbook",
"command": "source {{user `playbook_remote_dir`}}/packer-venv/bin/activate && ANSIBLE_TIMER_LOG='{{user `ansible_timer_log`}}' ansible-playbook",
"inventory_groups": "jenkins_worker",
"extra_arguments": [
"-vvv"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment