summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtools/keystone/endpoint.sh5
-rwxr-xr-xtools/keystone/fetchpass.sh12
-rwxr-xr-xtools/keystone/region.sh1
-rwxr-xr-xtools/keystone/run.sh24
-rwxr-xr-xtools/keystone/writepass.sh4
5 files changed, 34 insertions, 12 deletions
diff --git a/tools/keystone/endpoint.sh b/tools/keystone/endpoint.sh
index 410a723..1bb6c9b 100755
--- a/tools/keystone/endpoint.sh
+++ b/tools/keystone/endpoint.sh
@@ -16,12 +16,15 @@ set -o pipefail
# Ensure that openrc containing OpenStack environment variables is present.
source openrc
+# Always executed on controller
+ENDPOINT_FILE="/root/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..5d50aa6 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,10 @@ AODH_CONF='/etc/aodh/aodh.conf'
source openrc
+# Always executed on controller
+PASSWORD_FILE_ENC="/root/servicepass.ini"
+PASSWORD_FILE="/root/passwords.ini"
+
# Get an option from an INI file
# iniget config-file section option
function iniget {
@@ -54,7 +56,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 +69,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..25ee026 100755
--- a/tools/keystone/region.sh
+++ b/tools/keystone/region.sh
@@ -27,6 +27,7 @@ source openrc
#
# openstack endpoint create --publicurl "" --adminurl "" --internalurl "" --region ${region} <service>
+# Always executed on controller
ENDPOINT_FILE="/root/endpoints.ini"
# Get an option from an INI file
diff --git a/tools/keystone/run.sh b/tools/keystone/run.sh
index 6fc02ca..8fe933f 100755
--- a/tools/keystone/run.sh
+++ b/tools/keystone/run.sh
@@ -18,9 +18,12 @@ set -o pipefail
# Usage: run.sh (controller|compute) <runnable_script.sh>
INSTALLER_IP=10.20.0.2
+# Runs on the jumphost
+# if running as part of Jenkins job, read and create the files from/in WORKSPACE
+WORKSPACE=${WORKSPACE:-"/root"}
usage() {
- echo "usage: $0 -a <installer_ip> -t (controller|compute) -r <runnable_script.sh> -d <data_file>" >&2
+ echo "usage: $0 -a <installer_ip> -t (controller|compute) -r <runnable_script.sh> -d <data_file> -o <output_file>" >&2
}
error () {
@@ -51,6 +54,10 @@ case $1 in
data="$2"
shift # past argument
;;
+ -o|--output)
+ output="$2"
+ shift # past argument
+ ;;
*)
echo "Non-option argument: '-${OPTARG}'" >&2
usage
@@ -58,9 +65,11 @@ case $1 in
;;
esac
shift # past argument or value
+done
installer_ip=${installer_ip:-$INSTALLER_IP}
data=${data:-""}
+output=${output:-""}
ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
@@ -77,10 +86,17 @@ function run_on_target() {
sshpass -p r00tme ssh 2>/dev/null $ssh_options root@${installer_ip} \
"ssh $ssh_options $1 \"cd /root/ && chmod +x ${runnable}\"" &> /dev/null
sshpass -p r00tme ssh 2>/dev/null $ssh_options root@${installer_ip} \
- "ssh $ssh_options $1 \"cd /root/ && nohup /root/${runnable} > install.log 2> /dev/null\"" &> /dev/null
+ "ssh $ssh_options $1 \"cd /root/ && nohup ${runnable} > ${runnable}.log 2> /dev/null\"" &> /dev/null
# Output here
sshpass -p r00tme ssh 2>/dev/null $ssh_options root@${installer_ip} \
- "ssh $ssh_options $1 \"cd /root/ && cat install.log\""
+ "ssh $ssh_options $1 \"cd /root/ && cat ${runnable}.log\""
+
+ if [ -n "${output}" ]; then
+ #Fetch output file
+ sshpass -p r00tme ssh 2>/dev/null $ssh_options root@${installer_ip} \
+ "ssh $ssh_options $1 \"cd /root/ && cat ${output}\"" > "${WORKSPACE}/${output}"
+ fi
+
}
target_info=$(sshpass -p r00tme ssh 2>/dev/null $ssh_options root@${installer_ip} \
@@ -89,4 +105,4 @@ sed 's/ //g') &> /dev/null
for machine in ${target_info} ; do
run_on_target $machine
-done
+done \ No newline at end of file
diff --git a/tools/keystone/writepass.sh b/tools/keystone/writepass.sh
index 2b0a965..466cd48 100755
--- a/tools/keystone/writepass.sh
+++ b/tools/keystone/writepass.sh
@@ -13,7 +13,7 @@ set -o errexit
set -o nounset
set -o pipefail
-PASSWORD_FILE_ENC="servicepass.ini"
+PASSWORD_FILE_ENC="/root/servicepass.ini"
PASSWORD_FILE="/root/passwords.ini"
function ini_has_option {
@@ -67,7 +67,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() {