S
S
sergei19932019-07-07 15:51:57
Chef
sergei1993, 2019-07-07 15:51:57

Chef12 undefined method validate_spec, how to fix?

Good afternoon!
We are currently moving to chef12 from chef11. There was a problem with one of the cookbooks.
cookbook syslog_ng.
There is a line in the resources:
attribute :host, :kind_of => String, :default => '', :callbacks => { 'should not be empty' => lambda { |spec| validate_spec(spec) } }
It is not accepted by the 12 boss, and it throws an error:

/var/chef/cache/cookbooks/cron/resources/d.rb:65: warning: constant ::Fixnum is deprecated

================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/syslog_ng/resources/destination_syslog.rb
================================================================================

NoMethodError
-------------
undefined method `validate_spec' for #<Class:0x00000000052607c8>

Cookbook Trace:
  /var/chef/cache/cookbooks/syslog_ng/resources/destination_syslog.rb:11:in `block in class_from_file'
  /var/chef/cache/cookbooks/syslog_ng/resources/destination_syslog.rb:11:in `class_from_file'

I ask for help, how can I remake it under 12 chief? Thanks a lot.
ps tried changing it to
attribute :host, :kind_of => String, :default => '', :callbacks => { 'should not be empty' => lambda { |spec| validate_spec(spec) } }
the cookbook started, but the syslog didn't start at all after it was applied

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question