You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by jf...@apache.org on 2014/11/04 20:55:13 UTC
svn commit: r1636708 - /vcl/trunk/web/.ht-inc/computer.php
Author: jfthomps
Date: Tue Nov 4 19:55:12 2014
New Revision: 1636708
URL: http://svn.apache.org/r1636708
Log:
VCL-776 - rework resource code to have a base class for all resources and inheriting classes for each resource type
computer.php: modified AJsubmitCompStateChange: $resources['managementnode'] could be empty, causing $semmnid to be null, which was later passed to retryGetSemaphore; added check for it being empty, and if so, to get a management node id a different way; if that is empty, send an error to the user
Modified:
vcl/trunk/web/.ht-inc/computer.php
Modified: vcl/trunk/web/.ht-inc/computer.php
URL: http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/computer.php?rev=1636708&r1=1636707&r2=1636708&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/computer.php (original)
+++ vcl/trunk/web/.ht-inc/computer.php Tue Nov 4 19:55:12 2014
@@ -3200,8 +3200,19 @@ class Computer extends Resource {
$tmp = array_keys($resources['image']);
$semimageid = $tmp[0];
$semrevid = getProductionRevisionid($semimageid);
- $tmp = array_keys($resources['managementnode']);
- $semmnid = $tmp[0];
+ if(! empty($resources['managementnode'])) {
+ $tmp = array_keys($resources['managementnode']);
+ $semmnid = $tmp[0];
+ }
+ else {
+ $allmns = array_keys(getManagementNodes('future'));
+ if(empty($allmns)) {
+ $ret = array('status' => 'error', 'errormsg' => 'No management nodes are available for controlling the submitted computers.');
+ sendJSON($ret);
+ return;
+ }
+ $semmnid = $allmns[0];
+ }
if($newstateid == 2) {
$fails = array('provnone' => array(),