Open
Conversation
Member
|
Historically you would just look in #atool for the most recently created account, but this is cool too. |
axmmisaka
requested changes
Sep 22, 2022
Contributor
axmmisaka
left a comment
There was a problem hiding this comment.
Alternatively, since this is same as https://github.com/ocf/ocflib/blame/889145860a908e23610e5b4edd7774691a1beab2/ocflib/account/creation.py#L75, maybe abstract it into a separate function in ocflib.
|
|
||
|
|
||
| def is_valid_uid(uid): | ||
| for start, end in IGNORED_UID_RANGES: |
Contributor
There was a problem hiding this comment.
Do you mean INVALID_UID_RANGES?
| ) | ||
| uids = [int(entry['attributes']['uidNumber']) for entry in c.response] | ||
| uids = filter(is_valid_uid, uids) | ||
| print('Max currently used OCF UID is: %s' % max(uids)) |
Contributor
There was a problem hiding this comment.
I prefer .format but this works as well
| def main(): | ||
| print('Searching for maximum currently used OCF UID') | ||
| with ldap_ocf() as c: | ||
| c.search( |
Contributor
There was a problem hiding this comment.
Similar to what @cg505 said this is fine but indeed a little slow tbh; if we are not running this constantly I guess it's fine?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I had to bump
_KNOWN_UID(here) recently, and to do so find the maximum currently in use OCF UID from LDAP. Realistically this should be simple enough, but the true maximum value is excluded so more processing is required. This script should automate that process.