Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fail in an obvious manner when deploy keys are missing

  • Loading branch information...
commit 5c14e1c394f55e0179d0b65f06ea664e3ea255a1 1 parent 56a561e
Jon Crosby jcrosby authored
Showing with 15 additions and 1 deletion.
  1. +15 −1 lib/chef-deploy/git.rb
16 lib/chef-deploy/git.rb
@@ -102,7 +102,12 @@ def query_revision(revision)
raise ArgumentError, "Deploying remote branches is no longer supported. Specify the remote branch as a local branch for the git repository you're deploying from (ie: '#{revision.gsub('origin/', '')}' rather than '#{revision}')." if revision =~ /^origin\//
return revision if revision =~ /^[0-9a-f]{40}$/
command = scm('ls-remote', configuration[:repository], revision)
- result = yield(command)
+ 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.")
+ end
rev, ref = result.split(/[\t\n]/)
newrev = nil
if ref.sub(/refs\/.*?\//, '').strip == revision
@@ -131,4 +136,13 @@ def origin
def verbose
nil#configuration[:scm_verbose] ? nil : "-q"
+ # Build an error string that stands out in a log file
+ def obvious_error(message)
+ "#{stars}\n#{message}#{stars}"
+ end
+ def stars
+ ("\n"+'*'*80)*2
+ end
Please sign in to comment.
Something went wrong with that request. Please try again.