Commit 6584a9bc authored by Vitaly Lipatov's avatar Vitaly Lipatov

add like_id for every engine and check if id is legal

parent 65cb4c2e
......@@ -46,6 +46,12 @@ list_ALL_names()
a= docker ps --all -q --format "{{.Names}}" | line_filter
}
like_id()
{
# a55f 58b1 84ac
echo "$1" | grep -q "^[0-9a-f]{12}$"
}
todo()
{
warning "$@"
......
......@@ -46,6 +46,7 @@ arg_is_id()
[ -n "$1" ] || return 1
echo " $(list_ALL) " | grep -q " $1 " && return 0
echo " $(list_ALL_names) " | grep -q " $1 " && return 0
like_id "$1" && fatal "ID $1 is missed on the host. Check # evz list -a output"
return 1
}
......
......@@ -47,6 +47,11 @@ list_ALL_names()
return
}
like_id()
{
echo "$1" | grep -q -E "^[0-9]+$"
}
todo()
{
warning "FIXME: $@"
......
......@@ -44,6 +44,12 @@ list_ALL_names()
a= qm list | grep "[0-9]\+" | sed -e "s| *\([0-9]\+\) .*|\1|" | line_filter
}
like_id()
{
echo "$1" | grep -q -E "^[0-9]+$"
}
todo()
{
warning "FIXME: $@"
......
......@@ -47,6 +47,14 @@ list_ALL_names()
return
}
like_id()
{
# 8-4-4-4-12
# 707b0509-d9f6-4b33-833b-4af1a2e12eee
echo "$1" | grep -q -E "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
}
todo()
{
warning "$@"
......
......@@ -37,6 +37,11 @@ list_ALL_names()
a= vzlist -H -a -o name | grep -v "^-$"
}
like_id()
{
echo "$1" | grep -q -E "^[0-9]+$"
}
evz_vzctl()
{
......
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