Skip to content

Instantly share code, notes, and snippets.

@pmocek
Created February 7, 2013 19:30
Show Gist options
  • Save pmocek/4733480 to your computer and use it in GitHub Desktop.
Save pmocek/4733480 to your computer and use it in GitHub Desktop.
Chef deploy_revision provider used in application_php fails, seemingly attempting to use home dir of apache user for SSH known_hosts when running git ls-remote
[2013-02-07T19:08:14+00:00] INFO: Processing deploy_revision[my_app] action deploy (/tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/providers/default.rb line 122)
================================================================================
Error executing action `deploy` on resource 'deploy_revision[my_app]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '128'
---- Begin output of git ls-remote [email protected]:my_org/my_app.git HEAD ----
STDOUT:
STDERR: Could not create directory '/var/www/.ssh'.
Failed to add the host to the list of known hosts (/var/www/.ssh/known_hosts).
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
---- End output of git ls-remote [email protected]:my_org/my_app.git HEAD ----
Ran git ls-remote [email protected]:my_org/my_app.git HEAD returned 128
Resource Declaration:
---------------------
# In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/providers/default.rb
122: @deploy_resource = send(new_resource.strategy.to_sym, new_resource.name) do
123: action force ? :force_deploy : :deploy
124: scm_provider new_resource.scm_provider
125: revision new_resource.revision
126: repository new_resource.repository
127: enable_submodules new_resource.enable_submodules
128: user new_resource.owner
129: group new_resource.group
130: deploy_to new_resource.path
131: ssh_wrapper "#{new_resource.path}/deploy-ssh-wrapper" if new_resource.deploy_key
132: shallow_clone true
133: rollback_on_error new_resource.rollback_on_error
134: all_environments = ([new_resource.environment]+new_resource.sub_resources.map{|res| res.environment}).inject({}){|acc, val| acc.merge(val)}
135: environment all_environments
136: migrate new_resource.migrate
137: all_migration_commands = ([new_resource.migration_command]+new_resource.sub_resources.map{|res| res.migration_command}).select{|cmd| cmd && !cmd.empty?}
138: migration_command all_migration_commands.join(' && ')
139: restart_command do
140: ([new_resource]+new_resource.sub_resources).each do |res|
141: cmd = res.restart_command
142: if cmd.is_a? Proc
143: version = Chef::Version.new(Chef::VERSION)
144: provider = if version.major > 10 || version.minor >= 14
145: Chef::Platform.provider_for_resource(res, :nothing)
146: else
147: Chef::Platform.provider_for_resource(res)
148: end
149: provider.load_current_resource
150: provider.instance_eval(&cmd)
151: elsif cmd && !cmd.empty?
152: execute cmd do
153: user new_resource.owner
154: group new_resource.group
155: environment all_environments
156: end
157: end
158: end
159: end
Compiled Resource:
------------------
# Declared in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/providers/default.rb:122:in `run_deploy'
deploy_revision("my_app") do
provider Chef::Provider::Deploy::Revision
action [:deploy]
retries 0
retry_delay 2
deploy_to "/srv/my_app"
repository_cache "cached-copy"
revision "HEAD"
rollback_on_error true
remote "origin"
shallow_clone true
scm_provider Chef::Provider::Git
keep_releases 5
cookbook_name :my_app
repo "[email protected]:my_org/my_app.git"
user "apache"
group "apache"
git_ssh_wrapper "/srv/my_app/deploy-ssh-wrapper"
restart_command #<Proc:0x00000002797410@/tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/providers/default.rb:139>
before_migrate #<Proc:0x00000002debd20@/tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/providers/default.rb:165>
before_symlink #<Proc:0x00000002debac8@/tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/providers/default.rb:168>
before_restart #<Proc:0x00000002deb898@/tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/providers/default.rb:171>
after_restart #<Proc:0x00000002deb618@/tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/providers/default.rb:174>
shared_path "/srv/my_app/shared"
destination "/srv/my_app/shared/cached-copy"
end
[2013-02-07T19:08:16+00:00] ERROR: Running exception handlers
[2013-02-07T19:08:16+00:00] ERROR: Exception handlers complete
[2013-02-07T19:08:16+00:00] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef-stacktrace.out
[2013-02-07T19:08:16+00:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: deploy_revision[my_app] (/tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/providers/default.rb line 122) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '128'
---- Begin output of git ls-remote [email protected]:my_org/my_app.git HEAD ----
STDOUT:
STDERR: Could not create directory '/var/www/.ssh'.
Failed to add the host to the list of known hosts (/var/www/.ssh/known_hosts).
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
---- End output of git ls-remote [email protected]:my_org/my_app.git HEAD ----
Ran git ls-remote [email protected]:my_org/my_app.git HEAD returned 128
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment