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

Deprecated feature used, fix before chef 13 #253

Closed
spuder opened this issue Mar 1, 2016 · 5 comments
Closed

Deprecated feature used, fix before chef 13 #253

spuder opened this issue Mar 1, 2016 · 5 comments

Comments

@spuder
Copy link
Contributor

spuder commented Mar 1, 2016

In testing the chef-client 12.8.0 prerelease (12.7.2 is the current latest stable), I'm getting the following warnings about deprecated features.

Running handlers:
Running handlers complete

Deprecated features used!
  An attempt was made to change application_name from "NetDocuments/neweb2" to nil by calling application_name(nil). In Chef 12, this does a get rather than a set. In Chef 13, this will change to set the value to nil. at 1 location:
    - c:/chef/local-mode-cache/cache/cookbooks/iis/providers/vdir.rb:123:in `load_current_resource'����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

The offending line is here:

https://github.com/chef-cookbooks/iis/blob/master/providers/vdir.rb#L123

And the line in chef is here:

https://github.com/chef/chef/blob/a030711a57e126f58b2e897c915d430e67cb7d13/lib/chef/property.rb#L276

I've spent a few minutes trying to figure out how to fix this, but it is a little above my ruby abilities.

@EasyAsABC123
Copy link
Contributor

it appears that application_name is a reserved keyword in chef 13. the fix
would be simply to change this property name to name or something else

On Tue, Mar 1, 2016 at 12:59 PM, Spencer Owen [email protected]
wrote:

In testing the chef-client 12.8.0 prerelease (12.7.2 is the current latest
stable), I'm getting the following warnings about deprecated features.

Running handlers:Running handlers complete
Deprecated features used!
An attempt was made to change application_name from "NetDocuments/neweb2" to nil by calling application_name(nil). In Chef 12, this does a get rather than a set. In Chef 13, this will change to set the value to nil. at 1 location:
- c:/chef/local-mode-cache/cache/cookbooks/iis/providers/vdir.rb:123:in `load_current_resource'

The offending line is here:

https://github.com/chef-cookbooks/iis/blob/master/providers/vdir.rb#L123

And the line in chef is here:

https://github.com/chef/chef/blob/a030711a57e126f58b2e897c915d430e67cb7d13/lib/chef/property.rb#L276

I've spent a few minutes trying to figure out how to fix this, but it is a
little above my ruby abilities.


Reply to this email directly or view it on GitHub
#253.

spuder added a commit to spuder/iis that referenced this issue Mar 3, 2016
spuder added a commit to spuder/iis that referenced this issue Mar 3, 2016
@spuder
Copy link
Contributor Author

spuder commented Mar 3, 2016

From my testing, it appears that more than a simple rename is needed.

I changed all instances of application_name to derp_name with the same results.

An attempt was made to change derp_name from "NetDocuments/neweb2" to nil by calling derp_name(nil). In Chef 12, this does a get rather than a set. In Chef 13, this will change to set the value to nil. at 1 location:
- c:/chef/local-mode-cache/cache/cookbooks/iis/providers/vdir.rb:123:in `load_current_resource'�����

This will take more investigation.

@EasyAsABC123
Copy link
Contributor

Ah this is because we are calling:
@current_resource.application_name(application_name_check)
which could end up being
@current_resource.application_name(nil)
which changes the type of
@current_resource.application_name
however it appears it is detecting the type wrong since it is actually just a string.

@spuder
Copy link
Contributor Author

spuder commented Mar 3, 2016

Adding a final else eliminates the error

def application_name_check
  if !new_resource.derp_name.include?('/') && !new_resource.derp_name.end_with?('/')
    new_resource.derp_name("#{new_resource.derp_name}/").to_s
  elsif new_resource.derp_name.chomp('/').include?('/') && new_resource.derp_name.end_with?('/')
    new_resource.derp_name("#{new_resource.derp_name}".chomp('/')).to_s
  else
    new_resource.derp_name("#{new_resource.derp_name}").to_s
  end
end

@EasyAsABC123
Copy link
Contributor

Looks good to me, I think all we need is the else not the name change. Put in a pull request whenever you verify.

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