Openstack - Target Refresh

Hello,

I have a service in my Catalog which to create a stack on Openstack to create, for example, a new tenant with all child objects (networks, security groups, …).

Once the service request has started, i have a new stack which appears in Compute > Stacks. I would like to refresh a specific resource inside this stack, for example, the cloud tenant ems_ref which corresponds to the tenant uuid on Openstack.

I am able to refresh this specific target with the rails console as follow:

ems = ManageIQ::Providers::Openstack::CloudManager.first
$evm = MiqAeMethodService::MiqAeService.new(MiqAeEngine::MiqAeWorkspaceRuntime.new)
stack = $evm.vmdb(:orchestration_stack).find_by(:name => “MyStack”)
stack.resources.each do |resource|
case resource.resource_category
when “OS::Keystone::Project”
target = InventoryRefresh::Target.new(:manager => ems, :association => :cloud_tenants, :manager_ref => {:ems_ref => resource.ems_ref})
EmsRefresh.refresh(target)
end
end

When i am trying to use this code inside the Automate, it does not find the “InventoryRefresh” instance. The following error pops up in the automation.log

NameError: uninitialized constant “InventoryRefresh”

provider = service.orchestration_manager
stack = service.orchestration_stack
refreshed_stack = @handle.vmdb(:orchestration_stack).find_by(:name => stack.name,
:ems_ref => stack.ems_ref)

refreshed_stack.resources.each do |resource|
case resource.resource_category
when “OS::Keystone::Project”
target = InventoryRefresh::Target.new(:manager => provider, :association => :cloud_tenants, :manager_ref => {:ems_ref => resource.ems_ref})
EmsRefresh.refresh(target)
end
end

Thank you very much for your help.
Regards,