Skip to content
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

Merged
merged 2 commits into from
Feb 2, 2017

Conversation

tinaafitz
Copy link
Member

@tinaafitz tinaafitz commented Jan 20, 2017

The methods are intended to be a starting point to customize for ansible processing.

Provision succeeds with empty provisioning methods.

playbook_provision_complete

@tinaafitz
Copy link
Member Author

@bzwei

@tinaafitz tinaafitz force-pushed the generic_service_statemachine branch 5 times, most recently from 3ff6bb5 to 7be7197 Compare January 23, 2017 21:29
@tinaafitz tinaafitz force-pushed the generic_service_statemachine branch 3 times, most recently from 5a2caff to baef842 Compare January 31, 2017 20:40
tinaafitz added a commit to tinaafitz/manageiq that referenced this pull request Jan 31, 2017

service.preprocess(@handle.root["service_context"])

# Through service you can examine the orchestration template, manager (i.e., provider)
Copy link
Contributor

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"])
Copy link
Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bzwei @mkanoor and I discussed the name this morning and determined that it was okay because we're not doing the internal methods. I'm open to changing it though. Can you think of a better name?

end

@handle.log("info", "Starting Check Refreshed")
service.check_refreshed(@handle.root["service_context"])
Copy link
Contributor

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.

@tinaafitz tinaafitz force-pushed the generic_service_statemachine branch 2 times, most recently from 88d2874 to 6aa1aef Compare February 1, 2017 14:24
@tinaafitz tinaafitz force-pushed the generic_service_statemachine branch from 6aa1aef to 4f6076c Compare February 1, 2017 19:22
max_time:
- field:
aetype: state
name: wait_for_completion
Copy link
Contributor

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"])
Copy link
Contributor

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

@tinaafitz tinaafitz force-pushed the generic_service_statemachine branch from 4f6076c to 755c853 Compare February 1, 2017 21:37
@bzwei
Copy link
Contributor

bzwei commented Feb 1, 2017

LGTM

@tinaafitz tinaafitz changed the title [WIP]Initial commit for new generic service state machine. Initial commit for new generic service state machine. Feb 1, 2017
end

def main
@handle.log("info", "Starting execute")
Copy link
Contributor

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
Copy link
Contributor

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"])
Copy link
Contributor

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"]
Copy link
Contributor

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}] "
Copy link
Contributor

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

@tinaafitz tinaafitz force-pushed the generic_service_statemachine branch from bb24ca7 to 73c9ec5 Compare February 2, 2017 18:46
@miq-bot
Copy link
Member

miq-bot commented Feb 2, 2017

Checked commits tinaafitz/manageiq-content@755c853~...73c9ec5 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
9 files checked, 1 offense detected

content/automate/ManageIQ/Service/Generic/StateMachines/GenericLifecycle.class/methods/update_status.rb

@mkanoor mkanoor closed this Feb 2, 2017
@mkanoor mkanoor reopened this Feb 2, 2017
tinaafitz added a commit to tinaafitz/manageiq that referenced this pull request Feb 2, 2017
@mkanoor mkanoor merged commit ef4c672 into ManageIQ:master Feb 2, 2017
@mkanoor mkanoor added this to the Sprint 54 Ending Feb 13, 2017 milestone Feb 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants