[chef] Application cookbook and Mercurial


Chronological Thread 
  • From: Liam Kirsher < >
  • To: Opscode Support < >, " " < >
  • Subject: [chef] Application cookbook and Mercurial
  • Date: Thu, 06 Jun 2013 12:55:35 -0700
  • Openpgp: id=7011F7B7; url=http://liam.numenet.com/pgp/

I'using the Application cookbook with Mercurial (from here:
https://github.com/coderanger/mercurial)

1. I assume the deploy key must be on the host.  I just stuck it in
there for the moment, but I assume I should create the file somewhere
(else) and perhaps keep the key data in a data bag?  Is there some
recommended way to do that?

2. In my recipe I have

> application "bart" do
>   path "/srv/bart"
>   owner "nobody"
>   group "nogroup"
>
>   scm_provider Chef::Provider::Mercurial
>   repository 
> "ssh:// /bartrendr/server/bartrendr"
>   deploy_key "/home/vagrant/.ssh/bti"
And am getting the following error.  What have I missed?
> ================================================================================
> Error executing action `deploy` on resource 'deploy_revision[bart]'
> ================================================================================
>
>
> NameError
> ---------
> Cannot find a resource for revision_slug on ubuntu version 12.04
>
>
> Resource Declaration:
> ---------------------
> # In /srv/chef/file_store/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 new_resource.shallow_clone
> 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
> /srv/chef/file_store/cookbooks/application/providers/default.rb:122:in
> `run_deploy'
>
> deploy_revision("bart") do
>   provider Chef::Provider::Deploy::Revision
>   action [:deploy]
>   retries 0
>   retry_delay 2
>   deploy_to "/srv/bart"
>   repository_cache "cached-copy"
>   symlink_before_migrate {"local_settings.py"=>"local_settings.py"}
>   revision "HEAD"
>   rollback_on_error true
>   remote "origin"
>   shallow_clone true
>   scm_provider Chef::Provider::Mercurial
>   keep_releases 5
>   cookbook_name "bti_api"
>   repo 
> "ssh:// /bartrendr/server/bartrendr"
>   user "nobody"
>   group "nogroup"
>   git_ssh_wrapper "/srv/bart/deploy-ssh-wrapper"
>   migration_command "/srv/bart/shared/env/bin/python manage.py syncdb
> --noinput"
>   restart_command
> #<Proc:0x8917550@/srv/chef/file_store/cookbooks/application/providers/default.rb:139>
>   before_migrate
> #<Proc:0x891bf24@/srv/chef/file_store/cookbooks/application/providers/default.rb:166>
>   before_symlink
> #<Proc:0x891bd30@/srv/chef/file_store/cookbooks/application/providers/default.rb:169>
>   before_restart
> #<Proc:0x891b894@/srv/chef/file_store/cookbooks/application/providers/default.rb:172>
>   after_restart
> #<Proc:0x891b588@/srv/chef/file_store/cookbooks/application/providers/default.rb:175>
> end
>
>
>
> [2013-06-06T19:24:25+00:00] INFO: Running queued delayed notifications
> before re-raising exception
> [2013-06-06T19:24:25+00:00] ERROR: Running exception handlers
> [2013-06-06T19:24:25+00:00] FATAL: Saving node information to
> /srv/chef/file_store/failed-run-data.json
> [2013-06-06T19:24:25+00:00] ERROR: Exception handlers complete
> Chef Client failed. 4 resources updated
> [2013-06-06T19:24:25+00:00] FATAL: Stacktrace dumped to
> /srv/chef/file_store/chef-stacktrace.out
> [2013-06-06T19:24:25+00:00] FATAL: NameError: deploy_revision[bart]
> (/srv/chef/file_store/cookbooks/application/providers/default.rb line
> 122) had an error: NameError: Cannot find a resource for revision_slug
> on ubuntu version 12.04
>  :/home/.ssh$

-- 
Liam Kirsher
PGP: http://liam.numenet.com/pgp/



  • [chef] Application cookbook and Mercurial, Liam Kirsher, 06/06/2013

Archive powered by MHonArc 2.6.16.

§