Settings: fix global zone defaults and settings
This commit is contained in:
parent
fe249a18be
commit
bf2b90fd6c
|
@ -23,13 +23,7 @@ class SettingsForm extends DirectorForm
|
|||
. ' environment.'
|
||||
)
|
||||
);
|
||||
|
||||
$globalZones = array(
|
||||
null => sprintf(
|
||||
$this->translate('%s (default)'),
|
||||
$settings->getDefaultValue('default_global_zone')
|
||||
)
|
||||
);
|
||||
$globalZones = $this->eventuallyConfiguredEnum('default_global_zone', $this->enumGlobalZones());
|
||||
|
||||
$this->addElement('select', 'default_global_zone', array(
|
||||
'label' => $this->translate('Default global zone'),
|
||||
|
@ -158,6 +152,19 @@ class SettingsForm extends DirectorForm
|
|||
return $this;
|
||||
}
|
||||
|
||||
protected function enumGlobalZones()
|
||||
{
|
||||
$db = $this->settings->getDb();
|
||||
$zones = $db->fetchCol(
|
||||
$db->select()->from('icinga_zone', 'object_name')
|
||||
->where('disabled = ?', 'n')
|
||||
->where('is_global = ?', 'y')
|
||||
->order('object_name')
|
||||
);
|
||||
|
||||
return array_combine($zones, $zones);
|
||||
}
|
||||
|
||||
public function onSuccess()
|
||||
{
|
||||
try {
|
||||
|
|
|
@ -23,7 +23,7 @@ class Settings
|
|||
'activation_script_v1' => null,
|
||||
'self-service/agent_name' => 'fqdn',
|
||||
'self-service/transform_hostname' => '0',
|
||||
'self-service/global_zones' => ['director_global'],
|
||||
'self-service/global_zones' => ['director-global'],
|
||||
// 'experimental_features' => null, // 'allow'
|
||||
// 'master_zone' => null,
|
||||
];
|
||||
|
@ -39,6 +39,22 @@ class Settings
|
|||
$this->db = $connection->getDbAdapter();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Db
|
||||
*/
|
||||
public function getConnection()
|
||||
{
|
||||
return $this->connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Zend_Db_Adapter_Abstract
|
||||
*/
|
||||
public function getDb()
|
||||
{
|
||||
return $this->db;
|
||||
}
|
||||
|
||||
public function get($key, $default = null)
|
||||
{
|
||||
if (null === ($value = $this->getStoredValue($key, $default))) {
|
||||
|
|
Loading…
Reference in New Issue