Andrew Bogott has uploaded a new change for review.

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

Change subject: Pass in the current wgAuth when creating an 
OpenStackNovaHostJob.
......................................................................

Pass in the current wgAuth when creating an OpenStackNovaHostJob.

This should give us a fighting chance at logging errors.

Change-Id: I1c202b6f770737ca02b3273dfee5606a4e22a6ff
---
M maintenance/createInstance.php
M nova/OpenStackNovaHostJob.php
M special/SpecialNovaInstance.php
3 files changed, 8 insertions(+), 7 deletions(-)


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

diff --git a/maintenance/createInstance.php b/maintenance/createInstance.php
index 50f4c60..a4d6ede 100644
--- a/maintenance/createInstance.php
+++ b/maintenance/createInstance.php
@@ -128,7 +128,7 @@
                        if ( $host ) {
                                $instance->setHost( $host );
                                $title = Title::newFromText("createInstance 
script");
-                               $job = new OpenStackNovaHostJob( $title, array( 
'instanceid' => $instance->getInstanceId(), 'instanceosid' => 
$instance->getInstanceOSId(), 'project' => $project, 'region' => $region ) );
+                               $job = new OpenStackNovaHostJob( $title, array( 
'instanceid' => $instance->getInstanceId(), 'instanceosid' => 
$instance->getInstanceOSId(), 'project' => $project, 'region' => $region, 
'auth' => $wgAuth ) );
                                $job->insert();
                                $image = $this->userNova->getImage( 
$instance->getImageId() );
                                $imageName = $image->getImageName();
diff --git a/nova/OpenStackNovaHostJob.php b/nova/OpenStackNovaHostJob.php
index 4f90356..e3fa00a 100644
--- a/nova/OpenStackNovaHostJob.php
+++ b/nova/OpenStackNovaHostJob.php
@@ -30,9 +30,9 @@
         */
        public function run() {
                global $wgUser;
-               global $wgAuth;
                global $wgOpenStackManagerLDAPUsername;
                global $wgOpenStackManagerLDAPUserPassword;
+               $auth = $this->params['auth'];
 
                $user = isset( $this->params['user'] )
                        ? User::newFromName( $this->params['user'] )
@@ -46,7 +46,7 @@
                $instanceosid = $this->params['instanceosid'];
                $project = $this->params['project'];
                $region = $this->params['region'];
-               $wgAuth->printDebug( "Running DNS job for $instanceid", 
NONSENSITIVE );
+               $auth->printDebug( "Running DNS job for $instanceid", 
NONSENSITIVE );
 
                $user = new OpenStackNovaUser( $wgOpenStackManagerLDAPUsername 
);
                $userNova = OpenStackNovaController::newFromUser( $user );
@@ -55,7 +55,7 @@
                $userNova->authenticate( $wgOpenStackManagerLDAPUsername, 
$wgOpenStackManagerLDAPUserPassword );
                $instance = $userNova->getInstance( $instanceosid );
                if ( ! $instance ) {
-                       $wgAuth->printDebug( "Instance doesn't exist for 
$instanceosid", NONSENSITIVE );
+                       $auth->printDebug( "Instance doesn't exist for 
$instanceosid", NONSENSITIVE );
                        # Instance no longer exists
                        return true;
                }
@@ -64,14 +64,14 @@
                if ( trim( $ip ) === '' ) {
                        # IP hasn't been assigned yet
                        # re-add to queue
-                       $wgAuth->printDebug( "Readding job for $instanceid", 
NONSENSITIVE );
+                       $auth->printDebug( "Readding job for $instanceid", 
NONSENSITIVE );
                        $job = new OpenStackNovaHostJob( $this->title, 
$this->params );
                        $job->insert();
                        return true;
                }
                $host = OpenStackNovaHost::getHostByInstanceId( $instanceid, 
$region );
                if ( ! $host ) {
-                       $wgAuth->printDebug( "Host record doesn't exist for 
$instanceid", NONSENSITIVE );
+                       $auth->printDebug( "Host record doesn't exist for 
$instanceid", NONSENSITIVE );
                        return true;
                }
                $host->setARecord( $ip );
diff --git a/special/SpecialNovaInstance.php b/special/SpecialNovaInstance.php
index 1c78ff0..1148ae5 100644
--- a/special/SpecialNovaInstance.php
+++ b/special/SpecialNovaInstance.php
@@ -641,6 +641,7 @@
         */
        function tryCreateSubmit( $formData, $entryPoint = 'internal' ) {
                global $wgUser;
+               global $wgAuth;
 
                $domain = OpenStackNovaDomain::getDomainByName( 
$formData['region'] );
                $project = $formData['project'];
@@ -663,7 +664,7 @@
                                $instance->setHost( $host );
                                OpenStackManagerEvent::storeEventInfo( 'build', 
$this->getUser(), $instance, $project );
                                $title = Title::newFromText( 
$this->getOutput()->getPageTitle() );
-                               $job = new OpenStackNovaHostJob( $title, array( 
'instanceid' => $instance->getInstanceId(), 'instanceosid' => 
$instance->getInstanceOSId(), 'project' => $project, 'region' => $region, 
'user' => $wgUser->getName() ) );
+                               $job = new OpenStackNovaHostJob( $title, array( 
'instanceid' => $instance->getInstanceId(), 'instanceosid' => 
$instance->getInstanceOSId(), 'project' => $project, 'region' => $region, 
'user' => $wgUser->getName(), 'auth' => $wgAuth ) );
                                $job->insert();
                                $image = $this->userNova->getImage( 
$instance->getImageId() );
                                $imageName = $image->getImageName();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1c202b6f770737ca02b3273dfee5606a4e22a6ff
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