Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't enable or reload service #412

Closed
matkam opened this issue Feb 10, 2017 · 2 comments
Closed

Can't enable or reload service #412

matkam opened this issue Feb 10, 2017 · 2 comments

Comments

@matkam
Copy link

matkam commented Feb 10, 2017

Started getting this error recently, possibly due to using a newer version of poise-service. Using Consul recipe 2.3.0, running on Ubuntu 14.04:

  * consul_service[consul] action enable
    * directory[/var/lib/consul] action create (up to date)
    * poise_service[consul] action enable
      * template[/etc/init/consul.conf] action create (up to date)
      * service[consul] action enable
        
        ================================================================================                                                                                                                                  Error executing action `enable` on resource 'service[consul]'                                                                                                                                                     ================================================================================                                                                                                                                                                                                                                                                                                                                                    NoMethodError                                                                                                                                                                                                     -------------                                                                                                                                                                                                     undefined method `[]' for nil:NilClass                                                                                                                                                                                                                                                                                                                                                                                              Cookbook Trace:                                                                                                                                                                                                   ---------------                                                                                                                                                                                                   /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_providers/base.rb:122:in `block in enable_service'                                                                                 /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_providers/base.rb:134:in `notify_if_service'                                                                                       /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_providers/base.rb:121:in `enable_service'                                                                                          /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_providers/base.rb:60:in `action_enable'                                                                                            /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_mixin.rb:89:in `block in action_enable'                                                                                            /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_mixin.rb:154:in `notify_if_service'                                                                                                /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_mixin.rb:88:in `action_enable'                                                                                                     /var/chef/cache/cookbooks/consul/libraries/consul_service.rb:80:in `action_enable'                                                                                                                                                                                                                                                                                                                                                  Resource Declaration:                                                                                                                                                                                             ---------------------                                                                                                                                                                                             # In /var/chef/cache/cookbooks/consul/recipes/default.rb                                                                                                                                                                                                                                                                                                                                                                             53: consul_service service_name do |r|                                                                                                                                                                            54:   version node['consul']['version']                                                                                                                                                                           55:   config_file config.path                                                                                                                                                                                     56:   program install.consul_program                                                                                                                                                                              57:                                                                                                                                                                                                               58:   unless windows?                                                                                                                                                                                             59:     user node['consul']['service_user']                                                                                                                                                                       60:     group node['consul']['service_group']                                                                                                                                                                     61:   end                                                                                                                                                                                                         62:   if node['consul']['service']                                                                                                                                                                                                                                                                                                                                                                                                 Compiled Resource:                                                                                                                                                                                                ------------------                                                                                                                                                                                                # Declared in /var/chef/cache/cookbooks/consul/recipes/default.rb:53:in `from_file'                                                                                                                                                                                                                                                                                                                                                 service("consul") do                                                                                                                                                                                                provider Chef::Provider::Service::Upstart                                                                                                                                                                         action [:nothing]                                                                                                                                                                                                 supports {:status=>true, :restart=>true, :reload=>true}
          retries 0                                                                                                                                                                                                         retry_delay 2                                                                                                                                                                                                     default_guard_interpreter :default                                                                                                                                                                                service_name "consul"                                                                                                                                                                                             pattern "consul"                                                                                                                                                                                                end                                                                                                                                                                                                                                                                                                                                                                                                                                 Platform:                                                                                                                                                                                                         ---------                                                                                                                                                                                                         x86_64-linux                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  

                                                                                                                                                                                                                        ================================================================================                                                                                                                                  Error executing action `enable` on resource 'poise_service[consul]'                                                                                                                                               ================================================================================                                                                                                                                                                                                                                                                                                                                                    NoMethodError                                                                                                                                                                                                     -------------                                                                                                                                                                                                     service[consul] (/var/chef/cache/cookbooks/consul/recipes/default.rb line 53) had an error: NoMethodError: undefined method `[]' for nil:NilClass

      Cookbook Trace:
      ---------------
      /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_providers/base.rb:122:in `block in enable_service'
      /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_providers/base.rb:134:in `notify_if_service'
      /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_providers/base.rb:121:in `enable_service'
      /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_providers/base.rb:60:in `action_enable'
      /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_mixin.rb:89:in `block in action_enable'
      /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_mixin.rb:154:in `notify_if_service'
      /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_mixin.rb:88:in `action_enable'
      /var/chef/cache/cookbooks/consul/libraries/consul_service.rb:80:in `action_enable'

      Resource Declaration:
      ---------------------
      # In /var/chef/cache/cookbooks/consul/recipes/default.rb
      
       53: consul_service service_name do |r|
       54:   version node['consul']['version']
       55:   config_file config.path
       56:   program install.consul_program
       57:
       58:   unless windows?
       59:     user node['consul']['service_user']
       60:     group node['consul']['service_group']
       61:   end
       62:   if node['consul']['service']
       
      Compiled Resource:
      ------------------
      # Declared in /var/chef/cache/cookbooks/consul/recipes/default.rb:53:in `from_file'

      poise_service("consul") do
        action [:enable]
        retries 0
        retry_delay 2
        default_guard_interpreter :default
        user "consul"
        command "/opt/consul/0.6.4/consul agent -config-file=/etc/consul/consul.json -config-dir=/etc/consul/conf.d"
        stop_signal "TERM"
        reload_signal "HUP"
        service_name "consul"
        directory "/var/lib/consul" 
        environment {"GOMAXPROCS"=>"4", "PATH"=>"/usr/local/bin:/usr/bin:/bin"}
        options_systemd {"template"=>"consul:systemd.service.erb"}
        options_sysvinit {"template"=>"consul:sysvinit.service.erb"}
        options_upstart {"template"=>"consul:upstart.service.erb", "executable"=>"/opt/consul/0.6.4/consul"}
      end
      
      Platform:
      ---------
      x86_64-linux

      
    ================================================================================
    Error executing action `enable` on resource 'consul_service[consul]'
    ================================================================================
    
    NoMethodError
    -------------
    poise_service[consul] (/var/chef/cache/cookbooks/consul/recipes/default.rb line 53) had an error: NoMethodError: service[consul] (/var/chef/cache/cookbooks/consul/recipes/default.rb line 53) had an error: NoMethodError: undefined method `[]' for nil:NilClass                                                                                                                                                               
    Cookbook Trace:
    ---------------
    /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_providers/base.rb:122:in `block in enable_service'
    /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_providers/base.rb:134:in `notify_if_service'
    /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_providers/base.rb:121:in `enable_service'
    /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_providers/base.rb:60:in `action_enable'
    /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_mixin.rb:89:in `block in action_enable'
    /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_mixin.rb:154:in `notify_if_service'
    /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_mixin.rb:88:in `action_enable'
    /var/chef/cache/cookbooks/consul/libraries/consul_service.rb:80:in `action_enable'
    
    Resource Declaration:
    ---------------------
    # In /var/chef/cache/cookbooks/consul/recipes/default.rb
    
     53: consul_service service_name do |r|
     54:   version node['consul']['version']
     55:   config_file config.path  
     56:   program install.consul_program
     57:
     58:   unless windows?
     59:     user node['consul']['service_user']
     60:     group node['consul']['service_group']
     61:   end
     62:   if node['consul']['service']
     
    Compiled Resource:
    ------------------
    # Declared in /var/chef/cache/cookbooks/consul/recipes/default.rb:53:in `from_file'

    consul_service("consul") do
      action [:enable]
      retries 0
      retry_delay 2
      default_guard_interpreter :default
      declared_type :consul_service 
      cookbook_name "consul"
      recipe_name "default"
      config_file "/etc/consul/consul.json"
      program "/opt/consul/0.6.4/consul"
      user "consul"
      group "consul"
      config_dir "/etc/consul/conf.d"
      nssm_params {"AppDirectory"=>"/var/lib/consul", "AppStdout"=>"/etc/consul/stdout.log", "AppStderr"=>"/etc/consul/error.log", "AppRotateFiles"=>1, "AppRotateOnline"=>1, "AppRotateBytes"=>20000000}
      data_dir "/var/lib/consul"
      service_name "consul"
      environment {"GOMAXPROCS"=>"4", "PATH"=>"/usr/local/bin:/usr/bin:/bin"}
    end
      
    Platform:
    ---------
    x86_64-linux
@matkam
Copy link
Author

matkam commented Feb 11, 2017

Turns out this was happening because the Consul was having trouble starting up due to configuration issues.

@matkam matkam closed this as completed Feb 11, 2017
@lock
Copy link

lock bot commented Apr 25, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant