Skip to content

Commit

Permalink
lxc-test-unpriv: check user existence before removing it
Browse files Browse the repository at this point in the history
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@canonical.com>
  • Loading branch information
Cypresslin authored and Christian Brauner committed Feb 7, 2018
1 parent 74941f9 commit cbec95c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/tests/lxc-test-unpriv
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,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
Expand Down

0 comments on commit cbec95c

Please sign in to comment.