-
Notifications
You must be signed in to change notification settings - Fork 167
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
Change typo resouce_type to resource_type #1684
Conversation
if 'resouce_type' not in self.foreman_spec['parent']: | ||
if 'resource_type' not in self.foreman_spec['parent']: |
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.
heh, this uncovers an interesting bug. 🙈
the resource_type
attribute of parent
is always set via
foreman_value['resource_type'] = HAS_APYPIE and inflector.pluralize(key) |
but it's always
parents
.
What we need to check here is not the current foreman_spec
(as that has been enriched already), but the original one passed to __init__
. But then again, I see absolutely no reason for setting this, as I can't think of a situation where a parent would be of a different type than the child?!
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.
cc @mdellweg :)
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.
I think you are saying this chunk of code might be useless?
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.
that's what I am saying.
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.
How do we figure out if it's useless?
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.
The line below this reads:
self.foreman_spec['parent']['resource_type'] = self.foreman_spec['entity']['resource_type']
That means we're using the type of the main entity (the one we're currently executing). As I can't think of a situation where the parent would be a different type, this works just fine
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.
So we can safely assume that the condition always evaluated true and we always set the parent type to match the current ones type. I guess that is at the very least better than "parents".
So if I understand your comment correctly, that means "fixing" this condition will make it false always, now leaving the parent's type to be "parents"? Is this breaking anything? What do we use that resource_type
for? Do we need it to access apypie apis properly?
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.
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.
Does #1725 replace this PR?
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.
It does, and that's why it had a "closes" on this one ;)
there is no way those can be different, but if left unset, other code sets it to "parents" which is obviously wrong Closes: theforeman#1684
there is no way those can be different, but if left unset, other code sets it to "parents" which is obviously wrong Closes: theforeman#1684
there is no way those can be different, but if left unset, other code sets it to "parents" which is obviously wrong Closes: #1684
No description provided.