Skip to content

Commit

Permalink
Merge pull request #322 from Icinga/fix/debian-lint
Browse files Browse the repository at this point in the history
debian::dbconfig: Move to autoload location and lint it
  • Loading branch information
lbetz authored Jun 26, 2017
2 parents bec289d + 44bff1f commit 3c057a5
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 27 deletions.
15 changes: 11 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
.vagrant
.idea
## editors
/.idea/
*~
*.swp
.DS_Store

## puppet
.vagrant
modules/
spec/fixtures/
.DS_Store
pkg/

## ruby
Gemfile.lock
/.ruby-*
.bundle
vendor/
pkg/
39 changes: 20 additions & 19 deletions manifests/debian.pp → manifests/debian/dbconfig.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,21 @@
# dbconfig config for Debian or Ubuntu
if $::osfamily == 'debian' {

include ::icinga2::params
include ::icinga2::params

case $dbtype {
'mysql': {
$default_port = 3306
$path = "/etc/dbconfig-common/${::icinga2::params::ido_mysql_package}.conf"
}
'pgsql': {
$default_port = 5432
$path = "/etc/dbconfig-common/${::icinga2::params::ido_pgsql_package}.conf"
}
}
case $dbtype {
'mysql': {
$default_port = 3306
$path = "/etc/dbconfig-common/${::icinga2::params::ido_mysql_package}.conf"
}
'pgsql': {
$default_port = 5432
$path = "/etc/dbconfig-common/${::icinga2::params::ido_pgsql_package}.conf"
}
default: {
fail("Unsupported dbtype: ${dbtype}")
}
}

file_line { "dbc-${dbtype}-dbuser":
path => $path,
Expand Down Expand Up @@ -63,20 +66,18 @@
# only set port if isn't the default
if $dbport != $default_port {
file_line { "dbc-${dbtype}-dbport":
path => $path,
line => "dbc_dbport='${dbport}'",
match => '^dbc_dbport\s*=',
path => $path,
line => "dbc_dbport='${dbport}'",
match => '^dbc_dbport\s*=',
}
}
# set ssl
if $ssl {
file_line { "dbc-${dbtype}-ssl":
path => $path,
line => "dbc_ssl='true'",
match => '^dbc_ssl\s*=',
path => $path,
line => "dbc_ssl='true'",
match => '^dbc_ssl\s*=',
}
}

} # debian dbconfig

}
3 changes: 1 addition & 2 deletions manifests/feature/idomysql.pp
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,7 @@
ensure => installed,
before => Icinga2::Feature['ido-mysql'],
}
->
class { '::icinga2::debian::dbconfig':
-> class { '::icinga2::debian::dbconfig':
dbtype => 'mysql',
dbserver => $host,
dbport => $port,
Expand Down
3 changes: 1 addition & 2 deletions manifests/feature/idopgsql.pp
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@
ensure => installed,
before => Icinga2::Feature['ido-pgsql'],
}
->
class { '::icinga2::debian::dbconfig':
-> class { '::icinga2::debian::dbconfig':
dbtype => 'pgsql',
dbserver => $host,
dbport => $port,
Expand Down

0 comments on commit 3c057a5

Please sign in to comment.