[lxc-devel] Please make "-f" mandatory in lxc-create

richard -rw- weinberger richard.weinberger at gmail.com
Tue May 29 08:47:47 UTC 2012


On Tue, May 29, 2012 at 10:36 AM, richard -rw- weinberger
<richard.weinberger at gmail.com> wrote:
> Found the problem, patch is in the way!
>

*grr*, forgot that this list is moderated.

--

Using this patch is it possible to catch usage errors like:
lxc-create -n foo foo.cfg

Signed-off-by: Richard Weinberger <richard at nod.at>
---
 src/lxc/lxc-create.in |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/lxc/lxc-create.in b/src/lxc/lxc-create.in
index bd9a438..89f0889 100644
--- a/src/lxc/lxc-create.in
+++ b/src/lxc/lxc-create.in
@@ -136,6 +136,12 @@ while true; do
         esac
 done

+if [ ! -z "$1" ] ; then
+    echo "Unknown argument: $1"
+    usage
+    exit 1
+fi
+
 if [ -z "$lxc_path" ]; then
     echo "$(basename $0): no configuration path defined" >&2
     exit 1
-- 
1.7.9.2

-- 
Thanks,
//richard




More information about the lxc-devel mailing list