Coder Social home page Coder Social logo

Comments (13)

thearifismail avatar thearifismail commented on August 15, 2024 1

@jrafanie Here are the steps to reproduce the problem:

  1. git clone [email protected]:ManageIQ/manageiq.git
  2. Run the server using bin/rails s
  3. Using rails console, add a couple of physical chasses using
    chassis = ManageIQ::Providers::Redfish::PhysicalInfraManager::PhysicalChassis.new( :name => "my_redfish_chassis")
    chassis.save!
    chassis = ManageIQ::Providers::Lenovo::PhysicalInfraManager::PhysicalChassis.new( :name => "my_lenovo_chassis")
    chassis.save!
  4. Log into MiQ and hit http://localhost:3000/physical_chassis and it should load the two chasses just created.
  5. Stop ManageIQ.
  6. git clone [email protected]:ManageIQ/manageiq-api.git
  7. create file <mangeiq_dir>/bundler.d/overrides.rb
  8. To override, the default manageiq-api, add to the overrides.rb override_gem "manageiq-api", :path => "<PATH_TO _THE_PARENT_DIR>/manageiq-api
  9. Start ManageIQ, login and hit http://localhost:3000/physical_chassis
    PROBLEM: Page not found and the development log should show the FATAL errors reported in the original description.

from manageiq-api.

Fryguy avatar Fryguy commented on August 15, 2024 1

Hugh step back but why is controllers/api on the load path? That alone feels like recipe for disaster, because it effectively unnamespaces from autoloads point of view

from manageiq-api.

himdel avatar himdel commented on August 15, 2024

The controller is actually namespaced right... so, possibly the culprit is something in graphql:

