A state machine in ManageIQ or CloudForms can be used to describe a sequence of tasks executed during specific actions. A state machine offers logic for retries, error handling and can be easily created and optimised to accomplish complex tasks.
For quite some time there was a limitation in the state machine, if variables had to be carried between different stages (Bugzilla #1044175). It worked fine, until a state had to be re-executed (retry) which caused the “collect” feature to loose the data.
Since CloudForms 3.1 there are three new calls to store and retrieve data between different stages in a state machine:
if $evm.state_var_exist?("test_data") test_data = $evm.get_state_var("test_data") # TODO: Something interesting else # First time through, initialize data $evm.set_state_var("test_data", 1) end