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.
https://github.com/ManageIQ/manageiq/pull/6331
New commit detected on ManageIQ/manageiq/master: https://github.com/ManageIQ/manageiq/commit/de3fbad2eedbb6cfd52d3adff480059d762570c5 commit de3fbad2eedbb6cfd52d3adff480059d762570c5 Author: Madhu Kanoor <mkanoor> AuthorDate: Mon Jan 25 15:23:15 2016 -0500 Commit: Madhu Kanoor <mkanoor> CommitDate: Mon Jan 25 17:43:10 2016 -0500 Add _missing_instance attribute https://bugzilla.redhat.com/show_bug.cgi?id=1301717 If the .missing instance is being used for an instance, preserve the original name in an attribute called _missing_instance in the MiqAeObject. 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(+)
Assigning to add test case
Verified in 5.6.0.2-beta2. 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.
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