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

oxidized superclass mismatch for class http #2154

Closed
typecookie opened this issue Jul 15, 2020 · 17 comments
Closed

oxidized superclass mismatch for class http #2154

typecookie opened this issue Jul 15, 2020 · 17 comments

Comments

@typecookie
Copy link

typecookie commented Jul 15, 2020

When using http as input and connected to librenms (using http as source)

possibly i am just dumb

input: default: ssh, telnet, http debug: false ssh: secure: false ftp: passive: true utf8_encoded: true

source: default: http debug: false http: url: https://librenms/api/v0/oxidized map: name: hostname model: os group: group headers: X-Auth-Token: '01582bf94c03104ecb7953dsadsadwed'

@typecookie
Copy link
Author

any help on this Im willing to do some testing just need pointed in the right direction

@ytti
Copy link
Owner

ytti commented Jul 29, 2020

Where ever this is happening, we need to change reference there to fully qualified class path or we must at least include the Input::X Source::X parent class to disambiguate.

@typecookie
Copy link
Author

i think it is happening at least for the source in lib/oxidized/nodes.rb and possibly rewriting the "@source" definition.
Im not sure how to redefine using the Qualified class path Ive tried putting in a couple of variants in a couple of places but i just keep breaking it.

Im a script monkey and all my code is haky

@ytti
Copy link
Owner

ytti commented Jul 29, 2020

If you have traceback, that would help. Somewhere we say Http, we should say Source::Http or Input::Http to disambiguate.

@typecookie
Copy link
Author

typecookie commented Jul 29, 2020

its not traceback but i have the error log

superclass mismatch for class HTTP [TypeError]

/var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/input/http.rb:6:in `<module:Oxidized>'
/var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/input/http.rb:1:in `<top (required)>'
/usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/manager.rb:9:in `load'
/var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/manager.rb:60:in `loader'
/var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/manager.rb:35:in `add_input'
/var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/node.rb:155:in `block in resolve_input'
/var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/node.rb:154:in `map'
/var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/node.rb:154:in `resolve_input'
/var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/node.rb:23:in `initialize'
/var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:21:in `new'
/var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:21:in `block (2 levels) in load'
/var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:16:in `each'
/var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:16:in `block in load'
/var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:130:in `synchronize'
/var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:130:in `with_lock'
/var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:10:in `load'
/var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:125:in `initialize'
/var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/core.rb:14:in `new'
/var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/core.rb:14:in `initialize'
/var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/core.rb:4:in `new'
/var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/core.rb:4:in `new'
/var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/cli.rb:13:in `run'
/var/lib/gems/2.5.0/gems/oxidized-0.28.0/bin/oxidized:8:in `<top (required)>'
/usr/local/bin/oxidized:23:in `load'
/usr/local/bin/oxidized:23:in `<main>'`

i am grepping around for Http and am only finding that capitalization in the output/http.rb
HTTP not including readme or docs pops up 12 or so times
http is prolific

if any of this helps or if you have a shortcut to my research how to get you a traceback

@typecookie
Copy link
Author

typecookie commented Jul 29, 2020

I think this is the traceback needed but i dont realy know what to do with it. it is returning http from node.rb but i dont know where it is sending it.

D, [2020-07-29T15:39:51.854285 #2911] DEBUG -- : lib/oxidized/model/model.rb Added /system package update print without-paging to the commands list
D, [2020-07-29T15:39:51.854586 #2911] DEBUG -- : lib/oxidized/model/model.rb Added /system history print without-paging to the commands list
D, [2020-07-29T15:39:51.855210 #2911] DEBUG -- : node.rb: resolving node key 'input', with passed global value of 'ssh, telnet, http' and node value ''
D, [2020-07-29T15:39:51.855437 #2911] DEBUG -- : node.rb: returning node key 'input' with value 'ssh, telnet, http'

@ytti
Copy link
Owner

ytti commented Jul 30, 2020

Bot of the HTTP classes are just under module Oxidized. We need to move one of them to its own name space and change every reference.
Potentially we'd do it for source, as it's less work.

In every lib/oxidized/source file:

module Oxidized
module Source
   ..old stuff...
end
end

We almost certainly also need to update manager.rb loadmethod, so it is bit more involved than just disambiguation.

@typecookie
Copy link
Author

so as this is a bit out of my realm and skills (almost no ruby) can i take something else off your plate while this gets road maped

@ytti
Copy link
Owner

ytti commented Jul 31, 2020

Yeah it may not be appropriate for first ruby contribution, than you for your offer. It is definitely a bug and frankly rather embarrassing design mistake, not a complex one to fix, so let's hope someone with some ruby background appears to the rescue.

@ytti
Copy link
Owner

ytti commented Jul 31, 2020

As a workaround, you could copy either source/http.rb to your $OXIDIZED_HOME/source/ or ~/.config/oxidized/source/ directory as any other name and change the files class name to match filename, then use that source in config, instead of http.

Like perhaps httpsource.rb and HttpSource.

Like dunno maybe call it httpsource.rb and change class from Http to HttpSource or some such.

@typecookie
Copy link
Author

typecookie commented Aug 4, 2020

I got this monkey fixed. I created a source folder in /home/oxidized/.config/oxidized copied http.rb from the gems directory renamed it sourcehttp.rb then changed the class to class SourceHTTP < Source an changed the "@cfg" to @cfg = Oxidized.config.source.sourcehttp this seems to work as far as being a good stable temp solution.

thanks for the help on this so far. i will be keeping my ear to the ground listening for a permenet solution.

@ytti
Copy link
Owner

ytti commented Aug 4, 2020

Yes that will work, and it won't break during upgrades.

@andyrosen
Copy link

I tried the work around that @typecookie suggested by copying the source http.rb file into ~/.config/oxidized/source directory and renaming the file and class to sourcehttp/SourceHTTP but am still getting a superclass mismatch when adding http to the input default. Do I need to tell oxidized to look in that path? Traceback output at: https://pastebin.com/kmkU7djV -Thanks

@kimhaak
Copy link

kimhaak commented Oct 6, 2022

Hi,

Was this ever fixed?

I am facing the same issue now, it seems.

@kimhaak
Copy link

kimhaak commented Oct 6, 2022

I got this monkey fixed. I created a source folder in /home/oxidized/.config/oxidized copied http.rb from the gems directory renamed it sourcehttp.rb then changed the class to class SourceHTTP < Source an changed the "@cfg" to @cfg = Oxidized.config.source.sourcehttp this seems to work as far as being a good stable temp solution.

thanks for the help on this so far. i will be keeping my ear to the ground listening for a permenet solution.

@typecookie

Hi,

Did you do anything else than what you described above?

I did what you did, and same error.

tried to use "sourcehttp" in config instead of "http" - but also no success.

Does oxidized need to be told where to look for the "new" class?

Thanks.

@kimhaak
Copy link

kimhaak commented Oct 6, 2022

Ok, i got this workaround sorted. For the next guy:

I did what typecookie said and then i changed in the config file:

source:
default: sourcehttp
debug: true
sourcehttp:
url: http://librenms.****/api/v0/oxidized

I also had to install gem "mechanized"

@github-actions github-actions bot added the Stale label Apr 25, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 3, 2023
@michieltimmers
Copy link

Anybody with ruby skills that can fix this? Would rather wait for that then do a workaround.

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

No branches or pull requests

5 participants