Rush has uploaded a new change for review. https://gerrit.wikimedia.org/r/258462
Change subject: OSM trying not to create empty groups ...................................................................... OSM trying not to create empty groups Change-Id: Idfe00340555edc11659cb3705368bd61813065d5 --- M nova/OpenStackNovaProject.php M nova/OpenStackNovaProjectGroup.php 2 files changed, 11 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OpenStackManager refs/changes/62/258462/1 diff --git a/nova/OpenStackNovaProject.php b/nova/OpenStackNovaProject.php index e4936a3..78182eb 100644 --- a/nova/OpenStackNovaProject.php +++ b/nova/OpenStackNovaProject.php @@ -135,7 +135,7 @@ // If we couldn't find an corresponding Project Group, // then we should create one now. if ( !$this->projectGroup->loaded or $this->projectGroup->isVirtual() ) { - $wgAuth->printDebug( $this->projectGroup->getProjectGroupName() . " either does not exist or is a virtual static group. Recreating is as a real group and syncing members.", NONSENSITIVE ); + $wgAuth->printDebug( $this->projectGroup->getProjectGroupName() . " either does not exist or is a virtual static group. Recreating as a real group and syncing members.", NONSENSITIVE ); // Delete, recreate, and then sync the members. $deleteSuccess = OpenStackNovaProjectGroup::deleteProjectGroup( $this->projectname ); diff --git a/nova/OpenStackNovaProjectGroup.php b/nova/OpenStackNovaProjectGroup.php index 9d4a80b..ea075fa 100644 --- a/nova/OpenStackNovaProjectGroup.php +++ b/nova/OpenStackNovaProjectGroup.php @@ -251,11 +251,20 @@ static function createProjectGroup( $projectname ) { global $wgAuth; global $wgOpenStackManagerLDAPProjectGroupBaseDN; + global $wgOpenStackManagerLDAPUsername; OpenStackNovaLdapConnection::connect(); + $user = new OpenStackNovaUser( $wgOpenStackManagerLDAPUsername ); + + if ( ! $user->userDN ) { + $wgAuth->printDebug( "Failed to find userDN in createProjectGroup", NONSENSITIVE ); + return false; + } + $projectGroupName = self::$prefix . $projectname; $projectGroup = array(); + $projectGroup['member'][] = $user->userDN; $projectGroup['objectclass'][] = 'posixgroup'; $projectGroup['objectclass'][] = 'groupofnames'; $projectGroup['cn'] = $projectGroupName; @@ -269,6 +278,7 @@ } else { $wgAuth->printDebug( "Failed to add project group $projectGroupName: " . ldap_error( $wgAuth->ldapconn ), NONSENSITIVE ); + return false; } return $success; } -- To view, visit https://gerrit.wikimedia.org/r/258462 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Idfe00340555edc11659cb3705368bd61813065d5 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/OpenStackManager Gerrit-Branch: master Gerrit-Owner: Rush <r...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits