mirror of
https://github.com/samba-team/samba.git
synced 2025-03-12 20:58:37 +03:00
traffic_replay: Move machine account creation
I was assuming that generate_users_and_groups() only gets called in the --generate-users-only case. However, it also gets called in the default traffic replay case. This patch reworks the code so that the number of machine accounts to create gets passed in, and the 'create 25% more computers than users' assumption only applies to the --generate-users-only case. Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
fd089c37a1
commit
85b6d88989
@ -1798,22 +1798,22 @@ def clean_up_accounts(ldb, instance_id):
|
||||
|
||||
def generate_users_and_groups(ldb, instance_id, password,
|
||||
number_of_users, number_of_groups,
|
||||
group_memberships):
|
||||
group_memberships, machine_accounts=0):
|
||||
"""Generate the required users and groups, allocating the users to
|
||||
those groups."""
|
||||
memberships_added = 0
|
||||
groups_added = 0
|
||||
groups_added = 0
|
||||
computers_added = 0
|
||||
|
||||
create_ou(ldb, instance_id)
|
||||
|
||||
LOGGER.info("Generating dummy user accounts")
|
||||
users_added = generate_users(ldb, instance_id, number_of_users, password)
|
||||
|
||||
# assume there will be some overhang with more computer accounts than users
|
||||
computer_accounts = int(1.25 * number_of_users)
|
||||
LOGGER.info("Generating dummy machine accounts")
|
||||
computers_added = generate_machine_accounts(ldb, instance_id,
|
||||
computer_accounts, password)
|
||||
if machine_accounts > 0:
|
||||
LOGGER.info("Generating dummy machine accounts")
|
||||
computers_added = generate_machine_accounts(ldb, instance_id,
|
||||
machine_accounts, password)
|
||||
|
||||
if number_of_groups > 0:
|
||||
LOGGER.info("Generating dummy groups")
|
||||
|
@ -324,12 +324,16 @@ def main():
|
||||
sys.exit(1)
|
||||
|
||||
if opts.generate_users_only:
|
||||
# generate computer accounts for added realism. Assume there will be
|
||||
# some overhang with more computer accounts than users
|
||||
computer_accounts = int(1.25 * number_of_users)
|
||||
traffic.generate_users_and_groups(ldb,
|
||||
opts.instance_id,
|
||||
opts.fixed_password,
|
||||
opts.number_of_users,
|
||||
opts.number_of_groups,
|
||||
opts.group_memberships)
|
||||
opts.group_memberships,
|
||||
machine_accounts=computer_accounts)
|
||||
sys.exit()
|
||||
|
||||
tempdir = tempfile.mkdtemp(prefix="samba_tg_")
|
||||
|
Loading…
x
Reference in New Issue
Block a user