mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-30 09:14:09 +02:00
Db: add 'master' fallback for single-zone setups
This makes life easier for many users with simple setups as it would silently use a single non-global zone as the preferred deployment zone per default. fixes #11228
This commit is contained in:
parent
f1c787fa0c
commit
44b9142165
@ -47,7 +47,22 @@ class Db extends DbConnection
|
||||
|
||||
public function getMasterZoneName()
|
||||
{
|
||||
return $this->getSetting('master_zone', 'master');
|
||||
if ($zone = $this->getSetting('master_zone')) {
|
||||
return $zone;
|
||||
}
|
||||
|
||||
$db = $this->db();
|
||||
$query = $db->select()
|
||||
->from('icinga_zone', 'object_name')
|
||||
->where('is_global = ?', 'n');
|
||||
|
||||
$zones = $db->fetchCol($query);
|
||||
|
||||
if (count($zones) === 1) {
|
||||
return $zones[0];
|
||||
}
|
||||
|
||||
return 'master';
|
||||
}
|
||||
|
||||
public function getDefaultGlobalZoneName()
|
||||
|
Loading…
x
Reference in New Issue
Block a user