emulate/traffic: allow traffic_replay to run users and groups generate multiple times
authorJoe Guo <joeg@catalyst.net.nz>
Thu, 9 Aug 2018 03:49:17 +0000 (15:49 +1200)
committerDouglas Bagnall <dbagnall@samba.org>
Wed, 10 Oct 2018 04:16:21 +0000 (06:16 +0200)
commitea6421d734ec538325560cf2bd9a0a03280a8cee
tree0ec1ae4a4904de0606d6743c9e6756fb1d7976f5
parent37f6e2a35172ea85ad9f043f3ce9f88e46bdf9fe
emulate/traffic: allow traffic_replay to run users and groups generate multiple times

When we run `traffic_replay --generate-users-only`, if we cancel it or
it breaks in middle, it won't do anything when we try to run it again.

This is because the code will check the first user/group to create. If
it's already there, then it thought task already done, and break the loop.

This commit change the behavior:
We search existing users/groups first, skip existing ones, and
create non-existing ones. So we can run it multi-times to make sure the
expected users and groups are actually created.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/emulate/traffic.py