Commit 4d71f4de authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Fixes #3997 Migrated Argonaut Queue to simpleManagement, fixed action launching

parent c6bf653a
......@@ -9,15 +9,6 @@
<search>
<query>
<backend>ArgonautEvents</backend>
<filter>(&amp;(objectClass=inetOrgPerson)$TEMPLATES$NAME(|$FUNCTIONAL$SAMBA$POSIX$MAIL))</filter>
<attribute>dn</attribute>
<attribute>objectClass</attribute>
<attribute>givenName</attribute>
<attribute>sn</attribute>
<attribute>uid</attribute>
<attribute>userPassword</attribute>
</query>
<scope>auto</scope>
</search>
</filterdef>
<table style="width:100%;height:100%; vertical-align:top; text-align:left;">
<tr>
<td style="vertical-align:top; width:100%;">
<div class="contentboxh">
<p class="contentboxh">&nbsp;{$HEADLINE}&nbsp;{$SIZELIMIT}</p>
</div>
<div class="contentboxb">
<div style='background:white;padding:3px;'>
<table><tr>
<td>{$RELOAD}&nbsp;</td><td>{$SEPARATOR}&nbsp;</td><td><img src='geticon.php?context=types&icon=action&size=16' alt='' class='center'></td><td> {$ACTIONS}</td>
</tr></table>
</div>
</div>
<div style='height:4px;'>
</div>
{$LIST}
</td>
</tr>
</table>
<input type="hidden" name="ignore">
{include file={filePath file="simple-list.tpl"}}
<!--
JS to reload the progress bars.
-->
{literal}
<script type="text/javascript">
......
......@@ -59,7 +59,7 @@
<label>Status</label>
<sortAttribute>uid</sortAttribute>
<sortType>string</sortType>
<value>%{filter:filterStatus(row,STATUS,MACADDRESS,HEADERTAG,ERROR,SUBSTATUS)}</value>
<value>%{filter:filterStatus(row,STATUS,SUBSTATUS)}</value>
<export>true</export>
</column>
......@@ -110,7 +110,7 @@
</actionmenu>
<actiontriggers snapshot="true" copypaste="true">
<actiontriggers snapshot="false" copypaste="false">
<action>
<name>processNow</name>
......
<div style="font-size:18px;">
<img alt="" src="images/warning.png" align=top>&nbsp;{t}Warning{/t}
</div>
<p>
{$info}
</p>
<p>
{t}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
</p>
<p class="plugbottom">
{if $multiple}
<input type=submit name="delete_multiple_confirm" value="{msgPool type=delButton}">
{else}
<input type=submit name="delete_confirm" value="{msgPool type=delButton}">
{/if}
<input type=submit name="delete_cancel" value="{msgPool type=cancelButton}">
</p>
......@@ -121,23 +121,19 @@ class systemManagement extends simpleManagement
$headpage = $this->getHeadpage();
$event = preg_replace('/^[TS]_/', '', $action);
echo "<h1>launching action $action</h1>\n";
// Now send FAI/Argonaut events here.
if (count($target) && $this->siActive) {
$mac = array();
// Collect target mac addresses
$tD = $this->getObjectDefinitions();
$events = DaemonEvent::get_event_types();
$o_queue = new supportDaemon();
foreach ($target as $dn) {
$type = $headpage->getType($dn);
if ($tD[$type]['sendEvents']) {
$obj = $headpage->getEntry($dn);
if (isset($obj['macAddress'][0])) {
$mac[] = $obj['macAddress'][0];
}
$obj = $headpage->getEntry($dn);
if (isset($obj['macAddress'][0])) {
$mac[] = $obj['macAddress'][0];
} else {
msg_dialog::display(_('Action canceled'), sprintf(_('System %s has no mac address defined, cannot trigger action'), $dn), ERROR_DIALOG);
}
}
......@@ -147,6 +143,7 @@ class systemManagement extends simpleManagement
if ($triggered && in_array($event, array('reinstall','update'))) {
foreach ($mac as $key => $mac_address) {
if ($o_queue->is_currently_installing($mac_address)) {
msg_dialog::display(_('Action canceled'), sprintf(_('System %s is currently installing'), $dn), ERROR_DIALOG);
unset($mac[$key]);
new log('security', 'systems/'.get_class($this), '', array(), 'Skip adding "DaemonEvent::'.$type.'" for mac "'.$mac_address.'", there is already a job in progress.');
}
......@@ -184,6 +181,7 @@ class systemManagement extends simpleManagement
$o_queue->append($this->dialogObject);
if ($o_queue->is_error()) {
msg_dialog::display(_('Infrastructure service'), msgPool::siError($o_queue->get_error()), ERROR_DIALOG);
$this->closeDialogs();
} else {
$this->closeDialogs();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment