-
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
Initial commit for new generic service state machine. #24
Initial commit for new generic service state machine. #24
Conversation
3ff6bb5
to
7be7197
Compare
5a2caff
to
baef842
Compare
model. Related Automate Model State Machines changes: ManageIQ/manageiq-content#24
|
||
service.preprocess(@handle.root["service_context"]) | ||
|
||
# Through service you can examine the orchestration template, manager (i.e., provider) |
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.
Let's delete the commented out sample code
private | ||
|
||
def wait_for_completion(service) | ||
status, reason = status, reason = service.wait_for_completion(@handle.root["service_context"]) |
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.
Need to handle retry here. is wait_for_completion
the right method for service?
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.
end | ||
|
||
@handle.log("info", "Starting Check Refreshed") | ||
service.check_refreshed(@handle.root["service_context"]) |
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.
Need to handle retry here.
88d2874
to
6aa1aef
Compare
6aa1aef
to
4f6076c
Compare
max_time: | ||
- field: | ||
aetype: state | ||
name: wait_for_completion |
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.
should be check_for_completion
or check_completed
, similar to check_refreshed
below.
private | ||
|
||
def check_refreshed(service) | ||
service.check_refreshed(@handle.root["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.
something like
def check_refreshed(service)
done, message = service.check_refreshed(@handle.root['action'])
if done
@handle.root['ae_result'] = message.blank? ? 'ok' : 'error'
@handle.root['ae_reason'] = message
else
@handle.root['ae_result'] = 'retry'
end
end
4f6076c
to
755c853
Compare
LGTM |
end | ||
|
||
def main | ||
@handle.log("info", "Starting execute") |
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 Should we log the service_action here
@handle.log("info", "Starting execute") | ||
|
||
task = @handle.root["service_template_provision_task"] | ||
service = task.destination |
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 Check if task is nil
service = task.destination | ||
|
||
begin | ||
service.execute(@handle.root["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 Check if service is nil
def main | ||
@handle.log("info", "Starting PostProcessing") | ||
|
||
task = @handle.root["service_template_provision_task"] |
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 Should we add a 2 line method called get_service and raise an exception if service is not found
status = @handle.inputs['status'] | ||
|
||
updated_message = String.new | ||
updated_message << "Server [#{@handle.root['miq_server'].name}] " |
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 Should we add service_action in the enhanced messaging
bb24ca7
to
73c9ec5
Compare
Checked commits tinaafitz/manageiq-content@755c853~...73c9ec5 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 content/automate/ManageIQ/Service/Generic/StateMachines/GenericLifecycle.class/methods/update_status.rb
|
Related Automate model changes. ManageIQ/manageiq-content#24
The methods are intended to be a starting point to customize for ansible processing.
Provision succeeds with empty provisioning methods.