-
Notifications
You must be signed in to change notification settings - Fork 90
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
Replace the usage of const_defined? in the WinRM detection helper #406
Conversation
Ruby 2.6.1 came with some [changes](ruby/ruby#2061) to `const_defined?` that now have it evaluating as true from this helper method, matching the behavior of `const_get`, even though the constant is inaccessible by name. This results in an exception bubbling up from the `winrm?` method: ``` ✗ bundle exec kitchen verify default-amazonlinux-2-chef-14 -----> Starting Kitchen (v1.24.0) -----> Verifying <default-amazonlinux-2-chef-14>... >>>>>> ------Exception------- >>>>>> Class: Kitchen::ActionFailed >>>>>> Message: 1 actions failed. >>>>>> Failed to complete #verify action: [uninitialized constant Train::Transports::WinRM] on default-amazonlinux-2-chef-14 ``` A quick way around it is to make this backend comparison match the one [here](https://github.com/inspec/train/blob/v1.7.2/lib/train/platforms/detect/specifications/os.rb#L24). Signed-off-by: Jonathan Hartman <[email protected]>
For the record, I'm a little unclear on what's going on in Inspec/Train's requires/includes to result in this. If it looks more like a Ruby bug to y'all, please disregard. I started here after discovering that |
Kitchen reports this as
I applied @RoboticCheese's PR manually to the installed gem and the issue goes away. |
Commited while investigating what ended up being a Train bug specific to Ruby 2.6 [1]. No harm in keeping it around. 1. inspec/train#406
Hit this same exact issue the other day. Would be great to see this merged if possible |
@clintoncwolfe really sorry to bother you directly but Test Kitchen is unusable on Ruby 2.6 due to the above issue. Any chance this PR or some alternative solution can get some attention soon? Thank you 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @RoboticCheese
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks - I'm not sure how that was working in the first place. Also, kudos for excellent tests!
…spec#406) Ruby 2.6.1 came with some [changes](ruby/ruby#2061) to `const_defined?` that now have it evaluating as true from this helper method, matching the behavior of `const_get`, even though the constant is inaccessible by name. This results in an exception bubbling up from the `winrm?` method: ``` ✗ bundle exec kitchen verify default-amazonlinux-2-chef-14 -----> Starting Kitchen (v1.24.0) -----> Verifying <default-amazonlinux-2-chef-14>... >>>>>> ------Exception------- >>>>>> Class: Kitchen::ActionFailed >>>>>> Message: 1 actions failed. >>>>>> Failed to complete #verify action: [uninitialized constant Train::Transports::WinRM] on default-amazonlinux-2-chef-14 ``` A quick way around it is to make this backend comparison match the one [here](https://github.com/inspec/train/blob/v1.7.2/lib/train/platforms/detect/specifications/os.rb#L24). Signed-off-by: Jonathan Hartman <[email protected]>
Ruby 2.6.1 came with some changes to
const_defined?
that now have it evaluating as true from this helper method, matching the behavior ofconst_get
, even though the constant is inaccessible by name. This results in an exception bubbling up from thewinrm?
method:A quick way around it is to make this backend comparison match the one here.
Signed-off-by: Jonathan Hartman [email protected]