Permalink
Browse files

chdir into :Deploy_to to run deploy then come out of it later.

  • Loading branch information...
1 parent 2b8a8d8 commit 5dbd0399ed3420696ee226e2e238d6586022284b Ezra Zygmuntowicz committed Jun 8, 2009
Showing with 16 additions and 12 deletions.
  1. +12 −8 lib/chef-deploy.rb
  2. +4 −4 lib/chef-deploy/git.rb
View
@@ -182,17 +182,21 @@ def load_current_resource
end
def action_deploy
- Chef::Log.level(:debug)
- Chef::Log.info "Running a new deploy\nto: #{@new_resource.name}\nrepo: #{@new_resource.repo}"
- @dep.deploy
- Chef::Log.level(Chef::Config[:log_level])
+ Dir.chdir(@new_resource.name) do
+ Chef::Log.level(:debug)
+ Chef::Log.info "Running a new deploy\nto: #{@new_resource.name}\nrepo: #{@new_resource.repo}"
+ @dep.deploy
+ Chef::Log.level(Chef::Config[:log_level])
+ end
end
def action_rollback
- Chef::Log.level(:debug)
- Chef::Log.info "Rolling back deploy\nto: #{@new_resource.name}\nrepo: #{@new_resource.repo}"
- @dep.rollback
- Chef::Log.level(Chef::Config[:log_level])
+ Dir.chdir(@new_resource.name) do
+ Chef::Log.level(:debug)
+ Chef::Log.info "Rolling back deploy\nto: #{@new_resource.name}\nrepo: #{@new_resource.repo}"
+ @dep.rollback
+ Chef::Log.level(Chef::Config[:log_level])
+ end
end
end
View
@@ -105,8 +105,8 @@ def query_revision(revision)
result = nil
begin
result = yield(command)
- rescue Exception
- raise obvious_error("Could not access the remote Git repository. If this is a private repository, please verify that the deploy key for your application has been added to your remote Git account.")
+ rescue ChefDeployFailure => e
+ raise obvious_error("Could not access the remote Git repository. If this is a private repository, please verify that the deploy key for your application has been added to your remote Git account.", e)
end
rev, ref = result.split(/[\t\n]/)
newrev = nil
@@ -138,8 +138,8 @@ def verbose
end
# Build an error string that stands out in a log file
- def obvious_error(message)
- "#{stars}\n#{message}#{stars}"
+ def obvious_error(message, e)
+ "#{stars}\n#{message}\n#{stars}\n#{e.message}#{stars}"
end
def stars

0 comments on commit 5dbd039

Please sign in to comment.