Global Variables and dynamic paths

automate

#1

I have a set of variables set per provider and am grabbing these by using a relationship and collection. This holds things such as satellite name, login info etc.

/Common/${/#miq_provision.source.ext_management_system.name}/Default

I need to use some of these same variables during Retirement but the call above does not work as the entry point is wrong. Is there a better way for global stuff and and suggestions on how to do a common variable scheme for provisioning and retirement?

thanks


#2

Here is what we do here:
Create a new domain called Config
Create a namespace for each provider/external system
Create an instance in corresponding namespace for the provider
Having all needed values related to this provider as instance’s attribute.

So when you need infos, you can call $evm.instance_find("/Config/Namespace/class/myprovider") and then retrieve values.


#3

I came up with a different solution: reading the attributes via instance relations and collections. This way you don’t have to specify the domain and domain overrides do apply (if in place).

The initialize_attributes relation calls the appropriate instance (defining the variables) and I collect (map) them into the current object’s attributes. In the example above the method setup can reference the value of remote_machine defined in GlobalSettings as $evm.object['syslog_remote_machine'] .

I can also define default (fallback) values in the .missing instance.