Skip to content

Commit

Permalink
Fix Swift log directory ownership
Browse files Browse the repository at this point in the history
This PR sets the ownership for the swift log directories to the syslog
user instead of the swift user. Since swift uses syslog, no logs were
being created/logged to before this change.

This is a backport of https://review.openstack.org/#/c/287337/ and
https://review.openstack.org/#/c/289089/

Change-Id: I44768d4cd04108a7163169dfec2f0de774a2cf83
  • Loading branch information
andymcc authored and Steve Lewis committed Mar 7, 2016
1 parent 745b56f commit 97741c7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions playbooks/roles/os_swift/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ swift_system_group_name: swift
swift_system_shell: /bin/bash
swift_system_comment: swift system user
swift_system_home_folder: "/var/lib/{{ swift_system_user_name }}"
## Swift Syslog User / Group
swift_syslog_user_name: syslog
swift_syslog_group_name: syslog

## Auth token
swift_delay_auth_decision: true
Expand Down
12 changes: 6 additions & 6 deletions playbooks/roles/os_swift/tasks/swift_pre_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
- { path: "/etc/swift/proxy-server" }
- { path: "/etc/swift/scripts" }
- { path: "/etc/swift/ring_build_files" }
- { path: "/openstack/log/{{ inventory_hostname }}", owner: "syslog", group: "syslog" }
- { path: "/openstack/log/{{ inventory_hostname }}", owner: "{{ swift_syslog_user_name }}", group: "{{ swift_syslog_group_name }}" }
- { path: "/var/cache/swift" }
- { path: "{{ swift_system_home_folder }}" }
tags:
Expand All @@ -87,8 +87,8 @@
- name: Test for log directory or link
shell: |
if [ -h "/var/log/swift" ]; then
chown -h {{ swift_system_user_name }}:{{ swift_system_group_name }} "/var/log/swift"
chown -R {{ swift_system_user_name }}:{{ swift_system_group_name }} "$(readlink /var/log/swift)"
chown -h {{ swift_syslog_user_name }}:{{ swift_syslog_group_name }} "/var/log/swift"
chown -R {{ swift_syslog_user_name }}:{{ swift_syslog_group_name }} "$(readlink /var/log/swift)"
else
exit 1
fi
Expand All @@ -103,11 +103,11 @@
file:
path: "{{ item.path }}"
state: directory
owner: "{{ item.owner|default(swift_system_user_name) }}"
group: "{{ item.group|default(swift_system_group_name) }}"
owner: "{{ swift_syslog_user_name }}"
group: "{{ swift_syslog_group_name }}"
mode: "{{ item.mode|default('0755') }}"
with_items:
- { path: "/var/log/swift", owner: "syslog", group: "syslog" }
- { path: "/var/log/swift" }
when: log_dir.rc != 0
tags:
- swift-dirs
Expand Down

0 comments on commit 97741c7

Please sign in to comment.