djoos-cookbooks / newrelic

Development repository for the newrelic cookbook
https://supermarket.chef.io/cookbooks/newrelic
MIT License
143 stars 247 forks source link

Compile Error on server_monitor.rb #395

Closed nickdallamora closed 3 years ago

nickdallamora commented 3 years ago

Running newrelic cookbook 2.43.0 I run into this compilation issue:

`[2021-03-13T22:50:31+00:00] DEBUG: Loading cookbook newrelic's resources from /tmp/d20210313-20702-7ksvpu/cookbooks/newrelic/resources/server_monitor.rb

================================================================================
Recipe Compile Error in /tmp/d20210313-20702-7ksvpu/cookbooks/newrelic/resources/server_monitor.rb
================================================================================

NoMethodError
-------------
undefined method `platform?' for #<Class:0x000000000769dc80>

Cookbook Trace:
---------------
  /tmp/d20210313-20702-7ksvpu/cookbooks/newrelic/resources/server_monitor.rb:36:in `class_from_file'

Relevant File Content:
----------------------
/tmp/d20210313-20702-7ksvpu/cookbooks/newrelic/resources/server_monitor.rb:

 29:  attribute :service_actions, kind_of: Array, default: %w(enable start)
 30:  attribute :windows_version, kind_of: String, default: '2.0.0.198'
 31:  attribute :windows64_checksum, kind_of: String, default: '5a8f3f5e8f15997463430401756d377c321c8899c2790ca85e5587a5b643651e'
 32:  attribute :windows32_checksum, kind_of: String, default: 'ac2b65eecaad461fdd2e4386e3e4c9f96ea940b35bdf7a8c532c21dbd1c99ff0'
 33:  attribute :cookbook, kind_of: String, default: 'newrelic'
 34:  attribute :source, kind_of: String, default: 'agent/server_monitor/nrsysmond.cfg.erb'
 35:  
 36>> if platform?('smartos')
 37:    attribute :service_name, kind_of: String, default: 'nrsysmond'
 38:    attribute :config_file_group, kind_of: String, default: 'root'
 39:    attribute :config_path, kind_of: String, default: '/opt/local/etc'
 40:  else
 41:    attribute :service_name, kind_of: String, default: 'newrelic-sysmond'
 42:    attribute :config_file_group, kind_of: String, default: 'newrelic'
 43:    attribute :config_path, kind_of: String, default: '/etc/newrelic'
 44:  end
 45:  

System Info:
------------
chef_version=14.10.9
platform=ubuntu
platform_version=16.04
ruby=ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]
program_name=/opt/chefdk/embedded/bin/rspec
executable=/opt/chefdk/embedded/bin/rspec`

Previously 2.41.0 was working until today. Thank you.

alexkokkinos commented 3 years ago

Same issue! My Chef version is 14.11.21

My immediate question is if the attribute? method was added in Chef 15 or 16, but I haven't found this info yet.

Another edit: seems like this was a thing at least back in Chef 12: https://docs-archive.chef.io/release/12-9/attributes.html

djoos commented 3 years ago

Could you give v2.43.1 a go? Thanks in advance!