Skip to content
This repository was archived by the owner on Dec 2, 2020. It is now read-only.
Open
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
6 changes: 4 additions & 2 deletions manifests/user.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
}
} elsif $ensure == 'absent' {
exec { "delete mysql user ${name}":
command => "mysql -uroot -p13306 --password='' -e 'drop user ${name}'",
require => Exec['wait-for-mysql']
command => "mysql -uroot -p13306 --password='' -e 'drop user \'${name}\'@\'${host}\''",
require => Exec['wait-for-mysql'],
onlyif => "mysql -uroot -p13306 -e 'SELECT User,Host FROM mysql.user;' \
--password='' | grep -w '${name}' | grep -w '${host}'"
}
}
}
2 changes: 1 addition & 1 deletion spec/defines/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
it "destroys the database" do
should contain_exec("delete mysql user #{title}").
with(
:command => "mysql -uroot -p13306 --password='' -e 'drop user #{title}'"
:command => "mysql -uroot -p13306 --password='' -e 'drop user \'#{title}\'@\'localhost\''"
)
end
end
Expand Down