ManageIQ / manageiq-content

Default ManageIQ content
Apache License 2.0
13 stars 120 forks source link

Build is failing #747

Closed kbrock closed 6 months ago

kbrock commented 6 months ago

Issue with

content:

rspec spec/content/automate/ManageIQ/PhysicalInfrastructure/PhysicalServer/Provisioning/StateMachines/Methods.class/__methods__/check_provision_spec.rb:16

1) ManageIQ::Automate::PhysicalInfrastructure::PhysicalServer::Provisioning::StateMachines::Methods::CheckProvision check provision status provisioning completed refreshes the request status
   Failure/Error: described_class.new(ae_service).main

   NameError:
     undefined local variable or method `vm' for #<PhysicalServerProvisionTask id: 25, options: {}, source_id: 334, source_type: "PhysicalServer">
   # ruby/3.1.4/gems/activemodel-6.1.7.7/lib/active_model/attribute_methods.rb:469:in `method_missing'
   # manageiq/app/models/miq_provision_task.rb:15:in `statemachine_task_status'
   # manageiq-automation_engine/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:363:in `public_send'
   # manageiq-automation_engine/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:363:in `block in object_send'
   # manageiq-automation_engine/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:382:in `ar_method'
   # manageiq-automation_engine/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:399:in `ar_method'
   # manageiq-automation_engine/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:361:in `object_send'
   # manageiq-automation_engine/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:192:in `block (3 levels) in expose'
   # manageiq/app/models/user.rb:383:in `with_user'
   # manageiq-automation_engine/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:192:in `block (2 levels) in expose'
   # ./content/automate/ManageIQ/PhysicalInfrastructure/PhysicalServer/Provisioning/StateMachines/Methods.class/__methods__/check_provision.rb:18:in `main'
   # ./spec/content/automate/ManageIQ/PhysicalInfrastructure/PhysicalServer/Provisioning/StateMachines/Methods.class/__methods__/check_provision_spec.rb:17:in `block (4 levels) in <main>'
   # ruby/3.1.4/gems/webmock-3.23.0/lib/webmock/rspec.rb:39:in `block (2 levels) in <main>'

Before

This method was defined in automate Build was 🍏 at this time

# lib/miq_automation_engine/service_models/miq_ae_service_miq_provision.rb
  def statemachine_task_status
    ar_method do
      if %w[finished provisioned].include?(@object.state)
        if @object.status.to_s.downcase == 'error' || @object.vm.nil?
          'error'
        else
          'ok'
        end
      else
        'retry'
      end
    end
  end

After

This method is now defined in core. Build is 🔴 at this time

# app/models/miq_provision.rb
  def statemachine_task_status
    if %w[finished provisioned].include?(state)
      status.to_s.downcase == "error" || vm.nil? ? "error" : "ok"
    else
      "retry"
    end
  end