Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
testing
puppet-icinga2_testing
Commits
718f807d
Commit
718f807d
authored
Dec 07, 2016
by
Markus Frosch
📣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ido_mysql: Refactor class
parent
4ce975fa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
19 deletions
+24
-19
manifests/helpers/icinga2/ido_mysql.pp
manifests/helpers/icinga2/ido_mysql.pp
+24
-19
No files found.
manifests/helpers/icinga2/ido_mysql.pp
View file @
718f807d
...
...
@@ -5,7 +5,6 @@ class icinga2_testing::helpers::icinga2::ido_mysql(
)
inherits
::
icinga2::feature::ido_mysql
{
# Install schema
# TODO: schema upgrades
if
$::osfamily
==
'Debian'
{
$_schema_create
=
'/usr/share/dbconfig-common/data/icinga2-ido-mysql/install/mysql'
}
...
...
@@ -18,36 +17,42 @@ class icinga2_testing::helpers::icinga2::ido_mysql(
$_mysql
=
"mysql -B -u '
${ido_username}
' '
${ido_dbname}
'"
Package
[
'icinga2-ido-mysql'
]
->
exec
{
'import icinga2 mysql schema'
:
user
=>
'root'
,
path
=>
$::path
,
command
=>
"
${_mysql}
< '
${_schema_create}
'"
,
unless
=>
"
${_mysql}
--execute='SELECT version FROM icinga_dbversion;'"
,
path
=>
'/sbin:/usr/sbin:/bin:/usr/bin'
,
environment
=>
[
"MYSQL_PWD=
${ido_password}
"
,
],
}
Package
[
'icinga2-ido-mysql'
]
->
Exec
[
'import icinga2 mysql schema'
]
~>
Class
[
'::icinga2::service'
]
}
~>
Class
[
'::icinga2::service'
]
file
{
'icinga2-schema-upgrade'
:
ensure
=>
file
,
owner
=>
'root'
,
group
=>
'root'
,
mode
=>
'0755'
,
path
=>
'/usr/local/bin/icinga2-schema-upgrade'
,
content
=>
file
(
'icinga2_testing/icinga2-schema-upgrade'
),
}
->
unless
defined
(
File
[
'icinga2-schema-upgrade'
])
{
file
{
'icinga2-schema-upgrade'
:
ensure
=>
file
,
owner
=>
'root'
,
group
=>
'root'
,
mode
=>
'0755'
,
path
=>
'/usr/local/bin/icinga2-schema-upgrade'
,
content
=>
file
(
'icinga2_testing/icinga2-schema-upgrade'
),
}
}
exec
{
'icinga2-schema-upgrade'
:
exec
{
'icinga2-schema-upgrade
-mysql
'
:
path
=>
$::path
,
environment
=>
[
"IDO_DATABASE=
$ido_dbname
"
,
"IDO_USERNAME=
$ido_username
"
,
"IDO_PASSWORD=
$ido_password
"
,
"IDO_DATABASE=
$
{
ido_dbname
}
"
,
"IDO_USERNAME=
$
{
ido_username
}
"
,
"IDO_PASSWORD=
$
{
ido_password
}
"
,
],
logoutput
=>
true
,
command
=>
'/usr/local/bin/icinga2-schema-upgrade'
,
onlyif
=>
'/usr/local/bin/icinga2-schema-upgrade --check'
,
require
=>
Exec
[
'import icinga2 mysql schema'
],
}
~>
Class
[
'::icinga2::service'
]
notify
=>
Class
[
'::icinga2::service'
],
require
=>
[
Exec
[
'import icinga2 mysql schema'
],
File
[
'icinga2-schema-upgrade'
],
],
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment