Commit 4d88c6cf authored by Nikos Skalkotos's avatar Nikos Skalkotos
Browse files

Fix bug in import/export regarding some API params

Fix a bug where API params like CONFIG_URL or IMG_PASSWORD where
checked and used by scripts other that `create' (e.g. `import' and
`export'). This may lead to errors. The CONFIG_URL may not be valid
after the image creation
parent dcb9c964
......@@ -162,28 +162,30 @@ get_api10_arguments() {
get_api20_arguments() {
get_api10_arguments
local required_osparams="IMG_ID IMG_FORMAT IMG_PASSWD"
local osparams="$required_osparams IMG_PROPERTIES IMG_PERSONALITY CONFIG_URL"
if [ "$SCRIPT_NAME" = "create" ]; then
local required_osparams="IMG_ID IMG_FORMAT IMG_PASSWD"
local osparams="$required_osparams IMG_PROPERTIES IMG_PERSONALITY CONFIG_URL"
# Store OSP_VAR in VAR
for param in $osparams; do
eval $param=\"\$OSP_$param\"
done
if [ -n "$CONFIG_URL" ]; then
local config config_params
echo "Downloading configuration parameters from: \`$CONFIG_URL'" >&2
config=$($CURL -f "$CONFIG_URL")
config_params=$(./decode-config.py $osparams <<< "$config")
eval "$config_params"
fi
# Store OSP_VAR in VAR
for param in $osparams; do
eval $param=\"\$OSP_$param\"
done
for var in $required_osparams; do
if [ -z "${!var}" ]; then
log_error "Missing OS API Parameter: ${var}"
exit 1
if [ -n "$CONFIG_URL" ]; then
local config config_params
echo "Downloading configuration parameters from: \`$CONFIG_URL'" >&2
config=$($CURL -f "$CONFIG_URL")
config_params=$(./decode-config.py $osparams <<< "$config")
eval "$config_params"
fi
done
for var in $required_osparams; do
if [ -z "${!var}" ]; then
log_error "Missing OS API Parameter: ${var}"
exit 1
fi
done
fi
}
map_disk0() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment