Skip to content

Instantly share code, notes, and snippets.

@ezmobius
Created April 30, 2009 19:08
Show Gist options
  • Select an option

  • Save ezmobius/104626 to your computer and use it in GitHub Desktop.

Select an option

Save ezmobius/104626 to your computer and use it in GitHub Desktop.
diff --git a/lib/chef-deploy/cached_deploy.rb b/lib/chef-deploy/cached_deploy.rb
index f9ea7b4..9226497 100644
--- a/lib/chef-deploy/cached_deploy.rb
+++ b/lib/chef-deploy/cached_deploy.rb
@@ -11,6 +11,7 @@ class CachedDeploy
if @configuration[:revision] == ''
@configuration[:revision] = source.query_revision(@configuration[:branch]) {|cmd| ru
end
+ return if check_current_revision_and_noop_if_same(@configuration[:revision])
Chef::Log.info "deploying branch: #{@configuration[:branch]} rev: #{@configuration[:rev
Chef::Log.info "updating the cached checkout"
run(update_repository_cache)
@@ -46,7 +47,12 @@ class CachedDeploy
resources << r
end
resources.each do |r|
- r.run_action(:install)
+ begin
+ r.run_action(:install)
+ rescue Chef::Exception::Exec => e
+ Chef::Log.info("Error installing gem: #{r.package_name} version: #{r.version}")
+ raise e
+ end
end
end
end
@@ -73,6 +79,12 @@ class CachedDeploy
false
end
+ def check_current_revision_and_noop_if_same(newrev)
+ IO.read("#{latest_release}/REVISION").chomp == newrev
+ rescue
+ false
+ end
+
# before_symlink
# before_restart
def callback(what)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment