-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
TypeError: no implicit conversion of nil into Integer in detect_unprocessed_resources #5565
Comments
I was experiencing the same issue, and I found the cause (for me). As the error message is pretty generic, it was hard to track down. I'm using the cacert cookbook and in my case this issue was because of an attribute named attribute :hash, kind_of: String, default: nil As soon as I renamed the attribute to I'm just releasing a workaround-version for the cacert cookbook. I'm not sure whether this behaviour is intentional? |
@kpmueller Thanks for the issue report! @chr4 thanks for chiming in with additional information. That is definitely not intended behavior, and the resources attribute names shouldn't affect this, so we need to get this fixed. Can you provide additional details so I can build a reproducible test case? Any specifics on how you're using the cacert cookbook, what version of the cookbook you used, etc. would be mighty helpful so I can nip this in the bud. Thanks! |
Thanks for looking into this! The error should be easily reproducible: Using Let me know in case you need more information. |
@chr4 thanks for the response. I'm about to head out on vacation, but this is on my list of stuff to do between family things and hopefully I'll have an answer for you next week. I appreciate your patience. |
As I've published a workaround-release, this works for now and there's no need to hurry. Enjoy your vacation! |
the workaround in ca-cert is working for me, too. I don't have a reproducible test case other than what chr4 has given.. thanks! |
Sorry folks, didn't want you to think I forgot about this. Still plan on digging into this deeper this week. Thanks for your patience. |
I think my error was due to cacert::cacert.org cookbook. The workaround has fixed my problem! So no rush, for my part. (thanks for looking at it, by the way!) |
In the Data Collector, when detecting unprocessed resources, a Set was built up using the resource object itself as the Set element. Internally, Set adds this to a Hash. We allow users to create custom resources that could contain a property named "hash" which in turn wires up a `#hash` instance method on the Resource. Ruby expects object's `#hash` method to return a Fixnum that it uses internally. So if a resource had a "hash" property that returned a String, bad things happened. With this change, we make our own Hash and use the resource's object ID in the key so we don't have to worry about the resource's `#hash` method getting called and throwing an exception. I will send up a separate change that warns users when they choose a property name that is already an existing method name. Fixes #5565. Signed-off-by: Adam Leff <adam@leff.co>
@kpmueller and @chr4: I've sent up PR #5604 that will fix this moving forward, and I also plan on adding warnings (and possibly deprecations) if a resource attempts to use a property that happens to be named the same as an existing ruby method, as bad things happen in certain cases, like this one where Thanks again for the report and also thanks for fixing your cookbook! |
In the Data Collector, when detecting unprocessed resources, a Set was built up using the resource object itself as the Set element. Internally, Set adds this to a Hash. We allow users to create custom resources that could contain a property named "hash" which in turn wires up a `#hash` instance method on the Resource. Ruby expects object's `#hash` method to return a Fixnum that it uses internally. So if a resource had a "hash" property that returned a String, bad things happened. With this change, we make our own Hash and use the resource's object ID in the key so we don't have to worry about the resource's `#hash` method getting called and throwing an exception. I will send up a separate change that warns users when they choose a property name that is already an existing method name. Fixes #5565. Signed-off-by: Adam Leff <adam@leff.co>
* Use object ID when detected unprocessed Resources In the Data Collector, when detecting unprocessed resources, a Set was built up using the resource object itself as the Set element. Internally, Set adds this to a Hash. We allow users to create custom resources that could contain a property named "hash" which in turn wires up a `#hash` instance method on the Resource. Ruby expects object's `#hash` method to return a Fixnum that it uses internally. So if a resource had a "hash" property that returned a String, bad things happened. With this change, we make our own Hash and use the resource's object ID in the key so we don't have to worry about the resource's `#hash` method getting called and throwing an exception. I will send up a separate change that warns users when they choose a property name that is already an existing method name. Fixes #5565. Signed-off-by: Adam Leff <adam@leff.co>
Description
Chef run crashes during detect_unprocessed_resources with TypeError: no implicit conversion of nil into Integer
Chef Version
12.16.42-1
Platform Version
Ubuntu 14.04
Replication Case
Dunno
Client Output
Stacktrace
chef-stacktrace.out
The text was updated successfully, but these errors were encountered: