summaryrefslogtreecommitdiffstats
path: root/controller/parse_credsfile
blob: 4cf8e58290124d85c62c4f4ea3a1356e56e7a2f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
___os_confdir=$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)

credsfile="$___os_confdir/private/os/$1.yml"

while read line; do
    if [[ "$line" =~ ^([a-zA-Z0-9_]*):\ ?(.*)$ ]]; then
        key="${BASH_REMATCH[1]}"
        if test "$key" = os_nova_password; then
            key=os_password
        fi
        eval set ${BASH_REMATCH[2]}
        eval export "${key^^}"="\"$@\""
    fi
done < "$credsfile"

# vi: syntax=sh