-
Notifications
You must be signed in to change notification settings - Fork 898
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
Add provisioned? lifecycle status info to retireable? check #18943
Add provisioned? lifecycle status info to retireable? check #18943
Conversation
@d-m-u 'lfu, bdunne, gmcculloug' is an invalid reviewer, ignoring... |
@Fryguy, thoughts? Since you are likely to be vociferous about it... |
Anyone other than Lucy want to look at this, please? |
f0a4922
to
6c52708
Compare
app/models/service.rb
Outdated
@@ -156,7 +156,11 @@ def request_type | |||
end | |||
|
|||
def retireable? | |||
parent.present? ? true : type.present? | |||
if parent.present? && provisioned? |
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 the provisioned?
check effect all services? Meaning, if it is not provisioned can we immediately say it cannot be retired?
def retireable?
false unless provisioned?
parent.present? ? true : type.present?
end
Otherwise, it seems odd that we jump to using type.present?
if parent.present?
is true
but provisioned?
is false
.
I guess the other form of this method I might expect is:
def retireable?
if parent.present?
provisioned?
else
type.present?
end
end
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 the provisioned? check effect all services?
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.
Right. So does that mean that you can immediately return false
if the service is not provisioned? My first example.
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.
Anything currently provisioned has a lifecycle state that isn't set, so we can't currently use this until a data migration (ManageIQ/manageiq-schema#392) to fix that gets in. I'm not sure if there are other cases than this that were missed, @lfu, thoughts?
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.
If a service is in the middle of retirement and failed, is it still considered provisioned? (Tina said yes.) If someone went in and manually retired a vm from a service, is the service still considered provisioned? (Still yes.) Could you conceivably then have a service with all parts and pieces gone that is still "provisioned"? I think you can, and I understand that, but I don't particularly like it.
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 would suggest that we focus on the normal use-case (provision service, then retire service) first and look into what I would consider edge conditions as a follow up. Seems like it would overcomplicate this PR by trying to handle everything here.
But to add thoughts on the questions above, I would think we could write a method to validate if all the parts of a service are retired. Then this check would need to be run at the end of the retirement of a resource and the service could be processed at that time. Or it could be done as a schedule event, but without digging to deep into it I like the first approach better. I am sure there are more nuances here that would need to be flushed out. Again, this would be a follow up effort.
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 for creating the data migration @d-m-u. I'm sure we'll encounter other edge conditions, but I can't think of anything else right now. @lfu Do you have any concerns?
The initial use case for the lifecycle state is to prevent retirement from being called/run while the service is being provisioned. I believe the code changes here satisfy that requirement.
ea3824c
to
755e555
Compare
@miq-bot remove_label wip |
664e915
to
c5e4460
Compare
c5e4460
to
f377318
Compare
Checked commit d-m-u@f377318 with ruby 2.4.6, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0 |
@tinaafitz Can you take another look? |
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.
@bdunne Looks good.
Have the UI tests been run with this change? I suspect they will have tests around this |
@bdunne gimme just a minute, please |
Of the 11 failures I get, they're all 8) Mixins::EmsCommon::Angular get_task_args openstack cloud returns connect options for openstack cloud AMQP tab
Failure/Error: expect(@ems_cloud_controller.send(:get_task_args, 'ManageIQ::Providers::Openstack::CloudManager')).to eq(expected_connect_options)
expected: ["v2:{k8Sm5ygvDAvvY5zkvev1ag==}", {"amqp_api_port"=>"5462", "amqp_hostname"=>"host_amqp", "amqp_security_protocol"=>"non_ssl", "amqp_userid"=>"xyz"}]
got: ["v2:{6yyYgLW3nPt9T1wkYsOzJQ==}", {"amqp_api_port"=>"5462", "amqp_hostname"=>"host_amqp", "amqp_security_protocol"=>"non_ssl", "amqp_userid"=>"xyz"}]
(compared using ==)
Diff:
@@ -1,4 +1,4 @@
-["v2:{k8Sm5ygvDAvvY5zkvev1ag==}",
+["v2:{6yyYgLW3nPt9T1wkYsOzJQ==}", and not a one looks related to any of this code change. |
I mean no they won't, the UI work for this hasn't been done yet. |
@miq-bot add_label enhancement |
We need to factor in the lifecycle status when we ask a service if it's retireable. Contrary to previous suggestions, it makes no sense to use the supports_feature mixin, because that's a class check and this is specific to the instance. It may as well just be part of this check, as well.
I just wanted to start the conversation and get feedback and buy-in. I'm not taking into account places this is overridden yet cause I wanted opinions first.
start for https://bugzilla.redhat.com/show_bug.cgi?id=1595511
@miq-bot assign @tinaafitz