Closed emreozkangit closed 6 years ago
NameError: uninitialized constant Chef:
Thanks for reporting. The etchosts resource isn't Chef 13 compatible yet.
Should I downgrade Client version? Which version?
It depends. It should work on the latest version of Chef 12. We also could work with you to get this resource updated for Chef 13 if you had a node to test and verify the changes we make. Or if possible you could also submit a PR yourself to fix this resource. If you aren't sure how to do the PR, I could walk you through what would need to get changed.
After I downgrade Client version on the latest version of Chef 12,I successfully updated.Thank you.
I updated the etchosts custom resource in PR #83 to work with Chef 13. It worked in all of my testing. The code is mostly the same as before except for the required conversions for Chef 13. The delete_all action is also fixed (#77). The way aliases are handled does not seem very reliable. In my testing, an alias only gets added if the primary name doesn't exist and changing existing aliases did not work as I expected. I prefer the hostsfile cookbook to handle /etc/hosts. I suspect it would work better for managing aliases. This resource is mostly redundant functionality done in an AIX-specific manner, but there could be some use-cases where this resource performs better on AIX due to the different approaches.
Version 2.1.0 of this cookbook should support the use of etchosts resource on Chef 13 hosts now @aaronemre. Thanks @msgarbossa for the PR to clean this up!
Cookbook version
chef-server 12.17.5 Redhat on ppc Chef dk 2.3.4 -- Redhat on x64
Chef-client version
client aix 7.2 - 13.6.4
Platform Details
client aix 7.2 - 13.6.4
Scenario:
etchosts module
Steps to Reproduce:
aix_etchosts[demolpar] action add
================================================================================ Error executing action
add
on resource 'aix_etchosts[demolpar]'NameError
uninitialized constant Chef::Resource::AixEtchosts
Cookbook Trace:
/var/chef/cache/cookbooks/aix/providers/etchosts.rb:26:in `load_current_resource'
Resource Declaration:
In /var/chef/cache/cookbooks/aix/recipes/default.rb
17: aix_etchosts 'demolpar' do 18: ip_address '1.1.1.1' 19: action :add 20: end
Compiled Resource:
Declared in /var/chef/cache/cookbooks/aix/recipes/default.rb:17:in `from_file'
aix_etchosts("demolpar") do action [:add] default_guard_interpreter :default declared_type :aix_etchosts cookbook_name "aix" recipe_name "default" ip_address "1.1.1.1" end
System Info:
chef_version=13.6.4 platform=aix platform_version=7.2 ruby=ruby 2.4.2p198 (2017-09-14 revision 59899) [powerpc-aix6.1.0.0] program_name=chef-client worker: ppid=13763052;start=17:03:52; executable=/opt/chef/bin/chef-client
Running handlers: [2017-11-28T17:03:58+03:00] ERROR: Running exception handlers Running handlers complete [2017-11-28T17:03:58+03:00] ERROR: Exception handlers complete Chef Client failed. 0 resources updated in 05 seconds [2017-11-28T17:03:58+03:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out [2017-11-28T17:03:58+03:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report [2017-11-28T17:03:58+03:00] ERROR: aix_etchosts[demolpar] (aix::default line 17) had an error: NameError: uninitialized constant Chef::Resource::AixEtchosts [2017-11-28T17:03:58+03:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
How can I resolve this problem?