Make sure deploy_logs_local_path exists

If log_dir was not set to '/var/log/ironic/', the parent directory of
deploy_logs_local_path would not exist and you would see a:

    OSError: [Errno 13] Permission denied: '/var/log/ironic'

In the logs on a failed deployment. This change allows customization
of deploy_logs_local_path.

Change-Id: I4c4ae77b64fc12006b9193fb1c3f0d13becc367d
Story: 2006150
Task: 35649
This commit is contained in:
Will Szumski 2019-07-01 16:14:10 +01:00
parent b8f8c88bf4
commit cd559480c9
4 changed files with 16 additions and 1 deletions

View File

@ -143,6 +143,10 @@ cors_allowed_origin: "http://localhost:8000"
# not need to be modified by the user.
enable_cors_credential_support: false
# The path to the directory where the deployment logs should be stored when using
# local storage.
ironic_agent_deploy_logs_local_path: "{{ '/'.join([ironic_log_dir, 'deploy']) }}"
# Set this to true to configure dnsmasq to respond to requests from the
# hosts in your dynamic inventory.
inventory_dhcp: False

View File

@ -128,7 +128,7 @@
- name: "Generate ironic Configuration"
include: ironic_config.yml
- name: "Set permissions for {{ ironic_log_dir }} for the ironic user"
- name: "Set permissions on directory for the ironic user"
file:
path: "{{ item }}"
state: directory
@ -137,6 +137,7 @@
group: "ironic"
with_items:
- "{{ ironic_log_dir }}"
- "{{ ironic_agent_deploy_logs_local_path }}"
- name: "Create ironic DB Schema"
command: ironic-dbsync --config-file /etc/ironic/ironic.conf create_schema

View File

@ -35,6 +35,11 @@ auth_strategy = noauth
log_dir = {{ ironic_log_dir }}
{% endif %}
{% if ironic_agent_deploy_logs_local_path | default("") != "/var/log/ironic/deploy" %}
[agent]
deploy_logs_local_path = {{ ironic_agent_deploy_logs_local_path }}
{% endif %}
[pxe]
{% if testing | bool %}
pxe_append_params = console=/dev/ttyS0

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Fixes an issue where the deployment logs would not be saved if using a
non-default value of ironic_log_dir. See `Story 2006150 <https://storyboard.openstack.org/#!/story/2006150>`_.