This repository was archived by the owner on Dec 2, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 9 files changed +25
-17
lines changed Expand file tree Collapse file tree 9 files changed +25
-17
lines changed Original file line number Diff line number Diff line change 2
2
mysql::configdir : " %{::boxen::config::configdir}/mysql"
3
3
mysql::globalconfigprefix : " %{::boxen::config::homebrewdir}"
4
4
mysql::datadir : " %{::boxen::config::datadir}/mysql"
5
+ mysql::bindir : " %{::boxen::config::homebrewdir}/bin"
5
6
mysql::executable : " %{::boxen::config::homebrewdir}/bin/mysqld_safe"
6
7
mysql::client : " %{::boxen::config::homebrewdir}/bin/mysql"
7
8
mysql::logdir : " %{::boxen::config::logdir}/mysql"
Original file line number Diff line number Diff line change 8
8
$ensure,
9
9
10
10
$configdir,
11
+ $bindir,
11
12
$globalconfigprefix,
12
13
$datadir,
13
14
$executable,
40
41
41
42
->
42
43
exec { 'init-mysql-db' :
43
- command => " mysql_install_db \
44
+ command => " ${bindir} / mysql_install_db \
44
45
--verbose \
45
46
--basedir=${globalconfigprefix} \
46
47
--datadir=${datadir} \
Original file line number Diff line number Diff line change 12
12
13
13
if $ensure == ' present' {
14
14
exec { "create mysql db ${name}" :
15
- command => " mysqladmin -h${mysql::host} -uroot -p${mysql::port} create ${name} --password=''" ,
15
+ command => " ${mysql::bindir} / mysqladmin -h${mysql::host} -uroot -p${mysql::port} create ${name} --password=''" ,
16
16
creates => " ${mysql::datadir} /${name} " ,
17
- unless => " mysql -h${mysql::host} -uroot -p${mysql::port} -e 'show databases' \
17
+ unless => " ${mysql::bindir} / mysql -h${mysql::host} -uroot -p${mysql::port} -e 'show databases' \
18
18
--password='' | grep -w '${name} '"
19
19
}
20
20
} elsif $ensure == ' absent' {
21
21
exec { "delete mysql db ${name}" :
22
- command => " mysqladmin -h${mysql::host} -uroot -p${mysql::port} drop ${name} --password=''" ,
22
+ command => " ${mysql::bindir} / mysqladmin -h${mysql::host} -uroot -p${mysql::port} drop ${name} --password=''" ,
23
23
}
24
24
}
25
25
}
Original file line number Diff line number Diff line change 10
10
$configdir = undef ,
11
11
$globalconfigprefix = undef ,
12
12
$datadir = undef ,
13
+ $bindir = undef ,
13
14
$executable = undef ,
14
15
$client = undef ,
15
16
$logdir = undef ,
30
31
$configdir ,
31
32
$globalconfigprefix ,
32
33
$datadir ,
34
+ $bindir ,
33
35
$executable ,
34
36
$client ,
35
37
$logdir ,
39
41
$port ,
40
42
$socket ,
41
43
$package ,
42
- $version
44
+ $version ,
43
45
)
44
46
45
47
validate_bool($enable )
55
57
ensure => $ensure ,
56
58
57
59
configdir => $configdir ,
60
+ bindir => $bindir ,
58
61
globalconfigprefix => $globalconfigprefix ,
59
62
datadir => $datadir ,
60
63
executable => $executable ,
78
81
79
82
~>
80
83
class { 'mysql::setup' :
84
+ bindir => $bindir ,
81
85
datadir => $datadir ,
82
86
host => $host ,
83
87
port => $port ,
Original file line number Diff line number Diff line change 1
- class mysql::setup (
1
+ class mysql::setup (
2
+ $bindir = undef ,
2
3
$datadir = undef ,
3
4
$host = undef ,
4
5
$port = undef ,
14
15
15
16
~>
16
17
exec { 'mysql-tzinfo-to-sql' :
17
- command => " mysql_tzinfo_to_sql /usr/share/zoneinfo | \
18
- mysql -u root mysql -h${host} -P${port} -S${socket} " ,
18
+ command => " ${bindir} / mysql_tzinfo_to_sql /usr/share/zoneinfo | \
19
+ ${bindir} / mysql -u root mysql -h${host} -P${port} -S${socket} " ,
19
20
provider => shell,
20
21
creates => " ${datadir} /.tz_info_created" ,
21
22
refreshonly => true
22
23
}
23
24
24
25
~>
25
26
exec { 'grant root user privileges' :
26
- command => " mysql -uroot --password='' -h${host} -P${port} -S${socket} \
27
+ command => " ${bindir} / mysql -uroot --password='' -h${host} -P${port} -S${socket} \
27
28
-e 'grant all privileges on *.* to \' root\' @\' localhost\' '" ,
28
- unless => " mysql -uroot -h${host} -P${port} \
29
+ unless => " ${bindir} / mysql -uroot -h${host} -P${port} \
29
30
-e \" select * from mysql.user where User = 'root' and Host = 'localhost'\" \
30
31
--password='' | grep root" ,
31
32
provider => shell,
Original file line number Diff line number Diff line change 19
19
20
20
if $ensure == ' present' {
21
21
exec { "create mysql user ${name}" :
22
- command => " mysql -h${mysql::host} -uroot -p${mysql::port} --password=''\
22
+ command => " ${mysql::bindir} / mysql -h${mysql::host} -uroot -p${mysql::port} --password=''\
23
23
-e \" create user '${name} '@'${host} ' identified by '${password} ';\" " ,
24
24
require => Exec[' wait-for-mysql' ],
25
- unless => " mysql -h${mysql::host} -uroot -p${mysql::port} -e 'SELECT User,Host FROM mysql.user;' \
25
+ unless => " ${mysql::bindir} / mysql -h${mysql::host} -uroot -p${mysql::port} -e 'SELECT User,Host FROM mysql.user;' \
26
26
--password='' | grep -w '${name} ' | grep -w '${host} '"
27
27
}
28
28
} elsif $ensure == ' absent' {
29
29
exec { "delete mysql user ${name}" :
30
- command => " mysql -h${mysql::host} -uroot -p${mysql::port} --password='' -e 'drop user ${name} '" ,
30
+ command => " ${mysql::bindir} / mysql -h${mysql::host} -uroot -p${mysql::port} --password='' -e 'drop user ${name} '" ,
31
31
require => Exec[' wait-for-mysql' ]
32
32
}
33
33
}
Original file line number Diff line number Diff line change 7
7
"ensure" => "present" ,
8
8
"configdir" => "/test/boxen/config/mysql" ,
9
9
"globalconfigprefix" => "/test/boxen/homebrew" ,
10
+ "bindir" => "/test/boxen/homebrew/bin"
10
11
"datadir" => "/test/boxen/data/mysql" ,
11
12
"executable" => "/test/boxen/homebrew/bin/mysql" ,
12
13
"logdir" => "/test/boxen/log/mysql" ,
Original file line number Diff line number Diff line change 14
14
it "creates the database" do
15
15
should contain_exec ( "create mysql db #{ title } " ) .
16
16
with (
17
- :command => "mysqladmin -h127.0.0.1 -uroot -p13306 create #{ title } --password=''" ,
17
+ :command => "/test/boxen/homebrew/bin/ mysqladmin -h127.0.0.1 -uroot -p13306 create #{ title } --password=''" ,
18
18
:creates => "/test/boxen/data/mysql/#{ title } "
19
19
)
20
20
end
31
31
it "destroys the database" do
32
32
should contain_exec ( "delete mysql db #{ title } " ) .
33
33
with (
34
- :command => "mysqladmin -h127.0.0.1 -uroot -p13306 drop #{ title } --password=''"
34
+ :command => "/test/boxen/homebrew/bin/ mysqladmin -h127.0.0.1 -uroot -p13306 drop #{ title } --password=''"
35
35
)
36
36
end
37
37
end
Original file line number Diff line number Diff line change 14
14
it "creates the user" do
15
15
should contain_exec ( "create mysql user #{ title } " ) .
16
16
with (
17
- :command => "mysql -h127.0.0.1 -uroot -p13306 --password=''\
17
+ :command => "/test/boxen/homebrew/bin/ mysql -h127.0.0.1 -uroot -p13306 --password=''\
18
18
-e \" create user '#{ title } '@'localhost' identified by '';\" "
19
19
)
20
20
end
31
31
it "destroys the database" do
32
32
should contain_exec ( "delete mysql user #{ title } " ) .
33
33
with (
34
- :command => "mysql -h127.0.0.1 -uroot -p13306 --password='' -e 'drop user #{ title } '"
34
+ :command => "/test/boxen/homebrew/bin/ mysql -h127.0.0.1 -uroot -p13306 --password='' -e 'drop user #{ title } '"
35
35
)
36
36
end
37
37
end
You can’t perform that action at this time.
0 commit comments