From e6571c02039ec628a6511ec932fc371711ef20dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Andr=C3=A9?= Date: Tue, 9 Feb 2016 14:07:53 +0900 Subject: [PATCH] Safely create directories This prevents failure when the directory already exists. This commit fixes a failure in centos-binary because of a change in the RDO packaging, where the required directory is now created for us. Change-Id: Idd3e15802c3e3fd363e1295111ec12948d566781 Closes-Bug: #1543417 --- docker/dind/start.sh | 2 +- docker/nova/nova-compute/extend_start.sh | 6 +++++- docker/openstack-base/Dockerfile.j2 | 2 +- docker/swift/swift-base/Dockerfile.j2 | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docker/dind/start.sh b/docker/dind/start.sh index 56e7334095..8d861f7441 100644 --- a/docker/dind/start.sh +++ b/docker/dind/start.sh @@ -11,7 +11,7 @@ done docker daemon -s btrfs 2>&1 > docker.log & docker_pid=$! -mkdir /var/run/sshd +mkdir -p /var/run/sshd /usr/sbin/sshd -D 2>&1 > sshd.log & sshd_pid=$! diff --git a/docker/nova/nova-compute/extend_start.sh b/docker/nova/nova-compute/extend_start.sh index 084e76a192..efe531ff95 100644 --- a/docker/nova/nova-compute/extend_start.sh +++ b/docker/nova/nova-compute/extend_start.sh @@ -4,6 +4,10 @@ # of the KOLLA_BOOTSTRAP variable being set, including empty. if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then sudo chown nova: /var/lib/nova/ - mkdir /var/lib/nova/instances + mkdir -p /var/lib/nova/instances + # Only update permissions if permissions need to be updated + if [[ $(stat -c %U:%G /var/lib/nova/instances) != "nova:nova" ]]; then + sudo chown nova: /var/lib/nova/instances + fi exit 0 fi diff --git a/docker/openstack-base/Dockerfile.j2 b/docker/openstack-base/Dockerfile.j2 index 870dd0bb8f..f404b3ccc0 100644 --- a/docker/openstack-base/Dockerfile.j2 +++ b/docker/openstack-base/Dockerfile.j2 @@ -106,7 +106,7 @@ RUN apt-get install -y --no-install-recommends \ ADD openstack-base-archive /openstack-base-source RUN ln -s openstack-base-source/* /requirements \ - && mkdir /var/lib/kolla \ + && mkdir -p /var/lib/kolla \ && curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \ && python get-pip.py \ && rm get-pip.py \ diff --git a/docker/swift/swift-base/Dockerfile.j2 b/docker/swift/swift-base/Dockerfile.j2 index 880050cfb0..4bcf510149 100644 --- a/docker/swift/swift-base/Dockerfile.j2 +++ b/docker/swift/swift-base/Dockerfile.j2 @@ -34,4 +34,4 @@ RUN ln -s swift-base-source/* swift \ {% endif %} COPY build-swift-ring.py /usr/local/bin/kolla_build_swift_ring -RUN mkdir /opt/swift +RUN mkdir -p /opt/swift