diff options
author | Dan Radez <dradez@redhat.com> | 2016-09-23 12:43:21 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2016-09-23 12:43:21 +0000 |
commit | 1a04e9e2695244d0d56bb901b9c7c5284b759fbd (patch) | |
tree | 9af7a454bd7c5e9b694d925b29a09b825b8ead34 /lib/parse-functions.sh | |
parent | a0250dddb5a126000d966b2b21343ea36b9bd8e0 (diff) | |
parent | 83f46bda07b272f3188329527030d3f2e16dc335 (diff) |
Merge "removing unused bash parser functions"
Diffstat (limited to 'lib/parse-functions.sh')
-rwxr-xr-x | lib/parse-functions.sh | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/lib/parse-functions.sh b/lib/parse-functions.sh index ef388f44..87453ea3 100755 --- a/lib/parse-functions.sh +++ b/lib/parse-functions.sh @@ -10,46 +10,6 @@ # Parser functions used by OPNFV Apex -##translates yaml into variables -##params: filename, prefix (ex. "config_") -##usage: parse_yaml opnfv_ksgen_settings.yml "config_" -parse_yaml() { - local prefix=$2 - local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034') - sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \ - -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | - awk -F$fs '{ - indent = length($1)/2; - vname[indent] = $2; - for (i in vname) {if (i > indent) {delete vname[i]}} - if (length($3) > 0) { - vn=""; for (i=0; i<indent; i++) {vn=(vn)(vname[i])("_")} - printf("%s%s%s=%s\n", "'$prefix'",vn, $2, $3); - } - }' -} - -##parses variable from a string with '=' -##and removes global prefix -##params: string, prefix -##usage: parse_setting_var 'deploy_myvar=2' 'deploy_' -parse_setting_var() { - local mystr=$1 - local prefix=$2 - if echo $mystr | grep -E "^.+\=" > /dev/null; then - echo $(echo $mystr | grep -Eo "^.+\=" | tr -d '=' | sed 's/^'"$prefix"'//') - else - return 1 - fi -} -##parses value from a string with '=' -##params: string -##usage: parse_setting_value -parse_setting_value() { - local mystr=$1 - echo $(echo $mystr | grep -Eo "\=.*$" | tr -d '=') -} - ##parses network settings yaml into globals parse_network_settings() { local output parse_ext |