Skip to content

Commit

Permalink
chdir into :Deploy_to to run deploy then come out of it later.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ezra Zygmuntowicz committed Jun 8, 2009
1 parent 2b8a8d8 commit 5dbd039
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
20 changes: 12 additions & 8 deletions lib/chef-deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions lib/chef-deploy/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5dbd039

Please sign in to comment.