Bug 1301717 - Missing instance processing in Automate engine doesn't preserve the instance name that was missing
Missing instance processing in Automate engine doesn't preserve the instance ...
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate (Show other bugs)
Unspecified Unspecified
unspecified Severity low
: GA
: 5.6.0
Assigned To: mkanoor
Milan Falešník
Depends On:
  Show dependency treegraph
Reported: 2016-01-25 14:30 EST by mkanoor
Modified: 2017-03-17 05:39 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2016-06-29 11:33:17 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description mkanoor 2016-01-25 14:30:34 EST
Description of problem:
In Automate Models a .missing instance can be used to provide default behaviors when an instance is missing. Automate models support substitutions from user defined attributes, we don't have an attribute that stores the name of the original instance. One use case we have for this we have to always have a method instance to accompany a method script, we can't have one instance (.missing) that can point to the method scripts. If we can store the missing instance as an attribute it can be used to locate the correct method.

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

How reproducible:
New feature

Steps to Reproduce:
1. In a namespace (NS1) add a new class (classA) add a schema to it to have a method field (mfield)
2. Add a .missing instance, set the value in the method field (mfield) to ${#_missing_instance}
3. Add multiple methods in the class (classA), test1, test2, test3, please note you are only adding method scripts but no instances.
4. Create a new class (classB) and add a schema to it to have a relation ship field (rel)
5. Create an instance in ClassB (call_any_method) and set the relationship field (rel) to NS1/ClassA/test1, this points to a non existent instance, we will pick up the .missing instance and run the method test1.

Actual results:
New feature

Expected results:
A single missing instance can call methods without having a 1-1 relationship between method instance and method scripts.

Additional info:
This feature is typically handy in Automate State machine, today users end up using the on_entry field to directly call the method without having an instance. The state machine states can only point to relationships they can't directly point to a method. This feature allows them to use the .missing instance and not provide one instance for every method.
Comment 3 CFME Bot 2016-01-29 09:26:07 EST
New commit detected on ManageIQ/manageiq/master:

commit de3fbad2eedbb6cfd52d3adff480059d762570c5
Author:     Madhu Kanoor <mkanoor@redhat.com>
AuthorDate: Mon Jan 25 15:23:15 2016 -0500
Commit:     Madhu Kanoor <mkanoor@redhat.com>
CommitDate: Mon Jan 25 17:43:10 2016 -0500

    Add _missing_instance attribute
    If the .missing instance is being used for an instance, preserve
    the original name in an attribute called _missing_instance in the
    This attribute can be used in substitution.

 lib/miq_automation_engine/engine/miq_ae_object.rb    |  1 +
 spec/lib/miq_automation_engine/miq_ae_engine_spec.rb | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+)
Comment 4 Shveta 2016-02-01 16:31:31 EST
Assigning to add test case
Comment 5 Milan Falešník 2016-04-18 11:36:42 EDT
Verified in I did not go the long way for verification, I just tried to call a method using .missing and _missing_instance expansion and it worked.
Comment 7 errata-xmlrpc 2016-06-29 11:33:17 EDT
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.


Note You need to log in before you can comment on or make changes to this bug.