Merge branch 'master' into feature/ldap-auth-backend-discovery-9602

This commit is contained in:
Johannes Meyer 2015-07-24 10:52:14 +02:00
commit 56759e7f21
16 changed files with 95 additions and 42 deletions

View File

@ -15,7 +15,7 @@ class icinga2 {
include icinga_packages include icinga_packages
package { [ package { [
'icinga2', 'icinga2-doc', 'icinga2-debuginfo' 'icinga2', 'icinga2-doc'
]: ]:
ensure => latest, ensure => latest,
require => Class['icinga_packages'], require => Class['icinga_packages'],
@ -35,12 +35,8 @@ class icinga2 {
links => follow, links => follow,
owner => 'icinga', owner => 'icinga',
group => 'icinga', group => 'icinga',
mode => 6750, mode => '6750',
} }
icinga2::feature { [ 'statusdata', 'command', 'compatlog' ]: } icinga2::feature { [ 'statusdata', 'command', 'compatlog' ]: }
icinga2::feature { 'api':
ensure => absent,
}
} }

View File

@ -10,7 +10,7 @@ define icingaweb2::config::general (
content => template("${source}/${name}.ini.erb"), content => template("${source}/${name}.ini.erb"),
owner => 'root', owner => 'root',
group => $web_group, group => $web_group,
mode => 0660, mode => '0660',
replace => $replace, replace => $replace,
} }
} }

View File

@ -20,7 +20,7 @@ define icingaweb2::config::module (
source => "${source}/modules/${module}/${name}.ini", source => "${source}/modules/${module}/${name}.ini",
owner => 'root', owner => 'root',
group => $web_group, group => $web_group,
mode => 0660, mode => '0660',
replace => $replace, replace => $replace,
} }
} }

View File

@ -20,6 +20,18 @@ class openldap {
service { 'slapd': service { 'slapd':
ensure => running, 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',
}
}
} }
} }

View File

@ -20,24 +20,11 @@ class php {
package { 'php': package { 'php':
ensure => latest, 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'], notify => Service['apache'],
require => Package['apache'],
} }
file { '/etc/php.d/error_reporting.ini': php::phpd { ['error_reporting', 'timezone', 'xdebug_settings' ]:
content => template('php/error_reporting.ini.erb'),
require => Package['php'], 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']
} }
} }

View File

@ -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'],
}
}

View File

@ -0,0 +1 @@
date.timezone = "UTC"

View File

