From b11321cedcfca8c394eefffae9589eba9b470fa2 Mon Sep 17 00:00:00 2001 From: "xiabing.yao" Date: Thu, 6 Aug 2015 17:32:56 +0800 Subject: [PATCH] update config-external.sh in galera,keystone,rabbitmq,swift Use variables like SOURCE,TARGET in config-external.sh, so it will easy to modify in future. Closes-Bug: #1485710 Change-Id: I3880a2cbca8a80d36e84a797fcfb943e43b88bd5 --- docker/common/galera/config-external.sh | 11 ++++++---- docker/common/keystone/config-external.sh | 21 ++++++++++++------- docker/common/rabbitmq/config-external.sh | 21 ++++++++++++------- .../swift-account-server/config-external.sh | 21 ++++++++++++------- .../swift-container-server/config-external.sh | 21 ++++++++++++------- .../swift-object-auditor/config-external.sh | 21 ++++++++++++------- .../swift-object-expirer/config-external.sh | 21 ++++++++++++------- .../config-external.sh | 21 ++++++++++++------- .../swift-object-server/config-external.sh | 21 ++++++++++++------- .../swift-object-updater/config-external.sh | 21 ++++++++++++------- 10 files changed, 124 insertions(+), 76 deletions(-) diff --git a/docker/common/galera/config-external.sh b/docker/common/galera/config-external.sh index a90f7fe6f3..43447a51ca 100644 --- a/docker/common/galera/config-external.sh +++ b/docker/common/galera/config-external.sh @@ -1,8 +1,11 @@ #!/bin/bash +SOURCE="/opt/kolla/mariadb/galera.cnf" +TARGET="/etc/my.cnf.d/galera.cnf" +OWNER="mysql" # Cluster configuration -if [[ -f /opt/kolla/mariadb/galera.cnf ]]; then - cp /opt/kolla/mariadb/galera.cnf /etc/my.cnf.d/galera.cnf - chown mysql: /etc/my.cnf.d/galera.cnf - chmod 0600 /etc/my.cnf.d/galera.cnf +if [[ -f "$SOURCE" ]]; then + cp $SOURCE $TARGET + chown ${OWNER}: $TARGET + chmod 0600 $TARGET fi diff --git a/docker/common/keystone/config-external.sh b/docker/common/keystone/config-external.sh index 54df0f3a1e..9742e3b127 100644 --- a/docker/common/keystone/config-external.sh +++ b/docker/common/keystone/config-external.sh @@ -1,13 +1,18 @@ #!/bin/bash +SOURCE="/opt/kolla/keystone/keystone.conf" +TARGET="/etc/keystone/keystone.conf" +SOURCE_WSGI="/opt/kolla/keystone/wsgi-keystone.conf" +TARGET_WSGI="/etc/httpd/conf.d/wsgi-keystone.conf" +OWNER="keystone" -if [[ -f /opt/kolla/keystone/wsgi-keystone.conf ]]; then - cp /opt/kolla/keystone/wsgi-keystone.conf /etc/httpd/conf.d/ - chown root:keystone /etc/httpd/conf.d/wsgi-keystone.conf - chmod 0644 /etc/httpd/conf.d/wsgi-keystone.conf +if [[ -f "$SOURCE" ]]; then + cp $SOURCE $TARGET + chown ${OWNER}: $TARGET + chmod 0644 $TARGET fi -if [[ -f /opt/kolla/keystone/keystone.conf ]]; then - cp /opt/kolla/keystone/keystone.conf /etc/keystone/keystone.conf - chown keystone: /etc/keystone/keystone.conf - chmod 0644 /etc/keystone/keystone.conf +if [[ -f "$SOURCE_WSGI" ]]; then + cp $SOURCE_WSGI $TARGET_WSGI + chown ${OWNER}: $TARGET_WSGI + chmod 0644 $TARGET_WSGI fi diff --git a/docker/common/rabbitmq/config-external.sh b/docker/common/rabbitmq/config-external.sh index 40abd61569..33810d621d 100644 --- a/docker/common/rabbitmq/config-external.sh +++ b/docker/common/rabbitmq/config-external.sh @@ -1,14 +1,19 @@ #!/bin/bash +SOURCE_CONFIG="/opt/kolla/rabbitmq/rabbitmq.config" +TARGET_CONFIG="/etc/rabbitmq/rabbitmq.config" +SOURCE_ENV="/opt/kolla/rabbitmq/rabbitmq-env.conf" +TARGET_ENV="/etc/rabbitmq/rabbitmq-env.conf" +OWNER="rabbitmq" # Cluster configuration -if [[ -f /opt/kolla/rabbitmq/rabbitmq.config ]]; then - cp -af /opt/kolla/rabbitmq/rabbitmq.config /etc/rabbitmq/rabbitmq.config - chown rabbitmq: /etc/rabbitmq/rabbitmq.config - chmod 0600 /etc/rabbitmq/rabbitmq.config +if [[ -f "$SOURCE_CONFIG" ]]; then + cp -af $SOURCE_CONFIG $TARGET_CONFIG + chown ${OWNER}: $TARGET_CONFIG + chmod 0600 $TARGET_CONFIG fi -if [[ -f /opt/kolla/rabbitmq/rabbitmq-env.conf ]]; then - cp -af /opt/kolla/rabbitmq/rabbitmq-env.conf /etc/rabbitmq/rabbitmq-env.conf - chown rabbitmq: /etc/rabbitmq/rabbitmq-env.conf - chmod 0600 /etc/rabbitmq/rabbitmq-env.conf +if [[ -f "$SOURCE_ENV" ]]; then + cp -af $SOURCE_ENV $TARGET_ENV + chown ${OWNER}: $TARGET_ENV + chmod 0600 $TARGET_ENV fi diff --git a/docker/common/swift/swift-account-server/config-external.sh b/docker/common/swift/swift-account-server/config-external.sh index fe20dcb92c..613fd30f08 100644 --- a/docker/common/swift/swift-account-server/config-external.sh +++ b/docker/common/swift/swift-account-server/config-external.sh @@ -1,13 +1,18 @@ #!/bin/bash +SOURCE="/opt/kolla/swift/swift.conf" +TARGET="/etc/swift/swift.conf" +SOURCE_ACCOUNT_SERVER="/opt/kolla/swift/account-server.conf" +TARGET_ACCOUNT_SERVER="/etc/swift/account-server.conf" +OWNER="swift" -if [[ -f /opt/kolla/swift/swift.conf ]]; then - cp /opt/kolla/swift/swift.conf /etc/swift/ - chown swift: /etc/swift/swift.conf - chmod 0640 /etc/swift/swift.conf +if [[ -f "$SOURCE" ]]; then + cp $SOURCE $TARGET + chown ${OWNER}: $TARGET + chmod 0640 $TARGET fi -if [[ -f /opt/kolla/swift/account-server.conf ]]; then - cp /opt/kolla/swift/account-server.conf /etc/swift/ - chown swift: /etc/swift/account-server.conf - chmod 0640 /etc/swift/account-server.conf +if [[ -f "$SOURCE_ACCOUNT_SERVER" ]]; then + cp $SOURCE_ACCOUNT_SERVER $TARGET_ACCOUNT_SERVER + chown ${OWNER}: $TARGET_ACCOUNT_SERVER + chmod 0640 $TARGET_ACCOUNT_SERVER fi diff --git a/docker/common/swift/swift-container-server/config-external.sh b/docker/common/swift/swift-container-server/config-external.sh index 6f4186e0f5..93f696349a 100644 --- a/docker/common/swift/swift-container-server/config-external.sh +++ b/docker/common/swift/swift-container-server/config-external.sh @@ -1,13 +1,18 @@ #!/bin/bash +SOURCE="/opt/kolla/swift/swift.conf" +TARGET="/etc/swift/swift.conf" +SOURCE_CONTAINER_SERVER="/opt/kolla/swift/container-server.conf" +TARGET_CONTAINER_SERVER="/etc/swift/container-server.conf" +OWNER="swift" -if [[ -f /opt/kolla/swift/swift.conf ]]; then - cp /opt/kolla/swift/swift.conf /etc/swift/ - chown swift: /etc/swift/swift.conf - chmod 0640 /etc/swift/swift.conf +if [[ -f "$SOURCE" ]]; then + cp $SOURCE $TARGET + chown ${OWNER}: $TARGET + chmod 0640 $TARGET fi -if [[ -f /opt/kolla/swift/container-server.conf ]]; then - cp /opt/kolla/swift/container-server.conf /etc/swift/ - chown swift: /etc/swift/container-server.conf - chmod 0640 /etc/swift/container-server.conf +if [[ -f "$SOURCE_CONTAINER_SERVER" ]]; then + cp $SOURCE_CONTAINER_SERVER $TARGET_CONTAINER_SERVER + chown ${OWNER}: $TARGET_CONTAINER_SERVER + chmod 0640 $TARGET_CONTAINER_SERVER fi diff --git a/docker/common/swift/swift-object-auditor/config-external.sh b/docker/common/swift/swift-object-auditor/config-external.sh index f066895326..0fa02e9855 100644 --- a/docker/common/swift/swift-object-auditor/config-external.sh +++ b/docker/common/swift/swift-object-auditor/config-external.sh @@ -1,13 +1,18 @@ #!/bin/bash +SOURCE="/opt/kolla/swift/swift.conf" +TARGET="/etc/swift/swift.conf" +SOURCE_OBJECT_SERVER="/opt/kolla/swift/object-server.conf" +TARGET_OBJECT_SERVER="/etc/swift/object-server.conf" +OWNER="swift" -if [[ -f /opt/kolla/swift/swift.conf ]]; then - cp /opt/kolla/swift/swift.conf /etc/swift/ - chown swift: /etc/swift/swift.conf - chmod 0640 /etc/swift/swift.conf +if [[ -f "$SOURCE" ]]; then + cp $SOURCE $TARGET + chown ${OWNER}: $TARGET + chmod 0640 $TARGET fi -if [[ -f /opt/kolla/swift/object-server.conf ]]; then - cp /opt/kolla/swift/object-server.conf /etc/swift/ - chown swift: /opt/kolla/swift/object-server.conf - chmod 0640 /etc/swift/object-server.conf +if [[ -f "$SOURCE_OBJECT_SERVER" ]]; then + cp $SOURCE_OBJECT_SERVER $TARGET_OBJECT_SERVER + chown ${OWNER}: $TARGET_OBJECT_SERVER + chmod 0640 $TARGET_OBJECT_SERVER fi diff --git a/docker/common/swift/swift-object-expirer/config-external.sh b/docker/common/swift/swift-object-expirer/config-external.sh index ca4b35499c..ff2bcf9f5f 100644 --- a/docker/common/swift/swift-object-expirer/config-external.sh +++ b/docker/common/swift/swift-object-expirer/config-external.sh @@ -1,13 +1,18 @@ #!/bin/bash +SOURCE="/opt/kolla/swift/swift.conf" +TARGET="/etc/swift/swift.conf" +SOURCE_OBJECT_EXPIRER="/opt/kolla/swift/object-expirer.conf" +TARGET_OBJECT_EXPIRER="/etc/swift/object-expirer.conf" +OWNER="swift" -if [[ -f /opt/kolla/swift/swift.conf ]]; then - cp /opt/kolla/swift/swift.conf /etc/swift/ - chown swift: /opt/kolla/swift/swift.conf - chmod 0640 /etc/swift/swift.conf +if [[ -f "$SOURCE" ]]; then + cp $SOURCE $TARGET + chown ${OWNER}: $TARGET + chmod 0640 $TARGET fi -if [[ -f /opt/kolla/swift/object-expirer.conf ]]; then - cp /opt/kolla/swift/object-expirer.conf /etc/swift/ - chown swift: /opt/kolla/swift/object-expirer.conf - chmod 0640 /etc/swift/object-expirer.conf +if [[ -f "$SOURCE_OBJECT_EXPIRER" ]]; then + cp $SOURCE_OBJECT_EXPIRER $TARGET_OBJECT_EXPIRER + chown ${OWNER}: $TARGET_OBJECT_EXPIRER + chmod 0640 $TARGET_OBJECT_EXPIRER fi diff --git a/docker/common/swift/swift-object-replicator/config-external.sh b/docker/common/swift/swift-object-replicator/config-external.sh index fdf92592c8..0fa02e9855 100644 --- a/docker/common/swift/swift-object-replicator/config-external.sh +++ b/docker/common/swift/swift-object-replicator/config-external.sh @@ -1,13 +1,18 @@ #!/bin/bash +SOURCE="/opt/kolla/swift/swift.conf" +TARGET="/etc/swift/swift.conf" +SOURCE_OBJECT_SERVER="/opt/kolla/swift/object-server.conf" +TARGET_OBJECT_SERVER="/etc/swift/object-server.conf" +OWNER="swift" -if [[ -f /opt/kolla/swift/swift.conf ]]; then - cp /opt/kolla/swift/swift.conf /etc/swift/ - chown swift: /opt/kolla/swift/swift.conf - chmod 0640 /etc/swift/swift.conf +if [[ -f "$SOURCE" ]]; then + cp $SOURCE $TARGET + chown ${OWNER}: $TARGET + chmod 0640 $TARGET fi -if [[ -f /opt/kolla/swift/object-server.conf ]]; then - cp /opt/kolla/swift/object-server.conf /etc/swift/ - chown swift: /opt/kolla/swift/object-server.conf - chmod 0640 /etc/swift/object-server.conf +if [[ -f "$SOURCE_OBJECT_SERVER" ]]; then + cp $SOURCE_OBJECT_SERVER $TARGET_OBJECT_SERVER + chown ${OWNER}: $TARGET_OBJECT_SERVER + chmod 0640 $TARGET_OBJECT_SERVER fi diff --git a/docker/common/swift/swift-object-server/config-external.sh b/docker/common/swift/swift-object-server/config-external.sh index fdf92592c8..0fa02e9855 100644 --- a/docker/common/swift/swift-object-server/config-external.sh +++ b/docker/common/swift/swift-object-server/config-external.sh @@ -1,13 +1,18 @@ #!/bin/bash +SOURCE="/opt/kolla/swift/swift.conf" +TARGET="/etc/swift/swift.conf" +SOURCE_OBJECT_SERVER="/opt/kolla/swift/object-server.conf" +TARGET_OBJECT_SERVER="/etc/swift/object-server.conf" +OWNER="swift" -if [[ -f /opt/kolla/swift/swift.conf ]]; then - cp /opt/kolla/swift/swift.conf /etc/swift/ - chown swift: /opt/kolla/swift/swift.conf - chmod 0640 /etc/swift/swift.conf +if [[ -f "$SOURCE" ]]; then + cp $SOURCE $TARGET + chown ${OWNER}: $TARGET + chmod 0640 $TARGET fi -if [[ -f /opt/kolla/swift/object-server.conf ]]; then - cp /opt/kolla/swift/object-server.conf /etc/swift/ - chown swift: /opt/kolla/swift/object-server.conf - chmod 0640 /etc/swift/object-server.conf +if [[ -f "$SOURCE_OBJECT_SERVER" ]]; then + cp $SOURCE_OBJECT_SERVER $TARGET_OBJECT_SERVER + chown ${OWNER}: $TARGET_OBJECT_SERVER + chmod 0640 $TARGET_OBJECT_SERVER fi diff --git a/docker/common/swift/swift-object-updater/config-external.sh b/docker/common/swift/swift-object-updater/config-external.sh index ebd1ad9a9d..0fa02e9855 100644 --- a/docker/common/swift/swift-object-updater/config-external.sh +++ b/docker/common/swift/swift-object-updater/config-external.sh @@ -1,13 +1,18 @@ #!/bin/bash +SOURCE="/opt/kolla/swift/swift.conf" +TARGET="/etc/swift/swift.conf" +SOURCE_OBJECT_SERVER="/opt/kolla/swift/object-server.conf" +TARGET_OBJECT_SERVER="/etc/swift/object-server.conf" +OWNER="swift" -if [[ -f /opt/kolla/swift/swift.conf ]]; then - cp /opt/kolla/swift/swift.conf /etc/swift/ - chown swift: /etc/swift/swift.conf - chmod 0640 /etc/swift/swift.conf +if [[ -f "$SOURCE" ]]; then + cp $SOURCE $TARGET + chown ${OWNER}: $TARGET + chmod 0640 $TARGET fi -if [[ -f /opt/kolla/swift/object-server.conf ]]; then - cp /opt/kolla/swift/object-server.conf /etc/swift/ - chown swift: /etc/swift/object-server.conf - chmod 0640 /etc/swift/object-server.conf +if [[ -f "$SOURCE_OBJECT_SERVER" ]]; then + cp $SOURCE_OBJECT_SERVER $TARGET_OBJECT_SERVER + chown ${OWNER}: $TARGET_OBJECT_SERVER + chmod 0640 $TARGET_OBJECT_SERVER fi