From 91ca8d4b00c632bcf7a2a9903aa4cf584fee27e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Andr=C3=A9?= Date: Mon, 1 Dec 2014 14:50:58 +0900 Subject: [PATCH] Cleanup required variables checks for all containers This allows Kubernetes to reschedule containers in case a required variable is missing, for example when the Kubernetes pod is started before the service. The checks were cleaned using the following method: * remove duplicates * remove check for variables that get a default value in the same file * check for all variables used in the file * check for required services when it is obvious. Change-Id: Ib7e0530c410c61f828d36efe8925a20dc9781eab --- docker/barbican/start.sh | 15 +++++-------- docker/ceilometer/ceilometer-api/start.sh | 7 +++++- .../ceilometer-base/config-ceilometer.sh | 6 +++-- docker/ceilometer/ceilometer-central/start.sh | 4 ++-- docker/ceilometer/ceilometer-compute/start.sh | 4 ++-- docker/cinder/start.sh | 22 ++++++------------- docker/glance/glance-base/config-glance.sh | 4 +++- docker/heat/heat-base/config-heat.sh | 5 ++++- docker/heat/heat-engine/start.sh | 3 +-- docker/horizon/start.sh | 2 -- docker/keystone/start.sh | 3 ++- docker/neutron/agents/dhcp/start.sh | 2 ++ docker/neutron/agents/l3/start.sh | 2 ++ docker/neutron/agents/linux-bridge/start.sh | 2 ++ docker/neutron/agents/metadata/start.sh | 5 +++++ docker/neutron/neutron-base/config-neutron.sh | 4 +++- docker/neutron/neutron-server/start.sh | 4 +++- docker/nova-base/config-nova.sh | 7 ++++-- docker/nova-controller/nova-api/start.sh | 4 ++++ .../nova-controller/nova-conductor/start.sh | 1 + docker/swift/swift-account/start.sh | 17 +++++--------- docker/swift/swift-container/start.sh | 17 +++++--------- docker/swift/swift-object/start.sh | 17 +++++--------- docker/zaqar/start.sh | 10 +++------ 24 files changed, 84 insertions(+), 83 deletions(-) diff --git a/docker/barbican/start.sh b/docker/barbican/start.sh index 676374faa0..c90f66c470 100755 --- a/docker/barbican/start.sh +++ b/docker/barbican/start.sh @@ -8,21 +8,16 @@ set -e : ${BARBICAN_KEYSTONE_USER:=barbican} : ${ADMIN_TENANT_NAME:=admin} -if ! [ "$KEYSTONE_ADMIN_TOKEN" ]; then - echo "*** Missing KEYSTONE_ADMIN_TOKEN" >&2 - exit 1 -fi - -if ! [ "$DB_ROOT_PASSWORD" ]; then - echo "*** Missing DB_ROOT_PASSWORD" >&2 - exit 1 -fi - if ! [ "$BARBICAN_DB_PASSWORD" ]; then BARBICAN_DB_PASSWORD=$(openssl rand -hex 15) export BARBICAN_DB_PASSWORD fi +check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ + KEYSTONE_ADMIN_SERVICE_PORT BARBICAN_ADMIN_PASSWORD +check_for_db +check_for_keystone + mysql -h ${MARIADB_SERVICE_HOST} -u root -p"${DB_ROOT_PASSWORD}" mysql < /openrc <&2 - exit 1 -fi - -if ! [ "$DB_ROOT_PASSWORD" ]; then - echo "*** Missing DB_ROOT_PASSWORD" >&2 - exit 1 -fi - if ! [ "$CINDER_DB_PASSWORD" ]; then CINDER_DB_PASSWORD=$(openssl rand -hex 15) export CINDER_DB_PASSWORD fi -mysql -h ${MARIADB_PORT_3306_TCP_ADDR} -u root \ - -p${DB_ROOT_PASSWORD} mysql < /openrc < /openrc < /openrc <&2 - exit 1 -fi - -if ! [ "$DB_ROOT_PASSWORD" ]; then - echo "*** Missing DB_ROOT_PASSWORD" >&2 - exit 1 -fi +check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ + SWIFT_ADMIN_PASSWORD +check_for_db +check_for_keystone if ! [ "$SWIFT_DB_PASSWORD" ]; then SWIFT_DB_PASSWORD=$(openssl rand -hex 15) @@ -23,7 +18,7 @@ fi sh /opt/swift/config-swift.sh account-server -mysql -h ${MARIADB_PORT_3306_TCP_ADDR} -u root \ +mysql -h ${MARIADB_SERVICE_HOST} -u root \ -p${DB_ROOT_PASSWORD} mysql <&2 - exit 1 -fi - -if ! [ "$DB_ROOT_PASSWORD" ]; then - echo "*** Missing DB_ROOT_PASSWORD" >&2 - exit 1 -fi +check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ + SWIFT_ADMIN_PASSWORD +check_for_db +check_for_keystone if ! [ "$SWIFT_DB_PASSWORD" ]; then SWIFT_DB_PASSWORD=$(openssl rand -hex 15) @@ -23,7 +18,7 @@ fi sh /opt/swift/config-swift.sh container -mysql -h ${MARIADB_PORT_3306_TCP_ADDR} -u root \ +mysql -h ${MARIADB_SERVICE_HOST} -u root \ -p${DB_ROOT_PASSWORD} mysql <&2 - exit 1 -fi - -if ! [ "$DB_ROOT_PASSWORD" ]; then - echo "*** Missing DB_ROOT_PASSWORD" >&2 - exit 1 -fi +check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ + SWIFT_ADMIN_PASSWORD +check_for_db +check_for_keystone if ! [ "$SWIFT_DB_PASSWORD" ]; then SWIFT_DB_PASSWORD=$(openssl rand -hex 15) @@ -23,7 +18,7 @@ fi sh /opt/swift/config-swift.sh engine -mysql -h ${MARIADB_PORT_3306_TCP_ADDR} -u root \ +mysql -h ${MARIADB_SERVICE_HOST} -u root \ -p${DB_ROOT_PASSWORD} mysql <