Andrew Bogott has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/66001


Change subject: Fix a bug with trimming 'local-' from the requested service 
group name.
......................................................................

Fix a bug with trimming 'local-' from the requested service group name.

If a user is overly clever and included $wgOpenStackManagerServiceGroupPrefix
at the start of the service group they created, we trimmed it in most
cases but left it in for the $homedir setting.  That caused
various confusions.  Now we trim it in all cases.

This should fix bug 48699.

Change-Id: I0f774afb40ac95eb52de7960b02033bc61178f3a
---
M nova/OpenStackNovaServiceGroup.php
1 file changed, 7 insertions(+), 4 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OpenStackManager 
refs/changes/01/66001/1

diff --git a/nova/OpenStackNovaServiceGroup.php 
b/nova/OpenStackNovaServiceGroup.php
index 3ca5219..7365baf 100644
--- a/nova/OpenStackNovaServiceGroup.php
+++ b/nova/OpenStackNovaServiceGroup.php
@@ -191,7 +191,7 @@
         * @param  $initialUser
         * @return null|OpenStackNovaServiceGroup
         */
-       static function createServiceGroup( $simpleGroupName, $project, 
$initialUser ) {
+       static function createServiceGroup( $inGroupName, $project, 
$initialUser ) {
                global $wgAuth;
                global $wgOpenStackManagerLDAPUser;
                global $wgOpenStackManagerServiceGroupPrefix;
@@ -201,10 +201,13 @@
 
                # We don't want naming collisions between service groups and 
actual groups
                # or users.  So, prepend $wgOpenStackManagerServiceGroupPrefix 
to the requested group name.
-               $groupName = $wgOpenStackManagerServiceGroupPrefix . 
$simpleGroupName;
-               if ( strpos( $simpleGroupName, 
$wgOpenStackManagerServiceGroupPrefix, 0 ) === 0 ) {
+               if ( strpos( $inGroupName, 
$wgOpenStackManagerServiceGroupPrefix, 0 ) === 0 ) {
                        # The user was clever and already added the prefix.
-                       $groupName = $simpleGroupName;
+                       $groupName = $inGroupName;
+                       $simpleGroupName = substr( $inGroupName, strlen( 
$wgOpenStackManagerServiceGroupPrefix ) );
+               } else {
+                       $groupName = $wgOpenStackManagerServiceGroupPrefix . 
$inGroupName;
+                       $simpleGroupName = $inGroupName;
                }
 
                $user = new OpenStackNovaUser( $initialUser );

-- 
To view, visit https://gerrit.wikimedia.org/r/66001
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0f774afb40ac95eb52de7960b02033bc61178f3a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OpenStackManager
Gerrit-Branch: master
Gerrit-Owner: Andrew Bogott <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to