summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Radez <dradez@redhat.com>2016-07-06 09:35:07 -0400
committerDan Radez <dradez@redhat.com>2016-07-06 20:35:33 -0400
commit771d5a58883f1fcb89507c503b1ef13524610a93 (patch)
tree3dd9c6351bb0aff552d789ae1510999db98eb6d4
parent5187d6ed8d485729aa2d34cb040b26c12a6e69ad (diff)
Splitting out common functions to lib files
trying to reduce the monolith deploy.sh to smaller parts Change-Id: Ie2d2d74de5b8cacbb1c57d3d397bede0b659c0af Signed-off-by: Dan Radez <dradez@redhat.com>
-rwxr-xr-xci/deploy.sh33
-rw-r--r--lib/common-functions.sh30
2 files changed, 30 insertions, 33 deletions
diff --git a/ci/deploy.sh b/ci/deploy.sh
index b25392f1..57c63766 100755
--- a/ci/deploy.sh
+++ b/ci/deploy.sh
@@ -74,37 +74,6 @@ for lib_file in ${lib_files[@]}; do
fi
done
-##FUNCTIONS
-##checks if prefix exists in string
-##params: string, prefix
-##usage: contains_prefix "deploy_setting_launcher=1" "deploy_setting"
-contains_prefix() {
- local mystr=$1
- local prefix=$2
- if echo $mystr | grep -E "^$prefix.*$" > /dev/null; then
- return 0
- else
- return 1
- fi
-}
-
-##verify internet connectivity
-#params: none
-function verify_internet {
- if ping -c 2 $ping_site > /dev/null; then
- if ping -c 2 www.google.com > /dev/null; then
- echo "${blue}Internet connectivity detected${reset}"
- return 0
- else
- echo "${red}Internet connectivity detected, but DNS lookup failed${reset}"
- return 1
- fi
- else
- echo "${red}No internet connectivity detected${reset}"
- return 1
- fi
-}
-
display_usage() {
echo -e "Usage:\n$0 [arguments] \n"
echo -e " -d|--deploy-settings : Full path to deploy settings yaml file. Optional. Defaults to null"
@@ -240,8 +209,6 @@ parse_cmdline() {
}
-##END FUNCTIONS
-
main() {
parse_cmdline "$@"
echo -e "${blue}INFO: Parsing network settings file...${reset}"
diff --git a/lib/common-functions.sh b/lib/common-functions.sh
index 365f8e3f..2ace9970 100644
--- a/lib/common-functions.sh
+++ b/lib/common-functions.sh
@@ -257,3 +257,33 @@ function prompt_user {
fi
done
}
+
+##checks if prefix exists in string
+##params: string, prefix
+##usage: contains_prefix "deploy_setting_launcher=1" "deploy_setting"
+contains_prefix() {
+ local mystr=$1
+ local prefix=$2
+ if echo $mystr | grep -E "^$prefix.*$" > /dev/null; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+##verify internet connectivity
+#params: none
+function verify_internet {
+ if ping -c 2 $ping_site > /dev/null; then
+ if ping -c 2 www.google.com > /dev/null; then
+ echo "${blue}Internet connectivity detected${reset}"
+ return 0
+ else
+ echo "${red}Internet connectivity detected, but DNS lookup failed${reset}"
+ return 1
+ fi
+ else
+ echo "${red}No internet connectivity detected${reset}"
+ return 1
+ fi
+}