diff options
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/keystone/endpoint.sh | 6 | ||||
-rwxr-xr-x | tools/keystone/fetchpass.sh | 13 | ||||
-rwxr-xr-x | tools/keystone/region.sh | 4 | ||||
-rwxr-xr-x | tools/keystone/writepass.sh | 8 |
4 files changed, 21 insertions, 10 deletions
diff --git a/tools/keystone/endpoint.sh b/tools/keystone/endpoint.sh index 410a723..b79638f 100755 --- a/tools/keystone/endpoint.sh +++ b/tools/keystone/endpoint.sh @@ -16,12 +16,16 @@ set -o pipefail # Ensure that openrc containing OpenStack environment variables is present. source openrc +# if running as part of Jenkins job, create the file in WORKSPACE +WORKSPACE=${WORKSPACE:-/root} +ENDPOINT_FILE="${WORKSPACE}/endpoints.ini" + # Endpoints. Dynamically get IP addresses from another service (keystone) ENDPOINT_PUBLIC_URL=$(openstack endpoint list | grep keystone | grep public | cut -d '|' -f 8 | cut -d '/' -f 3 | cut -d ':' -f 1) ENDPOINT_ADMIN_URL=$(openstack endpoint list | grep keystone | grep admin | cut -d '|' -f 8 | cut -d '/' -f 3 | cut -d ':' -f 1) ENDPOINT_INTERNAL_URL=$(openstack endpoint list | grep keystone | grep internal | cut -d '|' -f 8 | cut -d '/' -f 3 | cut -d ':' -f 1) -cat <<EOT >> /root/endpoints.ini +cat <<EOT >> ${ENDPOINT_FILE} [DEFAULT] public_url=${ENDPOINT_PUBLIC_URL} admin_url=${ENDPOINT_ADMIN_URL} diff --git a/tools/keystone/fetchpass.sh b/tools/keystone/fetchpass.sh index 6e3b069..50fdb5c 100755 --- a/tools/keystone/fetchpass.sh +++ b/tools/keystone/fetchpass.sh @@ -12,8 +12,6 @@ # Fetch service password from the configuration files and store them # in a file to pass further down the build chain -EXPORT_FILE="/root/servicepass.ini" - GLANCE_CONF="/etc/glance/glance-registry.conf" NOVA_CONF="/etc/nova/nova.conf" NEUTRON_CONF="/etc/neutron/neutron.conf" @@ -26,6 +24,11 @@ AODH_CONF='/etc/aodh/aodh.conf' source openrc +# if running as part of Jenkins job, create the files in WORKSPACE +WORKSPACE=${WORKSPACE:-/root} +PASSWORD_FILE_ENC="${WORKSPACE}/servicepass.ini" +PASSWORD_FILE="${WORKSPACE}/passwords.ini" + # Get an option from an INI file # iniget config-file section option function iniget { @@ -54,7 +57,7 @@ ceilometer_password=$(iniget ${CEILOMETER_CONF} keystone_authtoken password) aodh_password=$(iniget ${AODH_CONF} keystone_authtoken password) #NOTE: can't find swift in /etc -cat <<EOT >> /root/passwords.ini +cat <<EOT >> ${PASSWORD_FILE} [DEFAULT] identity_uri=${bind_host} glance=${glance_password} @@ -67,6 +70,6 @@ ceilometer=${ceilometer_password} aodh=${aodh_password} EOT -openssl enc -aes-256-cbc -salt -in /root/passwords.ini -out ${EXPORT_FILE} -k multisite +openssl enc -aes-256-cbc -salt -in ${PASSWORD_FILE} -out ${PASSWORD_FILE_ENC} -k multisite -rm /root/passwords.ini
\ No newline at end of file +rm ${PASSWORD_FILE} diff --git a/tools/keystone/region.sh b/tools/keystone/region.sh index 1ae108f..c42401d 100755 --- a/tools/keystone/region.sh +++ b/tools/keystone/region.sh @@ -27,7 +27,9 @@ source openrc # # openstack endpoint create --publicurl "" --adminurl "" --internalurl "" --region ${region} <service> -ENDPOINT_FILE="/root/endpoints.ini" +# if running as part of Jenkins job, read the file from WORKSPACE +WORKSPACE=${WORKSPACE:-/root} +ENDPOINT_FILE="${WORKSPACE}/endpoints.ini" # Get an option from an INI file # iniget config-file section option diff --git a/tools/keystone/writepass.sh b/tools/keystone/writepass.sh index 2b0a965..d125854 100755 --- a/tools/keystone/writepass.sh +++ b/tools/keystone/writepass.sh @@ -13,8 +13,10 @@ set -o errexit set -o nounset set -o pipefail -PASSWORD_FILE_ENC="servicepass.ini" -PASSWORD_FILE="/root/passwords.ini" +# if running as part of Jenkins job, read and create the files from/in WORKSPACE +WORKSPACE=${WORKSPACE:-/root} +PASSWORD_FILE_ENC="${WORKSPACE}/servicepass.ini" +PASSWORD_FILE="${WORKSPACE}/passwords.ini" function ini_has_option { local file=$1 @@ -67,7 +69,7 @@ $option = $value } function decode_passwords() { - openssl enc -aes-256-cbc -d -a -in ${PASSWORD_FILE_ENC} -out /root/passwords.ini -k multisite + openssl enc -aes-256-cbc -d -a -in ${PASSWORD_FILE_ENC} -out ${PASSWORD_FILE} -k multisite } function write_controller() { |