find(:all) method is deprecated in Red Hat Cloudforms 4.2

Solution Verified - Updated -

Issue

  • Below automate code works in Red Hat Cloudforms 3.2 but not in Red Hat Cloudforms 4.2:
$evm.vmdb('cloud_tenant').find(:all).each do |project|
  #if vm.evm_owner_name == myname && vm.vendor == 'OpenStack' && vm.active
  # $evm.log("info", "sam project>>>  \t : #{project.inspect}")
  project_name=project[:name]
  project_id=project[:id]
  if project_name.eql?(alloc_tenant_project)
    $evm.log("info", "sam alloc_tenant_project Found !!!!!! ID cis: "+project_id.to_s)
    prov.set_option(:cloud_tenant,[project_id,project_name])
    found=true
  end
end

Line 1 ($evm.vmdb('cloud_tenant').find(:all).each do |project|) encountered error and here is the error log:

[----] E, [2017-02-27T17:22:54.596558 #2965:67cfaa0] ERROR -- : Q-task_id([miq_provision_2000000000031]) <AutomationEngine> <AEMethod acquire_ip_by_project_osp7> The following error occurred during method evaluation:
[----] E, [2017-02-27T17:22:54.596980 #2965:67cfaa0] ERROR -- : Q-task_id([miq_provision_2000000000031]) <AutomationEngine> <AEMethod acquire_ip_by_project_osp7>   DRb::DRbRemoteError: Service Model not found (MiqAeException::ServiceNotFound)
[----] E, [2017-02-27T17:22:54.597792 #2965:67cfaa0] ERROR -- : Q-task_id([miq_provision_2000000000031]) <AutomationEngine> <AEMethod acquire_ip_by_project_osp7>   (druby://127.0.0.1:38421) /var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_service_model_base.rb:24:in `rescue in method_missing'

Environment

  • Red Hat Cloudforms 4.2

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.