summaryrefslogtreecommitdiffstats
path: root/scripts/lib.sh
diff options
context:
space:
mode:
authorjuraj.linkes <jlinkes@cisco.com>2017-06-03 11:25:51 +0200
committerjuraj.linkes <jlinkes@cisco.com>2017-06-05 10:32:06 +0200
commit14566a1577f9e39f387180d9db7b5781e54ea7cd (patch)
tree2f7de8cdc37e4f82b2de84a22e168d23f62a986e /scripts/lib.sh
parentc0b072ee944330f97e7eb3b03df79bf9494e6b9a (diff)
Added script for odl installation
Also refactored part of code Change-Id: I4e479d538b03d17c7b460d04ef0bdbd980d39787 Signed-off-by: juraj.linkes <jlinkes@cisco.com>
Diffstat (limited to 'scripts/lib.sh')
-rw-r--r--scripts/lib.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/lib.sh b/scripts/lib.sh
index b825b9c..b3d9db3 100644
--- a/scripts/lib.sh
+++ b/scripts/lib.sh
@@ -7,9 +7,40 @@ hc_username=admin
hc_password=admin
hc_netconf_port=2831
NODE_PATTERN=overcloud
+CONTROLLER_PATTERN=controller
overcloudrc_path=/root/$overcloud_file_name
overcloud_fds_repo_loc=/root
overcloud_script_loc=$overcloud_fds_repo_loc/fds/scripts
+IPV4_REGEX='([0-9]{1,3}.){3}[0-9]{1,3}'
+
+get_nodes() {
+ if [[ $1 ]]
+ then
+ NODES=$(grep -o "$NODE_PATTERN-$1-[0-9]" /etc/hosts)
+ else
+ NODES=$(grep -Eo "$NODE_PATTERN-[^-]+-[0-9]" /etc/hosts)
+ fi
+}
+
+copy_to_controllers () {
+ get_nodes $CONTROLLER_PATTERN
+ LOCAL_FILE=$1
+ REMOTE_LOC=$2
+ for NODE in $NODES
+ do
+ scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $LOCAL_FILE $NODE:$REMOTE_LOC &
+ done
+ wait
+}
+
+exec_on_controllers() {
+ get_nodes $CONTROLLER_PATTERN
+ for NODE in $NODES
+ do
+ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $NODE $@ &
+ done
+ wait
+}
in_array() {
key=$1