3ofcoins / chef-cookbook-hostname

Chef cookbook to set node's hostname and FQDN.
MIT License
41 stars 90 forks source link

NoMethodError undefined method `platform' #62

Closed fulloflilies closed 7 years ago

fulloflilies commented 7 years ago

Hi,

I am getting NoMethodError when compiling cookbooks with test-kitchen. It looks like it has issue when Chef Client version is 13.0.113, which is the current latest release.

,,, Installing Cookbook Gems: Compiling Cookbooks...

   ================================================================================
   Recipe Compile Error in /tmp/kitchen/cache/cookbooks/hostname/attributes/default.rb
   ================================================================================

   NoMethodError
   -------------
   undefined method `platform' for #<Chef::Node::Attribute:0x00000002a44ac8>

   Cookbook Trace:
   ---------------
     /tmp/kitchen/cache/cookbooks/hostname/attributes/default.rb:4:in `from_file'

   Relevant File Content:
   ----------------------
   /tmp/kitchen/cache/cookbooks/hostname/attributes/default.rb:

     1:  # -*- coding: utf-8 -*-
     2:  
     3:  default['hostname_cookbook']['hostsfile_ip'] = '127.0.1.1'
     4>> default['hostname_cookbook']['hostsfile_ip_interface'] = 'lo0' if platform == 'freebsd'
     5:  

   System Info:
   ------------
   chef_version=13.0.113
   platform=ubuntu
   platform_version=14.04
   ruby=ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
   program_name=chef-client worker: ppid=1497;start=18:33:05;
   executable=/opt/chef/bin/chef-client

,,,

I workaround the issue by adding "require_chef_omnibus: 12.19.36" in my .kitchen.yml

mburns commented 7 years ago

FYI, this should be fixed in the Master branch (version 0.4.1) which is not pushed to the Supermarket (yet).

Thanks for the report!

rmoriz commented 7 years ago

Please consider a release as Chef 13 is released

mburns commented 7 years ago

@3ofcoins/hostname-developers @mpasternacki @xamebax are the only people with access to Supermarket. We really should publish (several) cut releases to the Supermarket.

xamebax commented 7 years ago

@mburns yes! Thanks for the ping. I will deal with this in the next days.

xamebax commented 7 years ago

The newest version is now published on the Supermarket, so I guess this should solve the issue.

anirudhtetali commented 4 years ago

I'm still facing this issue

chef_version=14.2.0 platform=oracle platform_version=6.10 ruby=ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux] program_name=chef-client executable=/opt/chef/bin/chef-client

`Recipe Compile Error in /var/chef/cache/cookbooks/ruby_build/attributes/default.rb

NoMethodError

undefined method `platform' for #

Cookbook Trace:

/var/chef/cache/cookbooks/ruby_build/attributes/default.rb:32:in `from_file'

Relevant File Content:

/var/chef/cache/cookbooks/ruby_build/attributes/default.rb:

25:
26: # default base path for a system-wide installed Ruby 27: default['ruby_build']['default_ruby_base_path'] = "/usr/local/ruby" 28:
29: # ruby-build upgrade action 30: default['ruby_build']['upgrade'] = "none" 31:
32>> case platform 33: when "redhat", "centos", "fedora", "amazon", "scientific" 34: node.set['ruby_build']['install_pkgs'] = %w{ tar bash curl } 35: node.set['ruby_build']['install_git_pkgs'] = %w{ git } 36: node.set['ruby_build']['install_pkgs_cruby'] = 37: %w{ gcc-c++ patch readline readline-devel zlib zlib-devel 38: libffi-devel openssl-devel 39: make bzip2 autoconf automake libtool bison 40: libxml2 libxml2-devel libxslt libxslt-devel 41: subversion autoconf }`

sasGH1 commented 4 years ago

I think you'll need to open a new issue.