Commit 504a33bf authored by Alain Takoudjou's avatar Alain Takoudjou Committed by Tristan Cavelier

monitor: Correctly send parameters to apachedex

parent 98267686
...@@ -43,7 +43,7 @@ recipe = slapos.recipe.template ...@@ -43,7 +43,7 @@ recipe = slapos.recipe.template
url = ${:_profile_base_location_}/monitor.cfg.in url = ${:_profile_base_location_}/monitor.cfg.in
output = ${buildout:directory}/monitor.cfg output = ${buildout:directory}/monitor.cfg
filename = monitor.cfg filename = monitor.cfg
md5sum = fb6fb065e72773122c5f991b52ebddc5 md5sum = af5c10c05b03b59a49187fd3e151eb43
mode = 0644 mode = 0644
[monitor-bin] [monitor-bin]
...@@ -130,7 +130,7 @@ mode = 0644 ...@@ -130,7 +130,7 @@ mode = 0644
recipe = hexagonit.recipe.download recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/${:filename} url = ${:_profile_base_location_}/${:filename}
download-only = true download-only = true
md5sum = 052b7818d052d115b66ce2b3dab1d7c3 md5sum = 00b230e1dee6e7f25d2050f6f0ae39e2
filename = run-apachedex.py.in filename = run-apachedex.py.in
mode = 0644 mode = 0644
......
...@@ -211,6 +211,7 @@ extra-context = ...@@ -211,6 +211,7 @@ extra-context =
key name :script-name key name :script-name
[apachedex-parameters] [apachedex-parameters]
default_parameter =
# XXX - Sample log file with curent date: apache_access.log-%(date)s.gz # XXX - Sample log file with curent date: apache_access.log-%(date)s.gz
# which will be equivalent to apache_access.log-20150112.gz if the date is 2015-01-12 # which will be equivalent to apache_access.log-20150112.gz if the date is 2015-01-12
apache-log-list = apache-log-list =
......
...@@ -7,13 +7,14 @@ import subprocess ...@@ -7,13 +7,14 @@ import subprocess
from datetime import date from datetime import date
base_name = "{{ name }}".strip() base_name = "{{ name }}".strip()
default = "{{ parameter_dict['default_parameter'] }}".strip()
apache_log_list = """{{ parameter_dict['apache-log-list'] }}""".split('\n') apache_log_list = """{{ parameter_dict['apache-log-list'] }}""".split('\n')
base_list = [base.strip() for base in base_list = [base.strip().split(' ') for base in
"""{{ parameter_dict['base-list'] }}""".split('\n') if base] """{{ parameter_dict['base-list'] }}""".split('\n') if base]
skip_base_list = [base.strip() for base in skip_base_list = [base.strip().split(' ') for base in
"""{{ parameter_dict['skip-base-list'] }}""".split('\n') """{{ parameter_dict['skip-base-list'] }}""".split('\n')
if base] if base]
erp5_base_list = [base.strip() for base in erp5_base_list = [base.strip().split(' ') for base in
"""{{ parameter_dict['erp5-base-list'] }}""".split('\n') """{{ parameter_dict['erp5-base-list'] }}""".split('\n')
if base] if base]
...@@ -31,6 +32,8 @@ if not os.path.exists(folder_today): ...@@ -31,6 +32,8 @@ if not os.path.exists(folder_today):
apachedex = "{{ apachedex_executable }}".strip() apachedex = "{{ apachedex_executable }}".strip()
argument_list = [apachedex, '--js-embed', '--out', argument_list = [apachedex, '--js-embed', '--out',
os.path.join(folder_today, 'ApacheDex-%s.html' % base_name)] os.path.join(folder_today, 'ApacheDex-%s.html' % base_name)]
if default:
argument_list += ['--default', default]
log_list = [] log_list = []
for logfile in apache_log_list: for logfile in apache_log_list:
...@@ -48,15 +51,18 @@ if not log_list: ...@@ -48,15 +51,18 @@ if not log_list:
if erp5_base_list: if erp5_base_list:
argument_list.append('--erp5-base') argument_list.append('--erp5-base')
argument_list += erp5_base_list for args_list in erp5_base_list:
argument_list += args_list
if base_list: if base_list:
argument_list.append('--base') argument_list.append('--base')
argument_list += base_list for args_list in base_list:
argument_list += args_list
if skip_base_list: if skip_base_list:
argument_list.append('--skip-base') argument_list.append('--skip-base')
argument_list += skip_base_list for args_list in skip_base_list:
argument_list += args_list
argument_list.append('--error-detail') argument_list.append('--error-detail')
argument_list += log_list argument_list += log_list
......
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