chef-cookbooks / aix

Resources for AIX hosts
https://supermarket.chef.io/cookbooks/aix
Apache License 2.0
23 stars 42 forks source link

aix_chdev NameError: undefined local variable or method. #102

Open jkohlmeier opened 6 years ago

jkohlmeier commented 6 years ago

Cookbook version

AIX 2.3.1

Chef-client version

introduced somewhere between 14.0 and 14.1.12. Code works in last 13.9.1, but not in 14.1.12

Platform Details

AIX 7200-01-01-1642

Scenario:

Just trying to update my environment and cookbooks to use the latest version of AIX and latest Client. this code fails: aix_chdev 'sys0' do attributes(maxuproc: '1026', ncargs: '1024') need_reboot false action :update end

Steps to Reproduce:

Install 13.9.1 Chef client on AIX 7.2. Run test of the code. It should succeed. Uninstall 14.1.12. re-run test;

Expected Result:

p135n51.pbm.ihost.com Starting the first Chef Client run... p135n51.pbm.ihost.com Starting Chef Client, version 13.1.31 p135n51.pbm.ihost.com resolving cookbooks for run list: ["machprep"] p135n51.pbm.ihost.com Synchronizing Cookbooks: p135n51.pbm.ihost.com - machprep (0.0.2) p135n51.pbm.ihost.com - aix (2.3.1) p135n51.pbm.ihost.com Installing Cookbook Gems: p135n51.pbm.ihost.com Compiling Cookbooks... p135n51.pbm.ihost.com Converging 1 resources p135n51.pbm.ihost.com Recipe: machprep::t1 p135n51.pbm.ihost.com * aix_chdev[sys0] action update[2018-06-03T13:06:19-07:00] WARN: chdev: device sys0.attribute will be set to value 1026 (previously 16384) p135n51.pbm.ihost.com [2018-06-03T13:06:19-07:00] WARN: command: chdev -l sys0 -a maxuproc=1026 p135n51.pbm.ihost.com p135n51.pbm.ihost.com - chdev device sys0 with {:maxuproc=>"1026", :ncargs=>"1024"} p135n51.pbm.ihost.com p135n51.pbm.ihost.com Running handlers: p135n51.pbm.ihost.com Running handlers complete p135n51.pbm.ihost.com Chef Client finished, 1/1 resources updated in 06 seconds

Actual Result:

p135n51.pbm.ihost.com Recipe: machprep::t1 p135n51.pbm.ihost.com * aix_chdev[sys0] action update p135n51.pbm.ihost.com
p135n51.pbm.ihost.com ================================================================================ p135n51.pbm.ihost.com Error executing action update on resource 'aix_chdev[sys0]' p135n51.pbm.ihost.com ================================================================================ p135n51.pbm.ihost.com
p135n51.pbm.ihost.com NameError p135n51.pbm.ihost.com --------- p135n51.pbm.ihost.com undefined local variable or method current_value' for #<#<Class:0x00000001132f6ea8>:0x00000001141f9298> p135n51.pbm.ihost.com p135n51.pbm.ihost.com Cookbook Trace: p135n51.pbm.ihost.com --------------- p135n51.pbm.ihost.com /var/chef/cache/cookbooks/aix/resources/chdev.rb:48:inblock in class_from_file' p135n51.pbm.ihost.com
p135n51.pbm.ihost.com Resource Declaration: p135n51.pbm.ihost.com --------------------- p135n51.pbm.ihost.com # In /var/chef/cache/cookbooks/machprep/recipes/t1.rb p135n51.pbm.ihost.com
p135n51.pbm.ihost.com 17: aix_chdev 'sys0' do p135n51.pbm.ihost.com 18: attributes(maxuproc: '1026', ncargs: '1024') p135n51.pbm.ihost.com 19: need_reboot false p135n51.pbm.ihost.com 20: action :update p135n51.pbm.ihost.com 21: end p135n51.pbm.ihost.com 22: p135n51.pbm.ihost.com
p135n51.pbm.ihost.com Compiled Resource: p135n51.pbm.ihost.com ------------------ p135n51.pbm.ihost.com # Declared in /var/chef/cache/cookbooks/machprep/recipes/t1.rb:17:in from_file' p135n51.pbm.ihost.com p135n51.pbm.ihost.com aix_chdev("sys0") do p135n51.pbm.ihost.com action [:update] p135n51.pbm.ihost.com default_guard_interpreter :default p135n51.pbm.ihost.com declared_type :aix_chdev p135n51.pbm.ihost.com cookbook_name "machprep" p135n51.pbm.ihost.com recipe_name "t1" p135n51.pbm.ihost.com attributes {:maxuproc=>"1026", :ncargs=>"1024"} p135n51.pbm.ihost.com need_reboot false p135n51.pbm.ihost.com end p135n51.pbm.ihost.com p135n51.pbm.ihost.com System Info: p135n51.pbm.ihost.com ------------ p135n51.pbm.ihost.com chef_version=14.1.12 p135n51.pbm.ihost.com platform=aix p135n51.pbm.ihost.com platform_version=7.2 p135n51.pbm.ihost.com ruby=ruby 2.5.1p57 (2018-03-29 revision 63029) [powerpc-aix6.1.0.0] p135n51.pbm.ihost.com program_name=/usr/bin/chef-client p135n51.pbm.ihost.com executable=/opt/chef/bin/chef-client p135n51.pbm.ihost.com p135n51.pbm.ihost.com p135n51.pbm.ihost.com Running handlers: p135n51.pbm.ihost.com [2018-06-03T12:50:06-07:00] ERROR: Running exception handlers p135n51.pbm.ihost.com Running handlers complete p135n51.pbm.ihost.com [2018-06-03T12:50:06-07:00] ERROR: Exception handlers complete p135n51.pbm.ihost.com Chef Client failed. 0 resources updated in 07 seconds p135n51.pbm.ihost.com [2018-06-03T12:50:06-07:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out p135n51.pbm.ihost.com [2018-06-03T12:50:06-07:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report p135n51.pbm.ihost.com [2018-06-03T12:50:06-07:00] FATAL: NameError: aix_chdev[sys0] (machprep::t1 line 17) had an error: NameError: undefined local variable or methodcurrent_value' for #<#:0x00000001141f9298>

pawasthi07 commented 6 years ago

I am facing the same issue ..the recipes which use to work with chef client version 13 are no longer working..I am getting the below error

NameError
---------
undefined local variable or method `current_value' for #<#<Class:0x0000000114bd3868>:0x0000000113e6fe10>

C**ookbook Trace:
---------------
/var/chef/cache/cookbooks/aix/resources/chsec.rb:75:in `block (2 levels) in class_from_file'
/var/chef/cache/cookbooks/aix/resources/chsec.rb:73:in `each'
/var/chef/cache/cookbooks/aix/resources/chsec.rb:73:in `block in class_from_file'**

chef-client

[2018-07-03T00:53:14-04:00] WARN: Please install an English UTF-8 locale for Chef to use, falling back to C locale and disabling UTF-8 support. Starting Chef Client, version 14.2.0

msgarbossa commented 6 years ago

The current_value errors are resolved in PR #104

The UTF-8 warning can be eliminated by installing the bos.loc.com.utf bos.loc.utf.EN_US packages. From the AIX media, it's the ppc/bos.loc.com.utf and ppc/bos.loc.utf.EN_US files. The wildcards take care of the versions in the filenames.