summaryrefslogtreecommitdiffstats
path: root/inc/trigger.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2014-06-23 19:49:05 +0200
committerSimon Rettberg2014-06-23 19:49:05 +0200
commit4d3b6c18bbb43c95974ef2cd892f94209cffb589 (patch)
tree12935292ab6efe7e0c759722f7062a61773e6e6e /inc/trigger.inc.php
parentSome minor html fixes/improvements (diff)
downloadslx-admin-4d3b6c18bbb43c95974ef2cd892f94209cffb589.tar.gz
slx-admin-4d3b6c18bbb43c95974ef2cd892f94209cffb589.tar.xz
slx-admin-4d3b6c18bbb43c95974ef2cd892f94209cffb589.zip
Rebuild AD config modules if server IP changed...
Also add vmchooser URL to getconfig, fix shell string escaping
Diffstat (limited to 'inc/trigger.inc.php')
-rw-r--r--inc/trigger.inc.php43
1 files changed, 39 insertions, 4 deletions
diff --git a/inc/trigger.inc.php b/inc/trigger.inc.php
index 7ab7d5b1..e6f7cd31 100644
--- a/inc/trigger.inc.php
+++ b/inc/trigger.inc.php
@@ -72,10 +72,12 @@ class Trigger
}
/**
- *
+ * Launch all ldadp instances that need to be running.
+ *
+ * @param string $parent if not NULL, this will be the parent task of the launch-task
* @return boolean|string false on error, id of task otherwise
*/
- public static function ldadp()
+ public static function ldadp($parent = NULL)
{
$res = Database::simpleQuery("SELECT moduleid, configtgz.filepath FROM configtgz_module"
. " INNER JOIN configtgz_x_module USING (moduleid)"
@@ -90,17 +92,50 @@ class Trigger
}
}
$task = Taskmanager::submit('LdadpLauncher', array(
- 'ids' => $id
+ 'ids' => $id,
+ 'parentTask' => $parent,
+ 'failOnParentFail' => false
));
if (!isset($task['id']))
return false;
return $task['id'];
}
+ /**
+ * To be called if the server ip changes, as it's embedded in the AD module configs.
+ * This will then recreate all AD tgz modules.
+ */
+ public static function rebuildAdModules()
+ {
+ $res = Database::simpleQuery("SELECT moduleid, filepath, content FROM configtgz_module"
+ . " WHERE moduletype = 'AD_AUTH'");
+ if ($res->rowCount() === 0)
+ return;
+
+ $task = Taskmanager::submit('LdadpLauncher', array('ids' => array())); // Stop all running instances
+ $parent = isset($task['id']) ? $task['id'] : NULL;
+ while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ $config = json_decode($row['contents']);
+ $config['proxyip'] = Property::getServerIp();
+ $config['moduleid'] = $row['moduleid'];
+ $config['filename'] = $row['filepath'];
+ $config['parentTask'] = $parent;
+ $config['failOnParentFail'] = false;
+ $task = Taskmanager::submit('CreateAdConfig', $config);
+ $parent = isset($task['id']) ? $task['id'] : NULL;
+ }
+
+ }
+
+ /**
+ * Mount the VM store into the server.
+ *
+ * @return array task status of mount procedure, or false on error
+ */
public static function mount()
{
$vmstore = Property::getVmStoreConfig();
- if (!is_array($vmstore)) return;
+ if (!is_array($vmstore)) return false;
$storetype = $vmstore['storetype'];
if ($storetype === 'nfs') $addr = $vmstore['nfsaddr'];
if ($storetype === 'cifs') $addr = $vmstore['cifsaddr'];