-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Labels
Description
To ensure the Database is reachable before some commands (such as setuping a new Drupal instance).
namespace :db do
desc "Ensure the Database is reachable"
task :check do
on roles(:app) do
within release_path.join(fetch(:app_path)) do
output = capture(:drush, "status")
dbstatus = false
output.each_line do |line|
if line.include?("Database") && line.include?("Connected")
dbstatus = true
end
end
if dbstatus == false
sqlconnect = capture(:drush, "sql:connect")
raise "The Database seems not reachable. Be sure the following SQL connection is valid '#{sqlconnect}'."
end
end
end
end