manageiq-graphql-5f68621f2791/lib/manageiq/graphql/rest_api_proxy.rb:18:in `call'

Not sure what that's doing there or why it gets called though.

from manageiq-api.

thearifismail avatar thearifismail commented on August 15, 2024

Could not reproduce the problem when using master stream and no bundler.d/overrides.rb used.
physical_chassis

Could reproduce the problem when "bundler.d/overrides.rb" was used to load "manageiq-api".

from manageiq-api.

jrafanie avatar jrafanie commented on August 15, 2024

@thearifismail asked me to take a look at this... I can't recreate this. I can envision the only way this can occur:

irb(main):002:0> pp $LOAD_PATH.grep(/controllers/)
["/Users/joerafaniello/.gem/ruby/2.4.5/bundler/gems/manageiq-v2v-63d961599bea/app/controllers",
 "/Users/joerafaniello/.gem/ruby/2.4.5/bundler/gems/manageiq-ui-classic-01c014825f79/app/controllers/mixins",
 "/Users/joerafaniello/.gem/ruby/2.4.5/bundler/gems/manageiq-ui-classic-01c014825f79/app/controllers",
 "/Users/joerafaniello/.gem/ruby/2.4.5/gems/high_voltage-3.0.0/app/controllers",
 "/Users/joerafaniello/.gem/ruby/2.4.5/gems/high_voltage-3.0.0/app/controllers/concerns",
 "/Users/joerafaniello/.gem/ruby/2.4.5/bundler/gems/manageiq-graphql-82fdd9385bdd/app/controllers",
 "/Users/joerafaniello/.gem/ruby/2.4.5/bundler/gems/manageiq-api-55621be8daa6/app/controllers/api",
 "/Users/joerafaniello/.gem/ruby/2.4.5/bundler/gems/manageiq-api-55621be8daa6/app/controllers"]

Something tries to autoload the constant PhysicalChassisController using the "/Users/joerafaniello/.gem/ruby/2.4.5/bundler/gems/manageiq-api-55621be8daa6/app/controllers/api" from the load path. The constant defined by that file is Api:: PhysicalChassisController. I tried dropping the other controller paths from the load path and couldn't recreate it so I have something wrong.

Does this only happen in dev mode? Maybe it's not code reloading friendly?

from manageiq-api.

jrafanie avatar jrafanie commented on August 15, 2024

@himdel ^

from manageiq-api.

thearifismail avatar thearifismail commented on August 15, 2024

To see if the problem was caused by overriding just the manageiq-api or other plugins also, I used manageiq-graphql and removed manageiq-api from the bundler.d/overrides.rb. The problem went away. It appears that the problem occurs only in dev mode and is limited to manageiq-api.

This is what I get:
irb(main):020:0> pp $LOAD_PATH.grep(/controllers/)
["/Users/aarif/Documents/dev-ws/manageiq-api-thearifismail/app/controllers/api",
"/Users/aarif/Documents/dev-ws/manageiq-api-thearifismail/app/controllers",
"/Users/aarif/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/bundler/gems/manageiq-v2v-63d961599bea/app/controllers",
"/Users/aarif/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/bundler/gems/manageiq-ui-classic-2359c9dfbb77/app/controllers/mixins",
"/Users/aarif/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/bundler/gems/manageiq-ui-classic-2359c9dfbb77/app/controllers",
"/Users/aarif/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/high_voltage-3.0.0/app/controllers",
"/Users/aarif/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/high_voltage-3.0.0/app/controllers/concerns",
"/Users/aarif/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/bundler/gems/manageiq-graphql-82fdd9385bdd/app/controllers"]
=> ["/Users/aarif/Documents/dev-ws/manageiq-api-thearifismail/app/controllers/api", "/Users/aarif/Documents/dev-ws/manageiq-api-thearifismail/app/controllers", "/Users/aarif/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/bundler/gems/manageiq-v2v-63d961599bea/app/controllers", "/Users/aarif/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/bundler/gems/manageiq-ui-classic-2359c9dfbb77/app/controllers/mixins", "/Users/aarif/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/bundler/gems/manageiq-ui-classic-2359c9dfbb77/app/controllers", "/Users/aarif/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/high_voltage-3.0.0/app/controllers", "/Users/aarif/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/high_voltage-3.0.0/app/controllers/concerns", "/Users/aarif/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/bundler/gems/manageiq-graphql-82fdd9385bdd/app/controllers"]
irb(main):021:0>

from manageiq-api.

himdel avatar himdel commented on August 15, 2024

@jrafanie I'm not quite sure if it's limited to dev mode or just less likely to appear otherwise, but for me, the surest way to recreate the issue in cases it went away was to simply touch manageiq-api/app/controllers/api/physical_chassis_controller.rb.

So, yeah, I'm guessing autoloader issues..

from manageiq-api.

tadeboro avatar tadeboro commented on August 15, 2024

I can replicate the error by performing the following steps:

  1. Checkout latest master branch of manageiq core repo.
  2. Remove all overrides from bundler.d.
  3. Run bin/update.
  4. Add override_gem "manageiq-api", :path => "/path/to/manageiq-api to overrides, where /path/to/manageiq-api repo has checked-out latest master.
  5. Visit http://localhost:3000/physical_chassis/show_list

If I remove the override, the error is gone.

from manageiq-api.

jrafanie avatar jrafanie commented on August 15, 2024

Hugh step back but why is controllers/api on the load path? That alone feels like recipe for disaster, because it effectively unnamespaces from autoloads point of view

Good point. I believe I tried removing the controllers/api from the autoload path at some point and it was a disaster. It's probably the best thing to do even if it's breaks everywhere. I'll see if I can dig up the problems I encountered when I did that.

from manageiq-api.

Fryguy avatar Fryguy commented on August 15, 2024

Taking it a step further, when you put a directory on the autoloads path, that implies the directory name is not in the namespace (e.g. we don't have Mixins::PasswordMixin). The fact that Api:: is a thing should preclude it from being on the autoload path

from manageiq-api.

Fryguy avatar Fryguy commented on August 15, 2024

I think this can be closed now that the autoload_path no longer contains manageiq-api/app/controllers/api.

If anyone can reproduce on the latest code, please feel free to reopen,

from manageiq-api.

himdel avatar himdel commented on August 15, 2024

πŸ‘ I just retried #489 (comment) and I can't reproduce it anymore :)

from manageiq-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.