Closed jsiegers closed 5 years ago
if (!$this->in_array_i($gitlabUserName, $ldapGroupsSafe[$gitlabGroupName])) {
Looks like it's trying to process a group that doesn't exist. To get more insight could you please insert this block after the foreach
condition at line 1361?
if (!isset($ldapGroupsSafe[$gitlabGroupName]) || !is_array($ldapGroupsSafe[$gitlabGroupName])) {
$this->logger->error(sprintf("Group \"%s\" doesn't appear to exist at path \"%s\".", $gitlabGroupName, $gitlabGroupPath));
continue;
}
You'll then see an error output as to which group is troubling you.
It now git this (just an excerpt of the log):
[error] Group "A Folder Renamed" doesn't appear to exist at path "a-folder-renamed".
[error] Group "A Folder Renamed" doesn't appear to exist at path "a-folder-renamed".
[error] Group "A Folder Renamed" doesn't appear to exist at path "a-folder-renamed".
[notice] Synchronising 0 member(s) for group #8 "A Folder Renamed" [a-folder-renamed]...
[notice] Finding existing group members...
[notice] 0 Gitlab group "A Folder Renamed" [a-folder-renamed] member(s) found.
[notice] Adding missing group members...
[notice] 0 Gitlab group "A Folder Renamed" [a-folder-renamed] member(s) added.
[notice] Deleting extra group members...
[notice] 0 Gitlab group "A Folder Renamed" [a-folder-renamed] member(s) deleted.
[error] Group "A Sub Folder" doesn't appear to exist at path "a-sub-folder".
[error] Group "A Sub Folder" doesn't appear to exist at path "a-sub-folder".
[error] Group "A Sub Folder" doesn't appear to exist at path "a-sub-folder".
[notice] Synchronising 0 member(s) for group #9 "A Sub Folder" [a-sub-folder]...
[notice] Finding existing group members...
[notice] 0 Gitlab group "A Sub Folder" [a-sub-folder] member(s) found.
[notice] Adding missing group members...
[notice] 0 Gitlab group "A Sub Folder" [a-sub-folder] member(s) added.
[notice] Deleting extra group members...
[notice] 0 Gitlab group "A Sub Folder" [a-sub-folder] member(s) deleted.
[error] Group "Series" doesn't appear to exist at path "series".
[error] Group "Series" doesn't appear to exist at path "series".
[error] Group "Series" doesn't appear to exist at path "series".
[notice] Synchronising 0 member(s) for group #11 "Series" [series]...
[notice] Finding existing group members...
[notice] 0 Gitlab group "Series" [series] member(s) found.
[notice] Adding missing group members...
[notice] 0 Gitlab group "Series" [series] member(s) added.
[notice] Deleting extra group members...
[notice] 0 Gitlab group "Series" [series] member(s) deleted.
[error] Group "The Second Sub Folder" doesn't appear to exist at path "the-second-sub-folder".
[error] Group "The Second Sub Folder" doesn't appear to exist at path "the-second-sub-folder".
[error] Group "The Second Sub Folder" doesn't appear to exist at path "the-second-sub-folder".
These groups are subgroups that have been created within the main group. What I do with the GitLab API is look only for groups where the parent_id is missing. Those are the groups at root level.
At least as I understand this script is that it only creates groups at root level and should ignore the subgroups.
btw with these extra lines it doesn't crash anymore.
subgroups
That would be why. I've not built any special sub-group handling (or planned to really), but I would have anticipated that this tool would still sync groups though lose their parental hierarchy.
Are these really sub-groups in your directory, or have you made these separately (or moved synced ones into children) on the Gitlab side?
Yes these are really subgroups. In our situation users are allowed to create their own subgroup structure; so there will be a lot of subgroups.
Any thoughts on this on yet? (I like to keep it hot ;-)
Sub-groups wasn't in my planning as none of my directories are organised like this. I don't really have time to implement that at present to implement this so someone else will likely have to take it on.
I understand. But all I want is that the script doesn't crash when it encounters a subgroup. That piece of code you mentioned earlier i think did the job but is not in the official release yet.
Yep that's fair. That's been sent in. ^
Cheers! Doesn't crash now!
I've got a weird crash. I've got some groups that a user makes. One of them is called 'A Folder Renamed'.
This is what I get in the log: