jonlives / knife-spork

A workflow plugin to help many devs work with cookbooks and environments at once
Other
335 stars 97 forks source link

HipChat plugin 'undefined local variable or method `environment' #175

Closed hrak closed 9 years ago

hrak commented 9 years ago

Using knife-spork 1.5.0 with ChefDK-0.4.0, when promoting a cookbook to production i got the following:

Promotion complete at 2015-02-04 08:44:19 +0100!
Git add'ing environments/production.json
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/knife-spork-1.5.0/lib/knife-spork/plugins/hipchat.rb:15:in `after_promote_remote': undefined local variable or method `environment' for #<KnifeSpork::Plugins::HipChat:0x0000000605d7b8> (NameError)
    from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/knife-spork-1.5.0/lib/knife-spork/plugins.rb:16:in `block in run'
    from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/knife-spork-1.5.0/lib/knife-spork/plugins.rb:14:in `each'
    from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/knife-spork-1.5.0/lib/knife-spork/plugins.rb:14:in `run'
    from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/knife-spork-1.5.0/lib/knife-spork/runner.rb:42:in `run_plugins'
    from /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/knife-spork-1.5.0/lib/chef/knife/spork-promote.rb:86:in `run'
    from /opt/chefdk/embedded/apps/chef/lib/chef/knife.rb:417:in `block in run_with_pretty_exceptions'
    from /opt/chefdk/embedded/apps/chef/lib/chef/local_mode.rb:38:in `with_server_connectivity'
    from /opt/chefdk/embedded/apps/chef/lib/chef/knife.rb:416:in `run_with_pretty_exceptions'
    from /opt/chefdk/embedded/apps/chef/lib/chef/knife.rb:213:in `run'
    from /opt/chefdk/embedded/apps/chef/lib/chef/application/knife.rb:139:in `run'
    from /opt/chefdk/embedded/apps/chef/bin/knife:25:in `<top (required)>'
    from /opt/chefdk/bin/knife:40:in `load'
    from /opt/chefdk/bin/knife:40:in `<main>'
knife spork -VV promote --remote production ntp  4.32s user 0.86s system 86% cpu 6.017 total
hrak commented 9 years ago

My config:

Config Hash:
{"default_environments"=>["production", "development"], "version_change_threshold"=>2, "environment_path"=>"environments", "plugins"=>{"git"=>{"enabled"=>true}, "hipchat"=>{"server_url"=>"https://hipchat.company.com", "api_version"=>"v2", "api_token"=>"TOKEN", "rooms"=>["Chef"], "notify"=>false, "color"=>"yellow"}}}

Plugins:
KnifeSpork::Plugins::Grove: disabled
KnifeSpork::Plugins::Influxdb: disabled
KnifeSpork::Plugins::Graphite: disabled
KnifeSpork::Plugins::Eventinator: disabled
KnifeSpork::Plugins::StatusNet: disabled
KnifeSpork::Plugins::Rubocop: disabled
KnifeSpork::Plugins::HipChat: enabled
KnifeSpork::Plugins::Jabber: disabled
KnifeSpork::Plugins::Irccat: disabled
KnifeSpork::Plugins::Git: enabled
KnifeSpork::Plugins::Slack: disabled
KnifeSpork::Plugins::Campfire: disabled
KnifeSpork::Plugins::Foodcritic: disabled

Commands tried: knife spork promote --remote production ntp knife spork promote production ntp --remote knife spork promote production --remote ntp

all result in same error. I'm guessing the author of #153 is using spork omni, which takes a '--environment' argument. But when calling spork promote directly that's not the case.

jonlives commented 9 years ago

@hrak thanks for reporting this! I'll take a look at this and try and get a fix out in the next couple of days.

danieleva commented 9 years ago

Again, my sincere apologies for this. I messed up while creating the pull request and didn't include the last commit. :(

jeunito commented 9 years ago

@danieleva I made a comment to your fix. Hope you can check it out.

danieleva commented 9 years ago

@jeunito Thanks for that, I updated the pull request :D

jonlives commented 9 years ago

This has been released in the 1.5.1 release :)