Description of problem: It would be useful for the on_entry and on_error methods in a state machine to be able to advance the ae_state of the state machine. For an on_entry method, this would be useful if the method checked pre-conditions for the running of the main state method, and determined that the method was not required to run. (e.g. if a VM is already powered off, don't run the shutdown_vm main method) For the on_error method, it would be useful to be able to handle and recover from an error, and continue the state machine processing. (e.g. if vm.shutdown_guest times out because the guest agent isn't installed, perform a vm.stop and continue the state machine)
https://github.com/ManageIQ/manageiq/pull/2860
New commit detected on manageiq/master: https://github.com/ManageIQ/manageiq/commit/7d2bf40a3753547d026af62a955a58dec2686672 commit 7d2bf40a3753547d026af62a955a58dec2686672 Author: Madhu Kanoor <mkanoor> AuthorDate: Fri Jun 19 15:54:14 2015 -0400 Commit: Madhu Kanoor <mkanoor> CommitDate: Fri Jun 26 09:53:06 2015 -0400 Refactoring of Automate Engine code Separated State Machine specific code into a separate module Moved the state machine spec into engine_validation directory https://bugzilla.redhat.com/show_bug.cgi?id=1215990 .../miq_automation_engine/engine/miq_ae_object.rb | 123 +------------------- .../engine/miq_ae_state_machine.rb | 124 +++++++++++++++++++++ .../miq_ae_state_machine_retry_spec.rb | 105 +++++++++++++++++ .../miq_ae_state_machine_retry_spec.rb | 105 ----------------- 4 files changed, 231 insertions(+), 226 deletions(-) create mode 100644 vmdb/lib/miq_automation_engine/engine/miq_ae_state_machine.rb create mode 100644 vmdb/spec/automation/unit/engine_validation/miq_ae_state_machine_retry_spec.rb delete mode 100644 vmdb/spec/lib/miq_automation_engine/miq_ae_state_machine_retry_spec.rb
New commit detected on manageiq/master: https://github.com/ManageIQ/manageiq/commit/8afedec1ae688f6de9e88bde88f0d25fa29acd2b commit 8afedec1ae688f6de9e88bde88f0d25fa29acd2b Author: Madhu Kanoor <mkanoor> AuthorDate: Mon Jun 22 11:37:23 2015 -0400 Commit: Madhu Kanoor <mkanoor> CommitDate: Fri Jun 26 09:53:30 2015 -0400 Automate State Machine enhancements (1) Optionally allow for methods to set the next state to execute using a new attribute in the root object called 'ae_next_state' e.g. $evm.root['ae_next_state'] = state_name (2) Allow for a state to be skipped by setting the method result attribute 'ae_result' to be skip in the root object. e.g. $evm.root['ae_result'] = 'skip' The next state in the instance is used when you use skip. You dont have to know the state name like with $evm.root['ae_next_state'] (3) Allow for continuation of a state machine in case of errors by setting the method result attribute 'ae_result' to continue int the root object. e.g. $evm.root['ae_result'] = 'continue' https://bugzilla.redhat.com/show_bug.cgi?id=1215990 .../engine/miq_ae_state_machine.rb | 55 +++- .../miq_ae_state_machine_retry_spec.rb | 97 +++++-- .../miq_ae_state_machine_steps_spec.rb | 311 +++++++++++++++++++++ vmdb/spec/support/automation_spec_helper.rb | 15 + 4 files changed, 438 insertions(+), 40 deletions(-) create mode 100644 vmdb/spec/automation/unit/engine_validation/miq_ae_state_machine_steps_spec.rb
New commit detected on manageiq/master: https://github.com/ManageIQ/manageiq/commit/ddcbfcbb260fb88c610eaee94cc1d2e2d6c12fe4 commit ddcbfcbb260fb88c610eaee94cc1d2e2d6c12fe4 Author: Madhu Kanoor <mkanoor> AuthorDate: Tue Jun 23 16:16:58 2015 -0400 Commit: Madhu Kanoor <mkanoor> CommitDate: Fri Jun 26 09:53:50 2015 -0400 PR review changes Use Timecop in spec https://bugzilla.redhat.com/show_bug.cgi?id=1215990 .../engine/miq_ae_state_machine.rb | 9 +++++---- .../miq_ae_state_machine_retry_spec.rb | 20 ++++++++++++++------ 2 files changed, 19 insertions(+), 10 deletions(-)
Verified in 5.5.0.13. I will include the exported AE things I used.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2015:2551