jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/352973 )
Change subject: Prevent a few errors noticed in production
......................................................................
Prevent a few errors noticed in production
Change-Id: Ibbb16e7408890408a235d2d94383ae7ec7a997bf
---
M nova/OpenStackNovaProject.php
M special/SpecialNovaServiceGroup.php
2 files changed, 19 insertions(+), 17 deletions(-)
Approvals:
Paladox: Looks good to me, but someone else must approve
Chad: Looks good to me, approved
jenkins-bot: Verified
diff --git a/nova/OpenStackNovaProject.php b/nova/OpenStackNovaProject.php
index f1e873a..989a4cc 100644
--- a/nova/OpenStackNovaProject.php
+++ b/nova/OpenStackNovaProject.php
@@ -26,7 +26,8 @@
public $roles;
public $userrole;
public $loaded;
- public $serviceUsers;
+ protected $serviceGroups;
+ protected $serviceUsers;
// list of roles that are visible in the web UI
static $visiblerolenames = array( 'projectadmin' );
@@ -91,11 +92,8 @@
/**
* Fetch the project from keystone initialize the object
- * @return void
*/
- function fetchProjectInfo( $refresh=true ) {
- global $wgOpenStackManagerLDAPProjectBaseDN;
-
+ function fetchProjectInfo( $refresh = true ) {
if ( $this->loaded and !$refresh ) {
return;
}
@@ -119,12 +117,14 @@
global $wgOpenStackManagerLDAPServiceGroupBaseDN;
$ldap = LdapAuthenticationPlugin::getInstance();
- $result = LdapAuthenticationPlugin::ldap_search(
$ldap->ldapconn,
- $wgOpenStackManagerLDAPServiceGroupBaseDN,
- '(objectclass=groupofnames)' );
+ $result = LdapAuthenticationPlugin::ldap_search(
+ $ldap->ldapconn,
+ $wgOpenStackManagerLDAPServiceGroupBaseDN,
+ '(objectclass=groupofnames)'
+ );
+ $this->serviceGroups = array();
if ( $result ) {
- $this->serviceGroups = array();
$groupList =
LdapAuthenticationPlugin::ldap_get_entries( $ldap->ldapconn, $result );
if ( isset( $groupList ) ) {
array_shift( $groupList );
@@ -136,17 +136,17 @@
}
}
}
- } else {
- $this->serviceGroups = array();
}
$serviceUserBaseDN = "ou=people" . "," .
$wgOpenStackManagerLDAPServiceGroupBaseDN;
- $result = LdapAuthenticationPlugin::ldap_search(
$ldap->ldapconn,
- $serviceUserBaseDN,
- '(objectclass=person)' );
+ $result = LdapAuthenticationPlugin::ldap_search(
+ $ldap->ldapconn,
+ $serviceUserBaseDN,
+ '(objectclass=person)'
+ );
+ $this->serviceUsers = array();
if ( $result ) {
- $this->serviceUsers = array();
$userList = LdapAuthenticationPlugin::ldap_get_entries(
$ldap->ldapconn, $result );
if ( isset( $userList ) ) {
array_shift( $userList );
@@ -159,8 +159,6 @@
}
}
}
- } else {
- $this->serviceUsers = array();
}
}
@@ -176,6 +174,7 @@
* @return array
*/
function getRoles() {
+ $this->fetchProjectInfo();
return $this->roles;
}
@@ -184,6 +183,7 @@
* @return array
*/
function getServiceGroups() {
+ $this->fetchProjectInfo();
return $this->serviceGroups;
}
@@ -192,6 +192,7 @@
* @return array
*/
function getServiceUsers() {
+ $this->fetchProjectInfo();
return $this->serviceUsers;
}
diff --git a/special/SpecialNovaServiceGroup.php
b/special/SpecialNovaServiceGroup.php
index 123f877..cab9622 100644
--- a/special/SpecialNovaServiceGroup.php
+++ b/special/SpecialNovaServiceGroup.php
@@ -66,6 +66,7 @@
}
}
$servicemembers = $project->getServiceUsers();
+ $servicemember_keys = array();
foreach ( $servicemembers as $servicemember ) {
$servicemember_keys[$servicemember] =
$servicemember;
if ( in_array( $servicemember, $groupmembers )
) {
--
To view, visit https://gerrit.wikimedia.org/r/352973
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ibbb16e7408890408a235d2d94383ae7ec7a997bf
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/OpenStackManager
Gerrit-Branch: master
Gerrit-Owner: Reedy <[email protected]>
Gerrit-Reviewer: BryanDavis <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: Paladox <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits