blob: 2379e18717272504c9b260fca1f30e1d409a0966 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
___perform_parsing()
{
unset OS_USERNAME
local credsfile="$HOME/.dtf/private/os/$1.yml"
if test -z "$1"; then
echo >&2 "argument expected: OpenStack ID"
return 1
fi
if test ! -f "$credsfile"; then
echo >&2 "file '$credsfile' not found"
return 1
fi
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"
}
unset OS_AUTH_URL OS_PASSWORD OS_TENANT_ID OS_TENANT_NAME OS_USERNAME
___perform_parsing "$@"
# # vi: syntax=sh
|