Beispiel #1
0
# add designers groups to the CentOS agreement
ipa.fasagreement_add_group("CentOS Agreement", group="designers")

# create some random users and add them to both the developers and admin groups randomly
for x in range(50):
    firstName = fake.first_name()
    lastName = fake.last_name()
    username = firstName + str(x)
    try:
        ipa.user_add(
            a_uid=username,
            o_givenname=firstName,
            o_sn=lastName,
            o_cn=firstName + " " + lastName,
            o_homedirectory=f"/home/fedora/{username}",
            o_userpassword=USER_PASSWORD,
            fasircnick=[username, username + "_"],
            faslocale="en-US",
            fastimezone=fake.random_sample(timezones.TIMEZONES, length=1)[0],
            fasstatusnote="active",
            fasgpgkeyid=[],
        )
        # 'change' the password as the user, so its not expired
        untouched_ipa.change_password(username,
                                      new_password=USER_PASSWORD,
                                      old_password=USER_PASSWORD)
        if x % 3 == 0:
            # User must have signed FPCA before being added to developers
            ipa.fasagreement_add_user("FPCA", user=username)
            ipa.group_add_member(a_cn="developers", o_user=username)
            if x < 10:
Beispiel #2
0
except python_freeipa.exceptions.FreeIPAError as e:
    print(e)

# create some random users and add them to both the developers and admin groups randomly
for x in range(50):
    firstName = fake.first_name()
    lastName = fake.last_name()
    username = firstName + str(x)
    try:
        ipa.user_add(
            username,
            firstName,
            lastName,
            firstName + " " + lastName,
            home_directory=f"/home/fedora/{username}",
            disabled=False,
            user_password=USER_PASSWORD,
            fasircnick=[username, username + "_"],
            faslocale="en-US",
            fastimezone=fake.random_sample(timezones.TIMEZONES, length=1)[0],
            fasgpgkeyid=[],
        )
        # 'change' the password as the user, so its not expired
        untouched_ipa.change_password(
            username,
            new_password=USER_PASSWORD,
            old_password=USER_PASSWORD,
        )
        if x % 3 == 0:
            ipa.group_add_member("developers", username, skip_errors=True)
            if x < 10: