sous-chefs / consul

Development repository for the consul cookbook
https://supermarket.chef.io/cookbooks/consul
Apache License 2.0
192 stars 244 forks source link

No resource or method named `platform_family?' for ConsulCookbook::Provider::ConsulService #414

Closed 123BLiN closed 7 years ago

123BLiN commented 7 years ago

Chef-client version - 12.6.0 consul-cookbook - 2.3.0 Centos 7

Can someone advice what to do with such error?:

 ================================================================================
    Error executing action `enable` on resource 'consul_service[consul]'
    ================================================================================

    NoMethodError
    -------------
    No resource or method named `platform_family?' for `ConsulCookbook::Provider::ConsulService ""'

    Cookbook Trace:
    ---------------
    /var/chef/cache/cookbooks/consul/libraries/consul_service.rb:93:in `service_options'
    /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_mixin.rb:174:in `block in service_resource'
    /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_mixin.rb:168:in `tap'
    /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_mixin.rb:168:in `service_resource'
    /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_mixin.rb:153: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'
    /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:78:in `run_action'
    /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `block (2 levels) in converge'
    /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `each'
    /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `block in converge'
    /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:105:in `converge'

    Resource Declaration:
    ---------------------
    # In /var/chef/cache/cookbooks/consul/recipes/default.rb

     30: consul_service service_name do |r|
     31:   config_file config.path
     32:   program install.consul_program
     33:
     34:   unless node.platform_family?('windows')
     35:     user node['consul']['service_user']
     36:     group node['consul']['service_group']
     37:   end
     38:   if node['consul']['service']
aschneid75 commented 7 years ago

I'm attempting to use 2.3.0 and having the same problem. On a Google search, it looks like an LVM cookbook was having the same problem:

https://github.com/chef-cookbooks/lvm/issues/115

It looks like the Platform Introspection DSL needs to be added to the library:

https://github.com/chef-cookbooks/lvm/pull/116/files

I looked through this cookbook's source and I'm not seeing it. I was going to add it, but wanted to verify I wasn't doing anything wrong.

123BLiN commented 7 years ago

Hello again :) In my case the problem was in the fact that I've forked the wrong cookbook version (master) instead on v2.3.0.

the problem is in that line: https://github.com/johnbellone/consul-cookbook/blob/master/libraries/consul_service.rb#L93 vs https://github.com/johnbellone/consul-cookbook/blob/v2.3.0/libraries/consul_service.rb#L93

thanks @maxnasonov for finding this out!

aschneid75 commented 7 years ago

I'm figuring that's my problem too then. Didn't even think and pulled down master to look at the cookbook and then proceeded to use it instead of the 2.3.0 branch. I'll give that a shot.

Thanks for pointing it out!

lock[bot] commented 4 years ago

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.