Unable to use server name as task #32

Closed
machadolab opened this Issue Jun 23, 2013 · 1 comment

2 participants

@machadolab

When I try and use the auto-generated task from the server name, I get an error:

thunder:leaddyno-app machado$ cap web1 ec2:date
  * 2013-06-22 21:56:30 executing `web1'
/Users/machado/.rvm/gems/ruby-1.9.3-p392@leaddyno-app/gems/capify-ec2-1.4.11/lib/capify-ec2/capistrano.rb:216:in `block in ec2_roles': undefined method `[]' for nil:NilClass (NoMethodError)
    from /Users/machado/.rvm/gems/ruby-1.9.3-p392@leaddyno-app/gems/capistrano-2.15.4/lib/capistrano/configuration/execution.rb:138:in `instance_eval'
    from /Users/machado/.rvm/gems/ruby-1.9.3-p392@leaddyno-app/gems/capistrano-2.15.4/lib/capistrano/configuration/execution.rb:138:in `invoke_task_directly'
    from /Users/machado/.rvm/gems/ruby-1.9.3-p392@leaddyno-app/gems/capistrano-2.15.4/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks'
    from /Users/machado/.rvm/gems/ruby-1.9.3-p392@leaddyno-app/gems/capistrano-2.15.4/lib/capistrano/configuration/execution.rb:89:in `execute_task'
    from /Users/machado/.rvm/gems/ruby-1.9.3-p392@leaddyno-app/gems/capistrano-2.15.4/lib/capistrano/configuration/execution.rb:101:in `find_and_execute_task'
    from /Users/machado/.rvm/gems/ruby-1.9.3-p392@leaddyno-app/gems/capistrano-2.15.4/lib/capistrano/cli/execute.rb:46:in `block in execute_requested_actions'
    from /Users/machado/.rvm/gems/ruby-1.9.3-p392@leaddyno-app/gems/capistrano-2.15.4/lib/capistrano/cli/execute.rb:45:in `each'
    from /Users/machado/.rvm/gems/ruby-1.9.3-p392@leaddyno-app/gems/capistrano-2.15.4/lib/capistrano/cli/execute.rb:45:in `execute_requested_actions'
    from /Users/machado/.rvm/gems/ruby-1.9.3-p392@leaddyno-app/gems/capistrano-2.15.4/lib/capistrano/cli/help.rb:19:in `execute_requested_actions_with_help'
    from /Users/machado/.rvm/gems/ruby-1.9.3-p392@leaddyno-app/gems/capistrano-2.15.4/lib/capistrano/cli/execute.rb:34:in `execute!'
    from /Users/machado/.rvm/gems/ruby-1.9.3-p392@leaddyno-app/gems/capistrano-2.15.4/lib/capistrano/cli/execute.rb:14:in `execute'
    from /Users/machado/.rvm/gems/ruby-1.9.3-p392@leaddyno-app/gems/capistrano-2.15.4/bin/cap:4:in `'
    from /Users/machado/.rvm/gems/ruby-1.9.3-p392@leaddyno-app/bin/cap:19:in `load'
    from /Users/machado/.rvm/gems/ruby-1.9.3-p392@leaddyno-app/bin/cap:19:in `'
    from /Users/machado/.rvm/gems/ruby-1.9.3-p392@leaddyno-app/bin/ruby_noexec_wrapper:14:in `eval'
    from /Users/machado/.rvm/gems/ruby-1.9.3-p392@leaddyno-app/bin/ruby_noexec_wrapper:14:in `'
thunder:leaddyno-app machado$ cap ec2:date
  * 2013-06-22 21:56:35 executing `ec2:date'
  * executing "date"
    servers: ["ec2-5x-1x-3x-1x.compute-1.amazonaws.com"]
    [ec2-5x-1x-3x-1x.compute-1.amazonaws.com] executing command
 ** [out :: ec2-5x-1x-3x-1x.compute-1.amazonaws.com] Sun Jun 23 04:56:38 UTC 2013
    command finished in 1383ms
thunder:leaddyno-app machado$ cap ec2:status
  * 2013-06-22 21:56:45 executing `ec2:status'
Project: leaddyno-app.
Num   Name   ID           Type        DNS                                        Zone         Roles     Options
00:   web1   i-xxxxx   m1.medium   ec2-5x-1x-3x-1x.compute-1.amazonaws.com   us-east-1b   app,web
thunder:leaddyno-app machado$

It looks like @ec2_config is not a valid instance variable in lib/capify-ec2/capistrano.rb. I tried to replace

@ec2_config[:aws_roles_tag]

with

capify_ec2.ec2_config[:aws_roles_tag]

But that results in the raw comma-separated list of roles, not an array, that line 216 is expecting. I didn't dig too deep, I assume there is an array version of the server's roles in one of the data structures, but I didn't go digging.

I am running version 1.4.11.

Being able to execute cap tasks on just a single server is super handy, so I hope this gets fixed soon! Thanks for the excellent gem, it makes my rolling deploys a breeze!

@Rylon
Forward member

Thanks for letting us know about this, I have reproduced it locally, so I'll try to get a fix out as soon as possible.

@Rylon Rylon closed this in 5ace347 Jul 19, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment