Typh
Typh

Reputation: 43

Chef cookbook: undefined local variable or method

I'm having a problem with a chef cookbook that create several shared filesystems.

This is the fragment that is giving me problems:

sii_share_share "ansible" do
    remote_path "//#{ node['sii_base']['utils_storage_account_name'] }.file.core.windows.net/ansible"
    local_path "/opt/ansible"
    fstype "cifs"
    dir_owner "root"
    dir_group "sysadmin"
    dir_mode "0770"
    file_mode "0660"
    cifs_credentials_file "/root/.smb.utils.credentials"
end

The error is "undefined local variable or method `local_path' for #<#:0x00000000047b3ed8>"

This error is happening with these versions:

Chef-client: 14.1.12

ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]

With previous versions (chef-client 13.6 and ruby 2.3.1p112) this is working fine. I'm running these cookbooks in Azure, using the Linux Chef extension.

Have anyone experimented something like this?

Thanks in advance.

Upvotes: 1

Views: 3705

Answers (1)

Brandon Miller
Brandon Miller

Reputation: 5065

It's possible your resource is using deprecated property naming.

  • Verify that the sii_share_share resource has a property named local_path
  • If it does then you need to verify that all of the code inside the resource itself refers to the local_path property using new_resource.local_path and not local_path. This has been a pending deprecation that went in to effect with Chef Client 14.

You should always review breaking changes before making the move between major versions of Chef Client. The end of each chef-client run also outputs deprecation messages as a warning before these breaking changes go in to place.

Upvotes: 2

Related Questions