@ -19,11 +19,15 @@ class icinga2_dev {
include monitoring_test_config include monitoring_test_config
icinga2::config { [ icinga2::config { [
'conf.d/test-config', 'conf.d/commands', 'constants', 'conf.d/test-config', 'conf.d/commands', 'constants'
]: ]:
source => 'puppet:///modules/icinga2_dev', source => 'puppet:///modules/icinga2_dev',
} }
icinga2::feature { 'api':
ensure => absent,
}
icinga2::feature { 'ido-pgsql': icinga2::feature { 'ido-pgsql':
ensure => absent, ensure => absent,
require => Class['icinga2_pgsql'], require => Class['icinga2_pgsql'],

View File

@ -6,7 +6,7 @@ olcRootPW: {SSHA}N/2WMqT8q7cElh7KUQz+p9TJbjmKv/u9
replace: olcRootDN replace: olcRootDN
olcRootDN: cn=admin,cn=config olcRootDN: cn=admin,cn=config
dn: olcDatabase={2}bdb,cn=config dn: olcDatabase={2}hdb,cn=config
changetype: modify changetype: modify
replace: olcRootPW replace: olcRootPW
olcRootPW: {SSHA}MxMpLBo2/TSymoIBf/Sb5iQac7Wwiur5 olcRootPW: {SSHA}MxMpLBo2/TSymoIBf/Sb5iQac7Wwiur5

1
Vagrantfile vendored
View File

@ -47,5 +47,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
puppet.module_path = [ ".puppet/modules", ".puppet/profiles" ] puppet.module_path = [ ".puppet/modules", ".puppet/profiles" ]
puppet.manifests_path = ".puppet/manifests" puppet.manifests_path = ".puppet/manifests"
puppet.manifest_file = "site.pp" puppet.manifest_file = "site.pp"
puppet.options = "--parser=future"
end end
end end

View File

@ -0,0 +1,9 @@
<?php
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
namespace Icinga\Data;
use Countable;
interface Paginatable extends Limitable, Countable {};

View File

@ -3,6 +3,4 @@
namespace Icinga\Data; namespace Icinga\Data;
use Countable; interface QueryInterface extends Fetchable, Filterable, Paginatable, Sortable {};
interface QueryInterface extends Fetchable, Filterable, Limitable, Sortable, Countable {};

View File

@ -4,7 +4,7 @@
namespace Icinga\Exception; namespace Icinga\Exception;
/** /**
* Exception thrown if a query contains invalid parameters * Exception thrown if a query encountered an error
*/ */
class QueryException extends IcingaException class QueryException extends IcingaException
{ {

View File

@ -3,7 +3,7 @@
namespace Icinga\Web\Widget; namespace Icinga\Web\Widget;
use Icinga\Data\QueryInterface; use Icinga\Data\Paginatable;
use Icinga\Exception\ProgrammingError; use Icinga\Exception\ProgrammingError;
/** /**
@ -14,7 +14,7 @@ class Paginator extends AbstractWidget
/** /**
* The query the paginator widget is created for * The query the paginator widget is created for
* *
* @var QueryInterface * @var Paginatable
*/ */
protected $query; protected $query;
@ -28,11 +28,11 @@ class Paginator extends AbstractWidget
/** /**
* Set the query to create the paginator widget for * Set the query to create the paginator widget for
* *
* @param QueryInterface $query * @param Paginatable $query
* *
* @return $this * @return $this
*/ */
public function setQuery(QueryInterface $query) public function setQuery(Paginatable $query)
{ {
$this->query = $query; $this->query = $query;
return $this; return $this;

View File

@ -312,11 +312,16 @@ class BackendConfigForm extends ConfigForm
return false; return false;
} }
if (($el = $this->getElement('skip_validation')) === null || false === $el->isChecked()) {
$resourceConfig = ResourceFactory::getResourceConfig($this->getValue('resource')); $resourceConfig = ResourceFactory::getResourceConfig($this->getValue('resource'));
if (! self::isValidIdoSchema($this, $resourceConfig) || !self::isValidIdoInstance($this, $resourceConfig)) { if (! self::isValidIdoSchema($this, $resourceConfig) || !self::isValidIdoInstance($this, $resourceConfig)) {
if ($el === null) {
$this->addSkipValidationCheckbox(); $this->addSkipValidationCheckbox();
}
return false; return false;
} }
}
return true; return true;
} }

View File

@ -12,6 +12,7 @@ use Icinga\Data\Filter\FilterExpression;
use Icinga\Exception\IcingaException; use Icinga\Exception\IcingaException;
use Icinga\Exception\NotImplementedError; use Icinga\Exception\NotImplementedError;
use Icinga\Exception\ProgrammingError; use Icinga\Exception\ProgrammingError;
use Icinga\Exception\QueryException;
use Icinga\Web\Session; use Icinga\Web\Session;
/** /**
@ -855,7 +856,6 @@ abstract class IdoQuery extends DbQuery
protected function customvarNameToTypeName($customvar) protected function customvarNameToTypeName($customvar)
{ {
$customvar = strtolower($customvar); $customvar = strtolower($customvar);
// TODO: Improve this:
if (! preg_match('~^_(host|service)_([a-zA-Z0-9_]+)$~', $customvar, $m)) { if (! preg_match('~^_(host|service)_([a-zA-Z0-9_]+)$~', $customvar, $m)) {
throw new ProgrammingError( throw new ProgrammingError(
'Got invalid custom var: "%s"', 'Got invalid custom var: "%s"',
@ -870,11 +870,20 @@ abstract class IdoQuery extends DbQuery
return array_key_exists($name, $this->joinedVirtualTables); 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) protected function getCustomvarColumnName($customvar)
{ {
if (isset($this->customVars[($customvar = strtolower($customvar))])) { if (! isset($this->customVars[($customvar = strtolower($customvar))])) {
$this->customVars[strtolower($customvar)] . '.varvalue'; throw new QueryException('Custom variable %s has not been joined', $customvar);
} }
return $this->customVars[$customvar] . '.varvalue';
} }
public function aliasToColumnName($alias) public function aliasToColumnName($alias)
@ -882,10 +891,20 @@ abstract class IdoQuery extends DbQuery
return $this->idxAliasColumn[$alias]; 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) public function customAliasToAlias($alias)
{ {
if (isset($this->idxCustomAliases[$alias])) {
return $this->idxCustomAliases[$alias]; return $this->idxCustomAliases[$alias];
} }
return $alias;
}
/** /**
* Create a sub query * Create a sub query