Use masakari_log_dir consistently

The variable is not used consistently. We fix every reference
to '/var/log/masakari' to refer to masakari_log_dir instead.

We also simplify the task which creates it to work whether
there is a symlink there or not.

Co-Authored-By: Dmitriy R <dmitriy.r@sitevalley.com>
Change-Id: Ibf579b6655ddee5cfc8c32ad6a500b4dc85468a8
This commit is contained in:
Jesse Pretorius 2018-07-27 15:30:35 +01:00 committed by Jesse Pretorius (odyssey4me)
parent 6b3a4e9048
commit 0f82dd312f
3 changed files with 5 additions and 26 deletions

View File

@ -33,7 +33,7 @@
- name: Create masakari dir
file:
path: "{{ item.path }}"
path: "{{ item.path | realpath }}"
state: directory
owner: "{{ item.owner|default(masakari_system_user_name) }}"
group: "{{ item.group|default(masakari_system_group_name) }}"
@ -41,29 +41,8 @@
with_items:
- { path: "/openstack", mode: "0755", owner: "root", group: "root" }
- { path: "{{ masakari_etc_dir }}", mode: "0750" }
- { path: "/var/cache/masakari" }
- { path: "{{ masakari_log_dir }}", mode: "0755" }
- { path: "{{ masakari_system_user_home }}" }
- { path: "{{ masakari_system_user_home }}/cache/api", mode: "0700" }
- { path: "{{ masakari_system_user_home }}/cache/registry" }
- { path: "{{ masakari_system_user_home }}/scrubber" }
- name: Test for log directory or link
shell: |
if [ -h "/var/log/masakari" ]; then
chown -h {{ masakari_system_user_name }}:{{ masakari_system_group_name }} "/var/log/masakari"
chown -R {{ masakari_system_user_name }}:{{ masakari_system_group_name }} "$(readlink /var/log/masakari)"
else
exit 1
fi
register: log_dir
failed_when: false
changed_when: log_dir.rc != 0
- name: Create masakari log dir
file:
path: "/var/log/masakari"
state: directory
owner: "{{ masakari_system_user_name }}"
group: "{{ masakari_system_group_name }}"
mode: "0755"
when: log_dir.rc != 0

View File

@ -11,9 +11,9 @@ User={{ masakari_system_user_name }}
Group={{ masakari_system_group_name }}
{% if item.value.program_override is defined %}
ExecStart={{ item.value.program_override }} {{ item.value.program_config_options|default('') }} {{ item.value.log_string | default('--log-file=') }}/var/log/masakari/{{ item.value.service_name }}.log
ExecStart={{ item.value.program_override }} {{ item.value.program_config_options|default('') }} {{ item.value.log_string | default('--log-file=') }}/{{ masakari_log_dir }}/{{ item.value.service_name }}.log
{% else %}
ExecStart={{ masakari_bin }}/{{ item.value.service_name }} {{ item.value.program_config_options|default('') }} --log-file=/var/log/masakari/{{ item.value.service_name }}.log
ExecStart={{ masakari_bin }}/{{ item.value.service_name }} {{ item.value.program_config_options|default('') }} --log-file={{ masakari_log_dir }}/{{ item.value.service_name }}.log
{% endif %}
# Give a reasonable amount of time for the server to start up/shut down

View File

@ -7,7 +7,7 @@ masakari_api_listen = 0.0.0.0
masakari_api_listen_port = 15868
debug = False
auth_strategy=keystone
log_dir = /var/log/masakari
log_dir = {{ masakari_log_dir }}
wait_period_after_service_update = 180
masakari_topic = ha_engine
engine_manager = masakari.engine.manager.MasakariManager