Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting undefined local variable error when running cookbook #33

Open
slbailey opened this issue May 4, 2018 · 1 comment
Open

Getting undefined local variable error when running cookbook #33

slbailey opened this issue May 4, 2018 · 1 comment

Comments

@slbailey
Copy link

slbailey commented May 4, 2018

I'm running the cookbook using chef-solo as part of a packer deployment and I'm getting an error that I'm sure is my stupidity but I can't figure out what's wrong:

vmware-iso: Compiling Cookbooks...
vmware-iso: Converging 32 resources
vmware-iso: Recipe: windows-hardening::enable_winrm_access
vmware-iso:   * powershell_script[Remote Management] action run
vmware-iso:     - execute "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/ADMINI~1/AppData/Local/Temp/chef-script20180503-2024-1siyebd.ps1"
vmware-iso: Recipe: windows-hardening::password_policy
vmware-iso:   * password_policy[password_history] action set
vmware-iso:
vmware-iso:     ================================================================================
vmware-iso:     Error executing action `set` on resource 'password_policy[password_history]'
vmware-iso:     ================================================================================
vmware-iso:
vmware-iso:     NameError
vmware-iso:     ---------
vmware-iso:     undefined local variable or method `policy_name' for #<#<Class:0x028c9f08>:0x04e6b898>
vmware-iso:
vmware-iso:     Resource Declaration:
vmware-iso:     ---------------------
vmware-iso:     # In c:/windows/temp/packer-chef-solo/local-mode-cache/cache/cookbooks/windows-hardening/recipes/password_policy.rb
vmware-iso:
vmware-iso:      11: password_policy 'password_history' do
vmware-iso:      12:   policy_command 'uniquepw'
vmware-iso:      13:   value 24
vmware-iso:      14:   action :set
vmware-iso:      15: end
vmware-iso:      16:
vmware-iso:
vmware-iso:     Compiled Resource:
vmware-iso:     ------------------
vmware-iso:     # Declared in c:/windows/temp/packer-chef-solo/local-mode-cache/cache/cookbooks/windows-hardening/recipes/password_policy.rb:11:in `from_file'
vmware-iso:
vmware-iso:     password_policy("password_history") do
vmware-iso:       action [:set]
vmware-iso:       default_guard_interpreter :default
vmware-iso:       declared_type :password_policy
vmware-iso:       cookbook_name "windows-hardening"
vmware-iso:       recipe_name "password_policy"
vmware-iso:       policy_command "uniquepw"
vmware-iso:       value 24
vmware-iso:       policy_name "password_history"
vmware-iso:     end
vmware-iso:
vmware-iso:     System Info:
vmware-iso:     ------------
vmware-iso:     chef_version=14.0.202
vmware-iso:     platform=windows
vmware-iso:     platform_version=6.3.9600
vmware-iso:     ruby=ruby 2.5.1p57 (2018-03-29 revision 63029) [i386-mingw32]
vmware-iso:     program_name=c:/opscode/chef/bin/chef-solo
vmware-iso:     executable=c:/opscode/chef/bin/chef-solo
vmware-iso:
@rabidpitbull
Copy link

It would appear the resource in the cookbook is a victim of a breaking change in chef-client 14.x, which requires that properties are referenced with new_resource.propertyname.

It works fine under chef-client 13.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants