ManageIQ / manageiq-automation_engine

Automation engine for ManageIQ
Apache License 2.0
11 stars 74 forks source link

fix reload! for MiqAeMethodService #445

Closed kbrock closed 4 years ago

kbrock commented 4 years ago

after reload classes don't exist. and that includes what we were delegating for the class missing

before:

> reload!
Traceback (most recent call last):
       16: from activesupport (5.2.4.3) lib/active_support/dependencies.rb:510:in `load_missing_constant'
       15: from activesupport (5.2.4.3) lib/active_support/dependencies.rb:356:in `require_or_load'
       14: from activesupport (5.2.4.3) lib/active_support/dependencies.rb:37:in `load_interlock'
       13: from activesupport (5.2.4.3) lib/active_support/dependencies/interlock.rb:13:in `loading'
       12: from activesupport (5.2.4.3) lib/active_support/concurrency/share_lock.rb:151:in `exclusive'
       11: from activesupport (5.2.4.3) lib/active_support/dependencies/interlock.rb:14:in `block in loading'
       10: from activesupport (5.2.4.3) lib/active_support/dependencies.rb:37:in `block in load_interlock'
        9: from activesupport (5.2.4.3) lib/active_support/dependencies.rb:373:in `block in require_or_load'
        8: from activesupport (5.2.4.3) lib/active_support/dependencies.rb:475:in `load_file'
        7: from activesupport (5.2.4.3) lib/active_support/dependencies.rb:661:in `new_constants_in'
        6: from activesupport (5.2.4.3) lib/active_support/dependencies.rb:476:in `block in load_file'
        5: from activesupport (5.2.4.3) lib/active_support/dependencies.rb:476:in `load'
        4: from lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:3:in `<top (required)>'
        3: from lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:4:in `<module:MiqAeMethodService>'
        2: from lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:13:in `<class:MiqAeServiceModelBase>'
        1: from lib/miq_automation_engine/engine/miq_ae_method_service.rb:12:in `const_missing'
NoMethodError (undefined method `create_service_model_from_name' for MiqAeMethodService::MiqAeServiceModelBase:Class)

after:

> reload!
sure thing. coming right up
>
coveralls commented 4 years ago

Pull Request Test Coverage Report for Build 4123


Totals Coverage Status
Change from base Build 4062: 0.0%
Covered Lines: 5047
Relevant Lines: 5888

💛 - Coveralls
simaishi commented 4 years ago

Jansa backport details:

$ git log -1
commit f0185addb172cbdbb1b24951b611bfb41224c4c7
Author: Oleg Barenboim <chessbyte@gmail.com>
Date:   Sun May 31 10:10:25 2020 -0400

    Merge pull request #445 from kbrock/class_reload

    fix reload!

    (cherry picked from commit f44fae618cfade841a2b6ddcf12f56ae34baabca)
jrafanie commented 4 years ago

FYI, this is a slippery slope. I've been here. Dev reload of automation engine doesn't work. https://github.com/ManageIQ/manageiq-automation_engine/issues/418. I had a similar change in that issue but couldn't get dev reload to work at all in many situations, specifically: https://github.com/ManageIQ/manageiq-automation_engine/issues/418#issuecomment-603380882

I'm curious which problem this fixes because I think there's lots more buried in automation engine due to file paths not being autoloadable, etc.

kbrock commented 4 years ago

There was a weird class load issue. Just wanted to fix it.

NickLaMuro commented 4 years ago

@kbrock @jrafanie Fixed the title so it doesn't seem like Keenan is on a Vendeta to fix this across the board (which he has been know to do 🙄 ), and clarify this is just a targeted fix for a particular class.