From 764ec440d8594c68a6c778f58aee2d7888b89204 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 3 Nov 2017 17:53:13 +0100 Subject: [sysconfig/runmode] Deliver bare config.tgz with just global hook data when "no sysconfig" is set for a runmode --- .../runmode/baseconfig/getconfig.inc.php | 3 --- modules-available/runmode/inc/runmode.inc.php | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) (limited to 'modules-available/runmode') 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 @@ -62,6 +62,27 @@ class RunMode return true; } + /** + * @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 -- cgit v1.2.3-55-g7522