Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MiqExpression.build_relats(ManageIQ::Providers::InfraManager) is not working #16993

Closed
lpichler opened this issue Feb 13, 2018 · 3 comments
Closed

Comments

@lpichler
Copy link
Contributor

caused by #16916

Issue:

MiqExpression.build_relats(ManageIQ::Providers::InfraManager)
end with error:

irb(main):001:0>  MiqExpression.build_relats(ManageIQ::Providers::InfraManager)
PostgreSQLAdapter#log_after_checkout, connection_pool: size: 50, connections: 1, in use: 1, waiting_in_queue: 0
NoMethodError: undefined method `attribute_names' for ManageIQ::Network:Module
Did you mean?  attr_internal
	from /Users/liborpichler/manageiq/manageiq/lib/miq_expression.rb:957:in `build_relats'
	from /Users/liborpichler/manageiq/manageiq/lib/miq_expression.rb:992:in `block in build_relats'
	from /Users/liborpichler/manageiq/manageiq/lib/miq_expression.rb:960:in `each'
	from /Users/liborpichler/manageiq/manageiq/lib/miq_expression.rb:960:in `build_relats'
	from (irb):1
	from /Users/liborpichler/manageiq/manageiq/.bundle/ruby/2.4.0/gems/railties-5.0.6/lib/rails/commands/console.rb:65:in `start'
	from /Users/liborpichler/manageiq/manageiq/.bundle/ruby/2.4.0/gems/railties-5.0.6/lib/rails/commands/console_helper.rb:9:in `start'
	from /Users/liborpichler/manageiq/manageiq/.bundle/ruby/2.4.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:78:in `console'
	from /Users/liborpichler/manageiq/manageiq/.bundle/ruby/2.4.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
	from /Users/liborpichler/manageiq/manageiq/.bundle/ruby/2.4.0/gems/railties-5.0.6/lib/rails/commands.rb:18:in `<top (required)>'
	from bin/rails:4:in `require'
	from bin/rails:4:in `<main>'

Why ?

Rails badly inherit class here
https://github.com/ManageIQ/manageiq/blob/master/lib/miq_expression.rb#L971

it should get Network but it got ManageIQ::Network because of module existence added in #16916

Workaround:

it is working with changing name of module:

diff --git a/lib/manageiq/networka/discovery.rb b/lib/manageiq/networka/discovery.rb
index 434f4cc7f9..d82e7fc817 100644
--- a/lib/manageiq/networka/discovery.rb
+++ b/lib/manageiq/networka/discovery.rb
@@ -1,7 +1,7 @@
 require 'net/ping'

 module ManageIQ
-  module Network
+  module Networka
     module IPMI
       autoload :Discovery, 'manageiq/network/ipmi/discovery'
     end
diff --git a/lib/manageiq/networka/port.rb b/lib/manageiq/networka/port.rb
index 379f1b4de3..1cc4dcf40f 100644
--- a/lib/manageiq/networka/port.rb
+++ b/lib/manageiq/networka/port.rb
@@ -2,7 +2,7 @@ require 'timeout'
 require 'socket'

 module ManageIQ
-  module Network
+  module Networka
     class Port
       def self.all_open?(ost, ports)
         ports.all? { |port| open?(ost, port) }

Suggestion to Fix:

Rename Network module to something different.

Reproducer

just go to:
Compute > Infrastructure > Providers
cc @gildub

@Fryguy
Copy link
Member

Fryguy commented Feb 13, 2018

cc @d-m-u @kbrock

@gildub
Copy link
Contributor

gildub commented Feb 14, 2018

@d-m-u, @kbrock, @Fryguy, effectively interesting that although everything seemed GREEN, ems_infra wasn't. So now we have to look at the test results no matter what.

Anyway this has been addressed although impacting all discovery probes that have been merged in the meantime, working on it...

Ultimately it would be great if the Models relationships could not block us to use or improve name space.

@lpichler
Copy link
Contributor Author

fixed by #16994

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants