summaryrefslogtreecommitdiffstats
path: root/parse_credsfile
blob: 956ab4ea07da7a4cf831cf39f66fab87002ddbc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
credsfile="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 "${key^^}"="\"$@\""
    fi
done < "$credsfile"

# vi: syntax=sh