How to limit user-initiated change of Service retires_on? #23573
Replies: 2 comments
-
@agrare Can you take a look at this one? |
Beta Was this translation helpful? Give feedback.
-
I've been poking through code hoping to find a clue. Eventually I got to Back in the Automation Engine, I see the if $evm.root['miq_request'].options[:retires_on] > $evm.root['service'].created_on + 30.days
raise 'some error message'
end ... but when I tried it, it seems neither method actually gets called, like the whole Service retirement state machine is not involved in the process. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When a user goes to their active Service in the service ui, then to the Lifecycle dropdown, they can change the retirement date for the whole service.
In the logs, I can see some
api
logs, oneevm
log, and anaudit
log indicating that this has happened.However, there does not seem to be any corresponding Event in the Automation Engine or Policy. So, I have no idea which state machine or class I should copy+modify or which Event to use as a policy trigger in order to enforce that a user can't sent a date arbitrarily far in the future, eg. they'd be limited to 30 days from
Service.created_on
.When I asked some colleagues that have more experience with MIQ, one of them had added a different button to their service dialog that triggers a wholly separate state machine. This works for them, but the original Lifecycle button is still there, allowing arbitrary dates to be set. They cover over that gap with other policies, but since I can't seem to find any information about when the relevant events fire (or, indeed, what events are relevant) I feel like I can't rely on a policy-based solution.
My intuition was that there would be a "Service Reconfigure" event, or that since the api calls
Api::ServicesController.retire_resource
the "Service Retire" event would be the place to look. My only remaining guess was customizing theRetireService
instance and method, but since that starts off by marking the service as retired and that does not happen when only changing the retire date, I'm out of guesses.Beta Was this translation helpful? Give feedback.
All reactions