-
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
Pass name by knife cil attribute #3195
Pass name by knife cil attribute #3195
Conversation
👍 /cc @chef/client-core |
@ranjib Yes 😃 I wrote a spec for this issue to cover compatibility on future. And I'll run integration test to avoid same problem with my plugin like below. This build is scheduled at every night by my heroku scheduler 👍 |
@@ -182,7 +182,7 @@ def extract_nested_value(data, nested_value_spec) | |||
# `keys` - want the key named `keys`, not a list of | |||
# available keys. | |||
elsif data.respond_to?(:[]) | |||
data = data[attr] | |||
data = data[attr] ? data[attr] : data.send(attr.to_sym) |
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.
Looks like this is basically duplicating the next elsif
clause ( elsif data.respond_to?(attr.to_sym)
). Would it be better to change the elsif
clause on line 184 to data.respond_to?(:[]) && data.has_key?(attr)
?
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.
Otherwise we probably need to guard this with a respond_to?
which would then completely duplicate the next elsif
statement.
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.
Agreed about
elsif data.respond_to?(:[]) && data.has_key?(attr)
data = data[attr]
elsif data.respond_to?(attr.to_sym)
data = data.send(attr.to_sym)
Thanks, that is better. I'll update my branch after a few hours. |
I've updated code to reflect comments |
👍 from me. Would be nice to have a test that covers |
👍 |
👍 I presume @danielsdeleo's comment means he's going to add a test and merge this? |
Merged w/ 182f376 |
Hi,
We can't pass attribute which named
name
since this change #2338 via knife ssh.I would like to fix it.