Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debian::dbconfig: Move to autoload location and lint it #322

Merged
merged 3 commits into from
Jun 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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