-
Notifications
You must be signed in to change notification settings - Fork 120
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
Generic Service State Machine update_status change #85
Conversation
@miq-bot add-label services, fine/yes |
@bzwei Please review |
end | ||
|
||
context "on_error provisioning" do | ||
let(:root_object) do |
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.
You can move let(:root_object)
out of the context block, and assign 'service_action' => service_action
. Then within each context block you only need to have let(:service_action) { 'Provision/Retirement'}
|
||
def updated_message(status) | ||
updated_message = "Server [#{@handle.root['miq_server'].name}] " | ||
updated_message += "Service [#{service.name}] #{service_action} " |
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.
@tinaafitz the service method is being called here to fetch the service object, if someone wants to log another property from the service object, they would call service.some_property that would end up calling the method again. So can we pass the service into this method
0f7cf69
to
1325baa
Compare
# Get status from input field status | ||
status = @handle.inputs['status'] | ||
|
||
update_task(updated_message(service, status), status) |
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.
Both lines have update_message(service, status)
. Is it right?
# Get status from input field status | ||
status = @handle.inputs['status'] | ||
|
||
update_task(updated_message(service, status), status) |
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.
@tinaafitz
We would be calling the service function multiple times here, in case of error there are 3 method calls.
Maybe we can do this in a separate PR. We can either use a @service attribute in the method and just use it everywhere, so we dont have to pass it around or call the function multiple times
1325baa
to
3263b0e
Compare
Checked commit tinaafitz@3263b0e with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
👍 |
Generic Service State Machine update_status change (cherry picked from commit c9739f2)
Fine backport details:
|
Modified the update_status method to use new on_error method.
https://www.pivotaltracker.com/story/show/142796573
Related PR ManageIQ/manageiq#14583