catch unsupported state cases in __dog_vdi und __qemu_img
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
parent
b22b581b67
commit
b7f8b5e339
3 changed files with 30 additions and 11 deletions
|
@ -20,9 +20,17 @@
|
||||||
|
|
||||||
state_should="$(cat "$__object/parameter/state")"
|
state_should="$(cat "$__object/parameter/state")"
|
||||||
|
|
||||||
if [ "$state_should" = "present" ]; then
|
case "$state_should" in
|
||||||
|
present)
|
||||||
if [ ! -f "$__object/parameter/size" ]; then
|
if [ ! -f "$__object/parameter/size" ]; then
|
||||||
echo "Size is required when state is present" >&2
|
echo "Size is required when state is present" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
absent)
|
||||||
|
:
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unsupported state: $state_should" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
|
@ -3,11 +3,23 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
format="$(cat "$__object/parameter/format")"
|
format="$(cat "$__object/parameter/format")"
|
||||||
state="$(cat "$__object/parameter/state")"
|
state_should="$(cat "$__object/parameter/state")"
|
||||||
|
|
||||||
diskimage="/$__object_id"
|
diskimage="/$__object_id"
|
||||||
|
|
||||||
# Absent is ensured by __file, present by gencode-remote
|
case "$state_should" in
|
||||||
if [ "$state" = "absent" ]; then
|
present)
|
||||||
|
if [ ! -f "$__object/parameter/size" ]; then
|
||||||
|
echo "Size is required when state is present" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
absent)
|
||||||
|
# Absent is ensured by __file, present by gencode-remote
|
||||||
__file "$diskimage" --state absent
|
__file "$diskimage" --state absent
|
||||||
fi
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unsupported state: $state_should" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
size
|
|
Loading…
Reference in a new issue