Bug 1299579

Summary: Automate Simulate should support a Retry button
Product: Red Hat CloudForms Management Engine Reporter: mkanoor
Component: AutomateAssignee: mkanoor
Status: CLOSED ERRATA QA Contact: Dmitry Misharov <dmisharo>
Severity: low Docs Contact:
Priority: unspecified    
Version: 5.5.0CC: jhardy, jprause, mkanoor, obarenbo, tfitzger
Target Milestone: GA   
Target Release: 5.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: ui:automate
Fixed In Version: 5.6.0.0 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-29 15:31:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description mkanoor 2016-01-18 16:50:23 UTC
Description of problem:
When doing a simulation to test Automate methods, if the test runs a Automate State Machine runs a state machine which causes a retry. There is no feedback that there was a retry issued and when re-running the request it should preserve the state attributes from the previous run

Version-Release number of selected component (if applicable):


How reproducible:
All the time

Steps to Reproduce:
1. Create an Automate model that has a State Machine that can end in a retry
2. Run a simulation to test the Automate Model from Step 1
3. When the Automation ends in a retry, we should be able to resubmit the request

Actual results:
- There is no indication that a retry was issued
- The state variables from the first run are not passed in the second time
- 

Expected results:
- A separate button for Retry
- Preserve the attributes from the previous step

Additional info:

Comment 3 CFME Bot 2016-01-21 22:07:20 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/929537a832a50d3ccad508c36e5f18d2a118b53d

commit 929537a832a50d3ccad508c36e5f18d2a118b53d
Author:     Madhu Kanoor <mkanoor>
AuthorDate: Mon Jan 18 16:33:40 2016 -0500
Commit:     Madhu Kanoor <mkanoor>
CommitDate: Mon Jan 18 16:33:40 2016 -0500

    Automate UI Simulation support retry button
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1299579
    
    When a user runs Automate Simulation if there is a state machine
    that returns a 'retry'. The UI would show a Retry button in addition
    to the 'Submit' and 'Reset' button.

 app/controllers/application_controller/automate.rb | 29 +++++++++++++++++-----
 .../miq_ae_tools/_resolve_form_buttons.html.haml   |  9 +++++++
 2 files changed, 32 insertions(+), 6 deletions(-)

Comment 4 CFME Bot 2016-01-21 22:07:29 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/224e17ef907f979fb739424de92e1eeb5ce0a072

commit 224e17ef907f979fb739424de92e1eeb5ce0a072
Author:     Madhu Kanoor <mkanoor>
AuthorDate: Tue Jan 19 11:24:36 2016 -0500
Commit:     Madhu Kanoor <mkanoor>
CommitDate: Tue Jan 19 11:24:36 2016 -0500

    Fixed Rubocop errors
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1299579

 app/controllers/application_controller/automate.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comment 5 CFME Bot 2016-01-21 22:07:37 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/cd8c1824cba83e9f5578c6f0adc4e78befcb03b0

commit cd8c1824cba83e9f5578c6f0adc4e78befcb03b0
Author:     Madhu Kanoor <mkanoor>
AuthorDate: Tue Jan 19 14:14:05 2016 -0500
Commit:     Madhu Kanoor <mkanoor>
CommitDate: Tue Jan 19 14:14:05 2016 -0500

    Added spec
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1299579

 .../application_controller/automate_spec.rb        | 59 ++++++++++++++++++++++
 1 file changed, 59 insertions(+)

Comment 6 CFME Bot 2016-01-21 22:07:41 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/a1b74bbe5c9c6a1de6d2b020fa8d7f3633d67979

commit a1b74bbe5c9c6a1de6d2b020fa8d7f3633d67979
Author:     Madhu Kanoor <mkanoor>
AuthorDate: Thu Jan 21 12:00:12 2016 -0500
Commit:     Madhu Kanoor <mkanoor>
CommitDate: Thu Jan 21 12:00:12 2016 -0500

    Missing converstion to YAML of state_info
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1299579

 app/controllers/application_controller/automate.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comment 7 mkanoor 2016-04-19 16:15:22 UTC
Steps to recreate

Create 2 class in a new DOMAIN that you create called MY_DOMAIN.
Under MY_DOMAIN create a new namespace called NS

(1) The first class is called
    METHODS
    
    The class schema has the following attributes/types

    RUN       Type should be method

    Save the class schema



  (1a)  Create Instance in this class called
    RETRY_METHOD

    Set the run so that it points to the retry method that we will create

    RUN = RETRY
    

   (1b)
    Create a new method called retry with the following ruby script
    This will retry 2 times
 
#------------------------------
    root = $evm.root
    
    if root['ae_state_retries'] && root['ae_state_retries'] > 2
      root['ae_result'] = 'ok'
    else
      root['ae_result'] = 'retry'
    end 
      
 #______________

2. Create the Second class

If you create a state machine instance say in
 DOMAIN = MY_DOMAIN
 NAMESPACE = NS
 CLASS = STATE_MACHINE

 and have the following states in its schema

 STATE1         type = state

2(a) Create a new instance called TEST_RETRY and pointing to the instance created in 1b 

    STATE1 = /MY_DOMAIN/NS/METHODS/RETRY_METHOD



3. Create a new instance in the class SYSTEM/REQUEST called MY_TEST. This class already exists in the ManageIQ domain, you can copy it to MY_DOMAIN and add the instance called MY_TEST

The MY_TEST instance should point to 
  /MY_DOMAIN/NS/STATE_MACHINE/TEST_RETRY

(4) In the Automate -> Simulation Screen use

   SYSTEM/PROCESS REQUEST    (Its Automation by default)
   MESSAGE        create     (Default is good)
   REQUEST        MY_TEST       

Under Simulation Parameter make sure that the Execute Method check box is checked.

Hit Sumbit Button

Comment 8 Dmitry Misharov 2016-04-20 12:55:10 UTC
After making all steps from previous comment I was able to verify this bug on 5.6.0.1-beta2.20160413141124_e25ac0e.

Comment 10 errata-xmlrpc 2016-06-29 15:31:17 UTC
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/RHBA-2016:1348