[lxc-devel] [lxc/master] lxc-test-unpriv: check user existence before removing it
Cypresslin on Github
lxc-bot at linuxcontainers.org
Wed Nov 22 08:13:27 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 531 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20171122/e745a5af/attachment.bin>
-------------- next part --------------
From 438c96e96a91388b91d02c18b5e0d6c89816ae5a Mon Sep 17 00:00:00 2001
From: Po-Hsu Lin <po-hsu.lin at canonical.com>
Date: Wed, 22 Nov 2017 03:11:34 -0500
Subject: [PATCH] lxc-test-unpriv: check user existence before removing it
Check the test user (lxcunpriv) before calling deluser command,
otherwise it will print unnecessary error message:
/usr/sbin/deluser: The user 'lxcunpriv' does not exist.
Signed-off-by: Po-Hsu Lin <po-hsu.lin at canonical.com>
---
src/tests/lxc-test-unpriv | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/tests/lxc-test-unpriv b/src/tests/lxc-test-unpriv
index 97b70e796..16ff12dd7 100755
--- a/src/tests/lxc-test-unpriv
+++ b/src/tests/lxc-test-unpriv
@@ -105,7 +105,7 @@ fi
trap cleanup EXIT SIGHUP SIGINT SIGTERM
set -eu
-deluser $TUSER && rm -Rf $HDIR || true
+id $TUSER &> /dev/null && deluser -q --remove-home $TUSER
useradd $TUSER
mkdir -p $HDIR
More information about the lxc-devel
mailing list