Ajoute l'aide pour quelqu'un qui veux scripter le démarrage ou l'arret d'une vm
This commit is contained in:
parent
a98688768a
commit
a24dab4a0b
|
@ -1,21 +1,35 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once("../class/config.php");
|
require_once("../class/config.php");
|
||||||
include_once("head.php");
|
|
||||||
|
|
||||||
$fields = array (
|
$fields = array (
|
||||||
"action" => array ("get", "string", ''),
|
"action" => array ("get", "string", ''),
|
||||||
|
"script" => array ("get", "boolean", 0),
|
||||||
);
|
);
|
||||||
getFields($fields);
|
getFields($fields);
|
||||||
|
|
||||||
if (in_array($action, array('start', 'stop', 'monit'))) {
|
if (in_array($action, array('start', 'stop', 'monit'))) {
|
||||||
$res = $hooks->invoke($action, array(), 'lxc');
|
$res = $hooks->invoke($action, array(), 'lxc');
|
||||||
printvar($res);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$infos = $lxc->getvm();
|
$infos = $lxc->getvm();
|
||||||
|
|
||||||
|
if ($script) {
|
||||||
|
// FIXME afficher les variables pertinentes de manière pertinente pour quelqu'un qui veux scripter :)
|
||||||
|
print_r($infos);
|
||||||
|
if (isset($res)) print_r($res);
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
# Show the header after the "if script" ;)
|
||||||
|
include_once("head.php");
|
||||||
|
|
||||||
|
# Debug
|
||||||
|
echo "<fieldset><legend>debug</legend>res<br/>";
|
||||||
|
if (isset($res)) { printvar($res); }
|
||||||
|
echo "infos getvm";
|
||||||
printvar($infos);
|
printvar($infos);
|
||||||
|
echo "</fieldset>";
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<h3><?php __('Console access'); ?></h3>
|
<h3><?php __('Console access'); ?></h3>
|
||||||
|
@ -49,6 +63,24 @@ printvar($infos);
|
||||||
} // empty infos ?>
|
} // empty infos ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
<hr/>
|
||||||
|
<br/>
|
||||||
|
<fieldset><legend><?php __("Tips");?></legend>
|
||||||
|
<?php __("You can script the launch the console access in command line by using this url:"); ?>
|
||||||
|
<pre>
|
||||||
|
http://<?php echo $mem->user['login'].':ALTERNC_PASSWORD@'.$host.'/vm.php?http_auth=1&script=1&action=start' ?>
|
||||||
|
</pre>
|
||||||
|
<?php __("You can halt the vm by using:"); ?>
|
||||||
|
<pre>
|
||||||
|
http://<?php echo $mem->user['login'].':ALTERNC_PASSWORD@'.$host.'/vm.php?http_auth=1&script=1&action=stop' ?>
|
||||||
|
</pre>
|
||||||
|
<?php __("And you can see existing vm informations (if exist) by using:"); ?>
|
||||||
|
<pre>
|
||||||
|
http://<?php echo $mem->user['login'].':ALTERNC_PASSWORD@'.$host.'/vm.php?http_auth=1&script=1' ?>
|
||||||
|
</pre>
|
||||||
|
</fieldset>
|
||||||
<?php
|
<?php
|
||||||
include_once("foot.php");
|
include_once("foot.php");
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -90,7 +90,7 @@ class m_lxc implements vm
|
||||||
|
|
||||||
$res = $this->sendMessage('start', $user, $pass, $uid);
|
$res = $this->sendMessage('start', $user, $pass, $uid);
|
||||||
if ($res === FALSE)
|
if ($res === FALSE)
|
||||||
return $this->error[0];
|
return $this->error;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$data = unserialize($res);
|
$data = unserialize($res);
|
||||||
|
|
|
@ -238,7 +238,7 @@ class m_mem {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ($_REQUEST["username"] && $_REQUEST["password"]) {
|
if ($_REQUEST["username"] && $_REQUEST["password"]) {
|
||||||
return $this->login($_REQUEST["username"],$_REQUEST["password"],$_REQUEST["restrictip"]);
|
return $this->login($_REQUEST["username"],$_REQUEST["password"], (isset($_REQUEST["restrictip"])?$_REQUEST["restrictip"]:0) );
|
||||||
}
|
}
|
||||||
} // end isset
|
} // end isset
|
||||||
$_COOKIE["session"]=isset($_COOKIE["session"])?addslashes($_COOKIE["session"]):"";
|
$_COOKIE["session"]=isset($_COOKIE["session"])?addslashes($_COOKIE["session"]):"";
|
||||||
|
|
Loading…
Reference in New Issue