Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize imports of users and groups #1

Open
obscurerichard opened this issue Apr 7, 2017 · 0 comments
Open

Optimize imports of users and groups #1

obscurerichard opened this issue Apr 7, 2017 · 0 comments

Comments

@obscurerichard
Copy link
Member

When I asked @rcritten for permission to publish this derived work, he gave some excellent advice on optimizing the imports:

@rcritten:
As an aside, adding group members one at a time may bring with it a big
performance penalty if you have a group with a lot of members.

@obscurerichard:
Thanks! I had it the other way (group members comma separated) initially but I got
an error code from the "ipa group-member-add" when I first tried it that way so I
fell back to this simpler but slower method. I may take a 2nd pass at doing it that
way to see if it worked anyway.

@rcritten:
You should be able to pass them in with multiple --users options (or the
API equivalent).

The batch command is another alternative. You can do the single-user
adds as one batch command and execute them all at once without all the
round-trips. I've tended to batch up the commands in groups of 50 or 100.

It looks something like this:

batch = []
args = [groupname]
kw = {'users': user}
batch.append({'method': 'group_add_member', 'params': [args, kw]})

When you've collected all the users you want, execute the command with

api.Command.batch(batch)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant