install default logging config
By default gear dies not deliver default logging configuration. If it is started in this configuration it floods /var/log/messages with debug info. Log configuration activation should be done via systemd override.conf file by setting proper ARGS Update jobs to also collect /var/logs/gear in post-run task. Change-Id: Ib69c976062afd38a91a3d882e9389c5cbef244c3 Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
parent
e15286de6a
commit
9fd77b3856
@ -2,6 +2,7 @@
|
||||
name: ansible-role-gearman-base
|
||||
pre-run: tests/playbooks/pre.yaml
|
||||
run: tests/playbooks/run.yaml
|
||||
post-run: tests/collect-logs.yaml
|
||||
roles:
|
||||
- zuul: openstack/ansible-role-gearman
|
||||
|
||||
|
@ -45,6 +45,12 @@ gear_file_ssl_key_mode: 0600
|
||||
gear_file_ssl_key_owner: "{{ gear_user_name }}"
|
||||
gear_file_ssl_key_src: etc/gear/ssl/server.key
|
||||
|
||||
gear_file_log_config_dest: /etc/gear/logging.conf
|
||||
gear_file_log_config_group: "{{ gear_user_group }}"
|
||||
gear_file_log_config_mode: 0644
|
||||
gear_file_log_config_owner: "{{ gear_user_name }}"
|
||||
gear_file_log_config_src: etc/gear/logging.conf
|
||||
|
||||
# tasks/install.yaml
|
||||
gear_git_dest: "{{ ansible_user_dir }}/src/git.openstack.org/openstack-infra/gear"
|
||||
gear_git_uri: https://git.openstack.org/openstack-infra/gear
|
||||
|
@ -53,3 +53,13 @@
|
||||
owner: "{{ gear_file_ssl_key_owner }}"
|
||||
src: "{{ gear_file_ssl_key_src }}"
|
||||
register: gear_file_ssl_key
|
||||
|
||||
- name: Install gear logging configuration.
|
||||
become: yes
|
||||
template:
|
||||
dest: "{{ gear_file_log_config_dest }}"
|
||||
group: "{{ gear_file_log_config_group }}"
|
||||
mode: "{{ gear_file_log_config_mode }}"
|
||||
owner: "{{ gear_file_log_config_owner }}"
|
||||
src: "{{ gear_file_log_config_src }}"
|
||||
register: gear_file_log_config
|
||||
|
39
templates/etc/gear/logging.conf
Normal file
39
templates/etc/gear/logging.conf
Normal file
@ -0,0 +1,39 @@
|
||||
[loggers]
|
||||
keys=root,gear
|
||||
|
||||
[handlers]
|
||||
keys=console,debug,normal
|
||||
|
||||
[formatters]
|
||||
keys=simple
|
||||
|
||||
[logger_root]
|
||||
level=WARNING
|
||||
handlers=console
|
||||
|
||||
[logger_gear]
|
||||
level=DEBUG
|
||||
handlers=debug,normal
|
||||
qualname=gear
|
||||
|
||||
[handler_console]
|
||||
level=WARNING
|
||||
class=StreamHandler
|
||||
formatter=simple
|
||||
args=(sys.stdout,)
|
||||
|
||||
[handler_debug]
|
||||
level=DEBUG
|
||||
class=logging.handlers.WatchedFileHandler
|
||||
formatter=simple
|
||||
args=('/var/log/gear/debug.log',)
|
||||
|
||||
[handler_normal]
|
||||
level=WARNING
|
||||
class=logging.handlers.WatchedFileHandler
|
||||
formatter=simple
|
||||
args=('/var/log/gear/gear.log',)
|
||||
|
||||
[formatter_simple]
|
||||
format=%(asctime)s %(levelname)s %(name)s: %(message)s
|
||||
datefmt=
|
@ -7,6 +7,8 @@ Type=simple
|
||||
# The prefix used when gear was installed. Be sure to update this
|
||||
# value if you are using a virtualenv.
|
||||
Environment="PREFIX=/usr/local"
|
||||
# Options to pass to gear.
|
||||
Environment="ARGS=--log-config /etc/gear/logging.conf"
|
||||
Group=gear
|
||||
User=gear
|
||||
ExecStart=/bin/sh -c "${PREFIX}/bin/geard -d ${ARGS}"
|
||||
|
10
tests/collect-logs.yaml
Normal file
10
tests/collect-logs.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
- hosts: all
|
||||
tasks:
|
||||
- name: Collect gear log files
|
||||
synchronize:
|
||||
dest: "{{ zuul.executor.log_root }}/logs"
|
||||
mode: pull
|
||||
rsync_opts:
|
||||
- "--relative"
|
||||
src: /var/log/gear
|
||||
verify_host: true
|
@ -23,6 +23,7 @@
|
||||
- name: Assert results are registered.
|
||||
assert:
|
||||
that:
|
||||
- gear_file_log_config
|
||||
- gear_file_ssl_ca
|
||||
- gear_file_ssl_cert
|
||||
- gear_file_ssl_key
|
||||
@ -110,3 +111,17 @@
|
||||
- _gear_file_ssl_key_stat.stat.pw_name == 'gear'
|
||||
- _gear_file_ssl_key_stat.stat.gr_name == 'gear'
|
||||
- _gear_file_ssl_key_stat.stat.mode == '0600'
|
||||
|
||||
- name: Register /etc/gear/logging.conf
|
||||
stat:
|
||||
path: /etc/gear/logging.conf
|
||||
register: _gear_file_log_config_stat
|
||||
|
||||
- name: Assert _gear_file_log_config_stat tests.
|
||||
assert:
|
||||
that:
|
||||
- _gear_file_log_config_stat.stat.exists
|
||||
- _gear_file_log_config_stat.stat.isreg
|
||||
- _gear_file_log_config_stat.stat.pw_name == 'gear'
|
||||
- _gear_file_log_config_stat.stat.gr_name == 'gear'
|
||||
- _gear_file_log_config_stat.stat.mode == '0644'
|
||||
|
Loading…
Reference in New Issue
Block a user