fix collectd dockerfile

* remove sudoers file
* change extend_start.sh

Closes-Bug: #1628806

Change-Id: I80d3d3a677c735892e7be544e26ce001bb73c2cd
This commit is contained in:
zhubingbing 2016-10-08 02:26:47 +00:00
parent b8da31d448
commit 9ed49df4b4
3 changed files with 5 additions and 7 deletions

View File

@ -8,13 +8,10 @@ MAINTAINER {{ maintainer }}
] %} ] %}
{{ macros.install_packages(collectd_packages | customizable("packages")) }} {{ 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 COPY extend_start.sh /usr/local/bin/kolla_extend_start
RUN useradd -r -m collectd \ RUN useradd -r -m collectd \
&& chmod 755 /usr/local/bin/kolla_extend_start \ && 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 \ && usermod -a -G kolla collectd \
&& chown -R collectd /var/lib/collectd \ && chown -R collectd /var/lib/collectd \
&& chown -R collectd /etc/collectd* \ && chown -R collectd /etc/collectd* \

View File

@ -1 +0,0 @@
%kolla ALL=(root) NOPASSWD: /bin/chown collectd\: /var/lib/collectd/, /usr/bin/chown collectd\: /var/lib/collectd/

View File

@ -1,6 +1,8 @@
#!/bin/bash #!/bin/bash
# Only update permissions if permissions need to be updated if [[ ! -d "/var/log/kolla/collectd" ]]; then
if [[ $(stat -c %U:%G /var/lib/collectd) != "collectd:collectd" ]]; then mkdir -p /var/log/kolla/collectd
sudo chown collectd: /var/lib/collectd fi
if [[ $(stat -c %a /var/log/kolla/collectd) != "755" ]]; then
chmod 755 /var/log/kolla/collectd
fi fi