diff --git a/.puppet/modules/icinga2/manifests/init.pp b/.puppet/modules/icinga2/manifests/init.pp index 26c7300a5..e5b77ad75 100644 --- a/.puppet/modules/icinga2/manifests/init.pp +++ b/.puppet/modules/icinga2/manifests/init.pp @@ -15,7 +15,7 @@ class icinga2 { include icinga_packages package { [ - 'icinga2', 'icinga2-doc', 'icinga2-debuginfo' + 'icinga2', 'icinga2-doc' ]: ensure => latest, require => Class['icinga_packages'], @@ -35,12 +35,8 @@ class icinga2 { links => follow, owner => 'icinga', group => 'icinga', - mode => 6750, + mode => '6750', } icinga2::feature { [ 'statusdata', 'command', 'compatlog' ]: } - - icinga2::feature { 'api': - ensure => absent, - } } diff --git a/.puppet/modules/icingaweb2/manifests/config/general.pp b/.puppet/modules/icingaweb2/manifests/config/general.pp index 8ccea172f..200a4f79e 100644 --- a/.puppet/modules/icingaweb2/manifests/config/general.pp +++ b/.puppet/modules/icingaweb2/manifests/config/general.pp @@ -10,7 +10,7 @@ define icingaweb2::config::general ( content => template("${source}/${name}.ini.erb"), owner => 'root', group => $web_group, - mode => 0660, + mode => '0660', replace => $replace, } } diff --git a/.puppet/modules/icingaweb2/manifests/config/module.pp b/.puppet/modules/icingaweb2/manifests/config/module.pp index 19db02250..90d98d083 100644 --- a/.puppet/modules/icingaweb2/manifests/config/module.pp +++ b/.puppet/modules/icingaweb2/manifests/config/module.pp @@ -20,7 +20,7 @@ define icingaweb2::config::module ( source => "${source}/modules/${module}/${name}.ini", owner => 'root', group => $web_group, - mode => 0660, + mode => '0660', replace => $replace, } } diff --git a/.puppet/modules/openldap/manifests/init.pp b/.puppet/modules/openldap/manifests/init.pp index 069c4a157..11cc2b42a 100644 --- a/.puppet/modules/openldap/manifests/init.pp +++ b/.puppet/modules/openldap/manifests/init.pp @@ -20,6 +20,18 @@ class openldap { service { 'slapd': ensure => running, - require => Package['openldap-servers'] + require => Package['openldap-servers'], + } + + if versioncmp($::operatingsystemmajrelease, '7') >= 0 { + ['core', 'cosine', 'inetorgperson', 'nis', 'misc', 'openldap'].each |String $schema| { + exec { "slapd-schema-${schema}": + command => "ldapadd -Y EXTERNAL -H ldapi:// -f /etc/openldap/schema/${schema}.ldif", + group => 'root', + require => Package['openldap-servers'], + unless => "test -n \"$(find /etc/openldap/slapd.d/cn=config/cn=schema/ -name cn={*}${schema}.ldif -print -quit)\"", + user => 'root', + } + } } } diff --git a/.puppet/modules/php/manifests/init.pp b/.puppet/modules/php/manifests/init.pp index dd6df83b3..788ad5df1 100644 --- a/.puppet/modules/php/manifests/init.pp +++ b/.puppet/modules/php/manifests/init.pp @@ -20,24 +20,11 @@ class php { package { 'php': ensure => latest, - require => Package['apache'], - notify => Service['apache'] - } - # TODO(el): Always executed. Should be a resource - -> exec { 'php-timezone': - command => 'sed -re $\'s#^;?(date\\.timezone =).*$#\\1 "UTC"#\' -i /etc/php.ini', notify => Service['apache'], + require => Package['apache'], } - file { '/etc/php.d/error_reporting.ini': - content => template('php/error_reporting.ini.erb'), + php::phpd { ['error_reporting', 'timezone', 'xdebug_settings' ]: require => Package['php'], - notify => Service['apache'] - } - - file { '/etc/php.d/xdebug_settings.ini': - content => template('php/xdebug_settings.ini.erb'), - require => Package['php'], - notify => Service['apache'] } } diff --git a/.puppet/modules/php/manifests/phpd.pp b/.puppet/modules/php/manifests/phpd.pp new file mode 100644 index 000000000..4d59223cb --- /dev/null +++ b/.puppet/modules/php/manifests/phpd.pp @@ -0,0 +1,21 @@ +# define: php::phpd +# +# Provision php.d config +# +# Parameters: +# +# Actions: +# +# Requires: +# +# Sample Usage: +# +define php::phpd { + + include php + + file { "/etc/php.d/$name.ini": + content => template("php/$name.ini.erb"), + notify => Service['apache'], + } +} diff --git a/.puppet/modules/php/templates/timezone.ini.erb b/.puppet/modules/php/templates/timezone.ini.erb new file mode 100644 index 000000000..51e82763b --- /dev/null +++ b/.puppet/modules/php/templates/timezone.ini.erb @@ -0,0 +1 @@ +date.timezone = "UTC" diff --git a/.puppet/profiles/icinga2_dev/manifests/init.pp b/.puppet/profiles/icinga2_dev/manifests/init.pp index 7082fe935..322480594 100644 --- a/.puppet/profiles/icinga2_dev/manifests/init.pp +++ b/.puppet/profiles/icinga2_dev/manifests/init.pp @@ -19,11 +19,15 @@ class icinga2_dev { include monitoring_test_config icinga2::config { [ - 'conf.d/test-config', 'conf.d/commands', 'constants', + 'conf.d/test-config', 'conf.d/commands', 'constants' ]: source => 'puppet:///modules/icinga2_dev', } + icinga2::feature { 'api': + ensure => absent, + } + icinga2::feature { 'ido-pgsql': ensure => absent, require => Class['icinga2_pgsql'], diff --git a/.puppet/profiles/icingaweb2_dev/files/openldap/db.ldif b/.puppet/profiles/icingaweb2_dev/files/openldap/db.ldif index eab9b7bac..03263f9c3 100644 --- a/.puppet/profiles/icingaweb2_dev/files/openldap/db.ldif +++ b/.puppet/profiles/icingaweb2_dev/files/openldap/db.ldif @@ -6,7 +6,7 @@ olcRootPW: {SSHA}N/2WMqT8q7cElh7KUQz+p9TJbjmKv/u9 replace: olcRootDN olcRootDN: cn=admin,cn=config -dn: olcDatabase={2}bdb,cn=config +dn: olcDatabase={2}hdb,cn=config changetype: modify replace: olcRootPW olcRootPW: {SSHA}MxMpLBo2/TSymoIBf/Sb5iQac7Wwiur5 diff --git a/Vagrantfile b/Vagrantfile index 198016789..11b5e2b9c 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -47,5 +47,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| puppet.module_path = [ ".puppet/modules", ".puppet/profiles" ] puppet.manifests_path = ".puppet/manifests" puppet.manifest_file = "site.pp" + puppet.options = "--parser=future" end end diff --git a/library/Icinga/Data/Paginatable.php b/library/Icinga/Data/Paginatable.php new file mode 100644 index 000000000..d9a6de397 --- /dev/null +++ b/library/Icinga/Data/Paginatable.php @@ -0,0 +1,9 @@ +query = $query; return $this; diff --git a/modules/monitoring/application/forms/Config/BackendConfigForm.php b/modules/monitoring/application/forms/Config/BackendConfigForm.php index d2fe4e938..d5a960d20 100644 --- a/modules/monitoring/application/forms/Config/BackendConfigForm.php +++ b/modules/monitoring/application/forms/Config/BackendConfigForm.php @@ -312,10 +312,15 @@ class BackendConfigForm extends ConfigForm return false; } - $resourceConfig = ResourceFactory::getResourceConfig($this->getValue('resource')); - if (! self::isValidIdoSchema($this, $resourceConfig) || !self::isValidIdoInstance($this, $resourceConfig)) { - $this->addSkipValidationCheckbox(); - return false; + if (($el = $this->getElement('skip_validation')) === null || false === $el->isChecked()) { + $resourceConfig = ResourceFactory::getResourceConfig($this->getValue('resource')); + if (! self::isValidIdoSchema($this, $resourceConfig) || !self::isValidIdoInstance($this, $resourceConfig)) { + if ($el === null) { + $this->addSkipValidationCheckbox(); + } + + return false; + } } return true; diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php index c5e9e5333..de89d23bb 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php @@ -12,6 +12,7 @@ use Icinga\Data\Filter\FilterExpression; use Icinga\Exception\IcingaException; use Icinga\Exception\NotImplementedError; use Icinga\Exception\ProgrammingError; +use Icinga\Exception\QueryException; use Icinga\Web\Session; /** @@ -855,7 +856,6 @@ abstract class IdoQuery extends DbQuery protected function customvarNameToTypeName($customvar) { $customvar = strtolower($customvar); - // TODO: Improve this: if (! preg_match('~^_(host|service)_([a-zA-Z0-9_]+)$~', $customvar, $m)) { throw new ProgrammingError( 'Got invalid custom var: "%s"', @@ -870,11 +870,20 @@ abstract class IdoQuery extends DbQuery return array_key_exists($name, $this->joinedVirtualTables); } + /** + * Get the query column of a already joined custom variable + * + * @param string $customvar + * + * @return string + * @throws QueryException If the custom variable has not been joined + */ protected function getCustomvarColumnName($customvar) { - if (isset($this->customVars[($customvar = strtolower($customvar))])) { - $this->customVars[strtolower($customvar)] . '.varvalue'; + if (! isset($this->customVars[($customvar = strtolower($customvar))])) { + throw new QueryException('Custom variable %s has not been joined', $customvar); } + return $this->customVars[$customvar] . '.varvalue'; } public function aliasToColumnName($alias) @@ -882,9 +891,19 @@ abstract class IdoQuery extends DbQuery return $this->idxAliasColumn[$alias]; } + /** + * Get the alias of a column expression as defined in the {@link $columnMap} property. + * + * @param string $alias Potential custom alias + * + * @return string + */ public function customAliasToAlias($alias) { - return $this->idxCustomAliases[$alias]; + if (isset($this->idxCustomAliases[$alias])) { + return $this->idxCustomAliases[$alias]; + } + return $alias; } /**