diff --git a/docker/ceilometer/ceilometer-api/Dockerfile.j2 b/docker/ceilometer/ceilometer-api/Dockerfile.j2 index 6682261099..f3695a2b80 100644 --- a/docker/ceilometer/ceilometer-api/Dockerfile.j2 +++ b/docker/ceilometer/ceilometer-api/Dockerfile.j2 @@ -17,8 +17,8 @@ RUN apt-get install -y --no-install-recommends \ {% endif %} {% endif %} -COPY extend_start.sh /usr/local/bin/kolla_extend_start -RUN chmod 755 /usr/local/bin/kolla_extend_start +COPY extend_start.sh /usr/local/bin/kolla_ceilometer_extend_start +RUN chmod 755 /usr/local/bin/kolla_ceilometer_extend_start {{ include_footer }} diff --git a/docker/ceilometer/ceilometer-api/extend_start.sh b/docker/ceilometer/ceilometer-api/extend_start.sh index 108ef33ec5..b9f026127c 100644 --- a/docker/ceilometer/ceilometer-api/extend_start.sh +++ b/docker/ceilometer/ceilometer-api/extend_start.sh @@ -4,5 +4,6 @@ # of the KOLLA_BOOTSTRAP variable being set, including empty. if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then ceilometer-manage db_sync + sudo chown -R ceilometer: /var/lib/ceilometer/ exit 0 fi diff --git a/docker/ceilometer/ceilometer-base/Dockerfile.j2 b/docker/ceilometer/ceilometer-base/Dockerfile.j2 index c5b319aee5..90ce0b3346 100644 --- a/docker/ceilometer/ceilometer-base/Dockerfile.j2 +++ b/docker/ceilometer/ceilometer-base/Dockerfile.j2 @@ -29,6 +29,14 @@ RUN ln -s ceilometer-base-source/* ceilometer \ && chown -R ceilometer: /etc/ceilometer /var/log/ceilometer /home/ceilometer \ && sed -i 's|^exec_dirs.*|exec_dirs=/var/lib/kolla/venv/bin,/sbin,/usr/sbin,/bin,/usr/bin,/usr/local/bin,/usr/local/sbin|g' /etc/ceilometer/rootwrap.conf +COPY ceilometer_sudoers /etc/sudoers.d/ceilometer_sudoers +COPY extend_start.sh /usr/local/bin/kolla_extend_start + +RUN chmod 750 /etc/sudoers.d \ + && chmod 440 /etc/sudoers.d/ceilometer_sudoers \ + && touch /usr/local/bin/kolla_ceilometer_extend_start \ + && chmod 755 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_ceilometer_extend_start + {% endif %} RUN usermod -a -G kolla ceilometer diff --git a/docker/ceilometer/ceilometer-base/ceilometer_sudoers b/docker/ceilometer/ceilometer-base/ceilometer_sudoers new file mode 100644 index 0000000000..dd861bb58c --- /dev/null +++ b/docker/ceilometer/ceilometer-base/ceilometer_sudoers @@ -0,0 +1 @@ +%kolla ALL=(root) NOPASSWD: /usr/bin/chown -R ceilometer\: /var/lib/ceilometer/, /bin/chown -R ceilometer\: /var/lib/ceilometer/ diff --git a/docker/ceilometer/ceilometer-base/extend_start.sh b/docker/ceilometer/ceilometer-base/extend_start.sh new file mode 100644 index 0000000000..19521d9def --- /dev/null +++ b/docker/ceilometer/ceilometer-base/extend_start.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +if [[ ! -d "/var/log/kolla/ceilometer" ]]; then + mkdir -p /var/log/kolla/ceilometer +fi +if [[ $(stat -c %a /var/log/kolla/ceilometer) != "755" ]]; then + chmod 755 /var/log/kolla/ceilometer +fi + +source /usr/local/bin/kolla_ceilometer_extend_start