From 9ed49df4b40486514ae4e0b6ad0b1f4c1d5f8aea Mon Sep 17 00:00:00 2001 From: zhubingbing <1392607554@qq.com> Date: Sat, 8 Oct 2016 02:26:47 +0000 Subject: [PATCH] fix collectd dockerfile * remove sudoers file * change extend_start.sh Closes-Bug: #1628806 Change-Id: I80d3d3a677c735892e7be544e26ce001bb73c2cd --- docker/collectd/Dockerfile.j2 | 3 --- docker/collectd/collectd_sudoers | 1 - docker/collectd/extend_start.sh | 8 +++++--- 3 files changed, 5 insertions(+), 7 deletions(-) delete mode 100644 docker/collectd/collectd_sudoers diff --git a/docker/collectd/Dockerfile.j2 b/docker/collectd/Dockerfile.j2 index 532321f9a5..ded2fa271d 100644 --- a/docker/collectd/Dockerfile.j2 +++ b/docker/collectd/Dockerfile.j2 @@ -8,13 +8,10 @@ MAINTAINER {{ maintainer }} ] %} {{ macros.install_packages(collectd_packages | customizable("packages")) }} -COPY collectd_sudoers /etc/sudoers.d/kolla_collectd_sudoers COPY extend_start.sh /usr/local/bin/kolla_extend_start RUN useradd -r -m collectd \ && chmod 755 /usr/local/bin/kolla_extend_start \ - && chmod 750 /etc/sudoers.d \ - && chmod 440 /etc/sudoers.d/kolla_collectd_sudoers \ && usermod -a -G kolla collectd \ && chown -R collectd /var/lib/collectd \ && chown -R collectd /etc/collectd* \ diff --git a/docker/collectd/collectd_sudoers b/docker/collectd/collectd_sudoers deleted file mode 100644 index fae410a997..0000000000 --- a/docker/collectd/collectd_sudoers +++ /dev/null @@ -1 +0,0 @@ -%kolla ALL=(root) NOPASSWD: /bin/chown collectd\: /var/lib/collectd/, /usr/bin/chown collectd\: /var/lib/collectd/ diff --git a/docker/collectd/extend_start.sh b/docker/collectd/extend_start.sh index 92ff4a5ea3..80ef63db34 100644 --- a/docker/collectd/extend_start.sh +++ b/docker/collectd/extend_start.sh @@ -1,6 +1,8 @@ #!/bin/bash -# Only update permissions if permissions need to be updated -if [[ $(stat -c %U:%G /var/lib/collectd) != "collectd:collectd" ]]; then - sudo chown collectd: /var/lib/collectd +if [[ ! -d "/var/log/kolla/collectd" ]]; then + mkdir -p /var/log/kolla/collectd +fi +if [[ $(stat -c %a /var/log/kolla/collectd) != "755" ]]; then + chmod 755 /var/log/kolla/collectd fi