jenkins-bot has submitted this change and it was merged.

Change subject: Fix logic to refresh the service catalog.
......................................................................


Fix logic to refresh the service catalog.

Previously this wouldn't actually work if certain memcache pieces
were improperly aligned.

Possible fix for
Bug: T110629
Change-Id: I52422b294d33eee43d82fdd4c630ad4b0442df87
(cherry picked from commit e035716e40489a5aa0c6fc6af67c866bdf9a9542)
---
M nova/OpenStackNovaController.php
1 file changed, 8 insertions(+), 5 deletions(-)

Approvals:
  Alex Monk: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/nova/OpenStackNovaController.php b/nova/OpenStackNovaController.php
index a575a4e..acf3493 100644
--- a/nova/OpenStackNovaController.php
+++ b/nova/OpenStackNovaController.php
@@ -746,15 +746,18 @@
                return $token;
        }
 
-       function getProjectToken( $project ) {
+       function getProjectToken( $project, $forcerefresh = false ) {
                global $wgMemc;
 
                // Try to fetch the project token
                $projectkey = wfMemcKey( 'openstackmanager', 
"fulltoken-$project", $this->username );
-               $projecttoken = $wgMemc->get( $projectkey );
-               if ( is_string( $projecttoken ) ) {
-                       return $projecttoken;
+               if ( !$forcerefresh ) {
+                       $projecttoken = $wgMemc->get( $projectkey );
+                       if ( is_string( $projecttoken ) ) {
+                               return $projecttoken;
+                       }
                }
+
                $token = $this->getUnscopedToken();
                if ( !$token ) {
                        // If there's no non-project token, there's nothing to 
do, the
@@ -788,7 +791,7 @@
                $catalogJson = $wgMemc->get( $key );
                if ( !$catalogJson ) {
                        # Catalog expired; refresh
-                       $this->getProjectToken( $this->project );
+                       $this->getProjectToken( $this->project, true );
                        $catalogJson = $wgMemc->get( $key );
                }
                $serviceCatalog = json_decode( $catalogJson );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I52422b294d33eee43d82fdd4c630ad4b0442df87
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OpenStackManager
Gerrit-Branch: wmf/1.26wmf21
Gerrit-Owner: Alex Monk <kren...@gmail.com>
Gerrit-Reviewer: Alex Monk <kren...@gmail.com>
Gerrit-Reviewer: Andrew Bogott <abog...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to