Skip to content
This repository was archived by the owner on Dec 2, 2020. It is now read-only.

Commit c29c143

Browse files
committed
Fix executable paths to use a bindir
1 parent 96bebd8 commit c29c143

File tree

9 files changed

+25
-17
lines changed

9 files changed

+25
-17
lines changed

data/Darwin.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
mysql::configdir: "%{::boxen::config::configdir}/mysql"
33
mysql::globalconfigprefix: "%{::boxen::config::homebrewdir}"
44
mysql::datadir: "%{::boxen::config::datadir}/mysql"
5+
mysql::bindir: "%{::boxen::config::homebrewdir}/bin"
56
mysql::executable: "%{::boxen::config::homebrewdir}/bin/mysqld_safe"
67
mysql::client: "%{::boxen::config::homebrewdir}/bin/mysql"
78
mysql::logdir: "%{::boxen::config::logdir}/mysql"

manifests/config.pp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
$ensure,
99

1010
$configdir,
11+
$bindir,
1112
$globalconfigprefix,
1213
$datadir,
1314
$executable,
@@ -40,7 +41,7 @@
4041

4142
->
4243
exec { 'init-mysql-db':
43-
command => "mysql_install_db \
44+
command => "${bindir}/mysql_install_db \
4445
--verbose \
4546
--basedir=${globalconfigprefix} \
4647
--datadir=${datadir} \

manifests/db.pp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212

1313
if $ensure == 'present' {
1414
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=''",
1616
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' \
1818
--password='' | grep -w '${name}'"
1919
}
2020
} elsif $ensure == 'absent' {
2121
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=''",
2323
}
2424
}
2525
}

manifests/init.pp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
$configdir = undef,
1111
$globalconfigprefix = undef,
1212
$datadir = undef,
13+
$bindir = undef,
1314
$executable = undef,
1415
$client = undef,
1516
$logdir = undef,
@@ -30,6 +31,7 @@
3031
$configdir,
3132
$globalconfigprefix,
3233
$datadir,
34+
$bindir,
3335
$executable,
3436
$client,
3537
$logdir,
@@ -39,7 +41,7 @@
3941
$port,
4042
$socket,
4143
$package,
42-
$version
44+
$version,
4345
)
4446

4547
validate_bool($enable)
@@ -55,6 +57,7 @@
5557
ensure => $ensure,
5658

5759
configdir => $configdir,
60+
bindir => $bindir,
5861
globalconfigprefix => $globalconfigprefix,
5962
datadir => $datadir,
6063
executable => $executable,
@@ -78,6 +81,7 @@
7881

7982
~>
8083
class { 'mysql::setup':
84+
bindir => $bindir,
8185
datadir => $datadir,
8286
host => $host,
8387
port => $port,

manifests/setup.pp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
class mysql::setup(
1+
class mysql::setup (
2+
$bindir = undef,
23
$datadir = undef,
34
$host = undef,
45
$port = undef,
@@ -14,18 +15,18 @@
1415

1516
~>
1617
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}",
1920
provider => shell,
2021
creates => "${datadir}/.tz_info_created",
2122
refreshonly => true
2223
}
2324

2425
~>
2526
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} \
2728
-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} \
2930
-e \"select * from mysql.user where User = 'root' and Host = 'localhost'\" \
3031
--password='' | grep root",
3132
provider => shell,

manifests/user.pp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919

2020
if $ensure == 'present' {
2121
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=''\
2323
-e \"create user '${name}'@'${host}' identified by '${password}';\"",
2424
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;' \
2626
--password='' | grep -w '${name}' | grep -w '${host}'"
2727
}
2828
} elsif $ensure == 'absent' {
2929
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}'",
3131
require => Exec['wait-for-mysql']
3232
}
3333
}

spec/classes/mysql__config_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"ensure" => "present",
88
"configdir" => "/test/boxen/config/mysql",
99
"globalconfigprefix" => "/test/boxen/homebrew",
10+
"bindir" => "/test/boxen/homebrew/bin"
1011
"datadir" => "/test/boxen/data/mysql",
1112
"executable" => "/test/boxen/homebrew/bin/mysql",
1213
"logdir" => "/test/boxen/log/mysql",

spec/defines/db_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
it "creates the database" do
1515
should contain_exec("create mysql db #{title}").
1616
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=''",
1818
:creates => "/test/boxen/data/mysql/#{title}"
1919
)
2020
end
@@ -31,7 +31,7 @@
3131
it "destroys the database" do
3232
should contain_exec("delete mysql db #{title}").
3333
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=''"
3535
)
3636
end
3737
end

spec/defines/user_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
it "creates the user" do
1515
should contain_exec("create mysql user #{title}").
1616
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=''\
1818
-e \"create user '#{title}'@'localhost' identified by '';\""
1919
)
2020
end
@@ -31,7 +31,7 @@
3131
it "destroys the database" do
3232
should contain_exec("delete mysql user #{title}").
3333
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}'"
3535
)
3636
end
3737
end

0 commit comments

Comments
 (0)