summaryrefslogtreecommitdiffstats
path: root/modules-available/runmode
diff options
context:
space:
mode:
authorSimon Rettberg2017-11-03 17:53:13 +0100
committerSimon Rettberg2017-11-03 17:53:13 +0100
commit764ec440d8594c68a6c778f58aee2d7888b89204 (patch)
treee4db86bb1ef7fad95a4d12c57d1d35e36d888333 /modules-available/runmode
parent[sysconfig] Fix: Empty config.tgz modules disappeared from the list (diff)
downloadslx-admin-764ec440d8594c68a6c778f58aee2d7888b89204.tar.gz
slx-admin-764ec440d8594c68a6c778f58aee2d7888b89204.tar.xz
slx-admin-764ec440d8594c68a6c778f58aee2d7888b89204.zip
[sysconfig/runmode] Deliver bare config.tgz with just global hook data when "no sysconfig" is set for a runmode
Diffstat (limited to 'modules-available/runmode')
-rw-r--r--modules-available/runmode/baseconfig/getconfig.inc.php3
-rw-r--r--modules-available/runmode/inc/runmode.inc.php21
2 files changed, 21 insertions, 3 deletions
diff --git a/modules-available/runmode/baseconfig/getconfig.inc.php b/modules-available/runmode/baseconfig/getconfig.inc.php
index fe04b5ef..2d622fc7 100644
--- a/modules-available/runmode/baseconfig/getconfig.inc.php
+++ b/modules-available/runmode/baseconfig/getconfig.inc.php
@@ -14,9 +14,6 @@ $foofoo = function($machineUuid) {
if ($config->systemdDefaultTarget !== false) {
ConfigHolder::add('SLX_SYSTEMD_TARGET', $config->systemdDefaultTarget, 10000);
}
- if ($config->noSysconfig) {
- ConfigHolder::add('SLX_NO_CONFIG_TGZ', '1', 10000);
- }
// Disable exam mode - not sure if this is generally a good idea; for now, all modes we can think of would
// not make sense that way so do this for now
if (ConfigHolder::get('SLX_EXAM') !== false) {
diff --git a/modules-available/runmode/inc/runmode.inc.php b/modules-available/runmode/inc/runmode.inc.php
index 780f12c9..271542b8 100644
--- a/modules-available/runmode/inc/runmode.inc.php
+++ b/modules-available/runmode/inc/runmode.inc.php
@@ -63,6 +63,27 @@ class RunMode
}
/**
+ * @param string $machineuuid
+ * @param bool $detailed whether to return meta data about machine, not just machineuuid
+ * @param bool $assoc use machineuuid as array key
+ * @return false|array {'machineuuid', 'isclient', 'module', 'modeid', 'modedata',
+ * <'hostname', 'clientip', 'macaddr', 'locationid', 'lastseen'>}
+ */
+ public static function getRunMode($machineuuid, $detailed = false)
+ {
+ if ($detailed) {
+ $sel = ', m.hostname, m.clientip, m.macaddr, m.locationid, m.lastseen';
+ } else {
+ $sel = '';
+ }
+ return Database::queryFirst(
+ "SELECT m.machineuuid, r.isclient, r.module, r.modeid, r.modedata $sel
+ FROM machine m INNER JOIN runmode r USING (machineuuid)
+ WHERE m.machineuuid = :machineuuid LIMIT 1",
+ compact('machineuuid'));
+ }
+
+ /**
* @param string|\Module $module
* @param bool true = wrap in array where key is modeid
* @return array key=machineuuid, value={'machineuuid', 'modeid', 'modedata'}