ytti / oxidized-web

Web UI + RESTful API for Oxidized
119 stars 71 forks source link

Issue with "Search in Configs" #152

Closed laf closed 6 years ago

laf commented 6 years ago

@chibi4588 commented on Wed Nov 01 2017

I am having an issue upon a new Oxidized deployment when I attempt to use "Search in Configs". I get an oxidized-web "NoMethodError at /nodes/conf_search, undifined method '[]' nil:NilClass" from file webapp.rb.

Any thoughts on a remedy?? Thanks much!

Here is the output in the logs:

Puma starting in single mode...

2017-10-31 16:57:04 - NoMethodError - undefined method []' for nil:NilClass: /usr/local/share/gems/gems/oxidized-web-0.9.2/lib/oxidized/web/webapp.rb:56:inblock (2 levels) in ' /usr/local/share/gems/gems/oxidized-web-0.9.2/lib/oxidized/web/webapp.rb:53:in map' /usr/local/share/gems/gems/oxidized-web-0.9.2/lib/oxidized/web/webapp.rb:53:ineach' /usr/local/share/gems/gems/oxidized-web-0.9.2/lib/oxidized/web/webapp.rb:53:in block in <class:WebApp>' /usr/local/share/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1611:incall' /usr/local/share/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1611:in block in compile!' /usr/local/share/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:975:in[]' /usr/local/share/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:975:in block (3 levels) in route!' /usr/local/share/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:994:inroute_eval' /usr/local/share/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:975:in block (2 levels) in route!' /usr/local/share/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1015:inblock in process_route' /usr/local/share/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1013:in catch' /usr/local/share/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1013:inprocess_route' /usr/local/share/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:973:in block in route!' /usr/local/share/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:972:ineach' /usr/local/share/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:972:in route!' /usr/local/share/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1085:inblock in dispatch!' /usr/local/share/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in block in invoke' /usr/local/share/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:incatch' /usr/local/share/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in invoke' /usr/local/share/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1082:indispatch!' /usr/local/share/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:907:in block in call!' /usr/local/share/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:inblock in invoke' /usr/local/share/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in catch' /usr/local/share/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:ininvoke' /usr/local/share/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:907:in call!' /usr/local/share/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:895:incall' /usr/local/share/gems/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in call' /usr/local/share/gems/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:incall' /usr/local/share/gems/gems/rack-protection-1.5.3/lib/rack/protection/json_csrf.rb:18:in call' /usr/local/share/gems/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:incall' /usr/local/share/gems/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in call' /usr/local/share/gems/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:incall' /usr/local/share/gems/gems/rack-1.6.8/lib/rack/nulllogger.rb:9:in call' /usr/local/share/gems/gems/rack-1.6.8/lib/rack/head.rb:13:incall' /usr/local/share/gems/gems/sinatra-1.4.8/lib/sinatra/show_exceptions.rb:25:in call' /usr/local/share/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:182:incall' /usr/local/share/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:2013:in call' /usr/local/share/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1487:inblock in call' /usr/local/share/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1787:in synchronize' /usr/local/share/gems/gems/sinatra-1.4.8/lib/sinatra/base.rb:1487:incall' /usr/local/share/gems/gems/rack-1.6.8/lib/rack/urlmap.rb:66:in block in call' /usr/local/share/gems/gems/rack-1.6.8/lib/rack/urlmap.rb:50:ineach' /usr/local/share/gems/gems/rack-1.6.8/lib/rack/urlmap.rb:50:in call' /usr/local/share/gems/gems/rack-1.6.8/lib/rack/builder.rb:153:incall' /usr/local/share/gems/gems/puma-3.10.0/lib/puma/configuration.rb:225:in call' /usr/local/share/gems/gems/puma-3.10.0/lib/puma/server.rb:605:inhandle_request' /usr/local/share/gems/gems/puma-3.10.0/lib/puma/server.rb:437:in process_client' /usr/local/share/gems/gems/puma-3.10.0/lib/puma/server.rb:301:inblock in run' /usr/local/share/gems/gems/puma-3.10.0/lib/puma/thread_pool.rb:120:in call' /usr/local/share/gems/gems/puma-3.10.0/lib/puma/thread_pool.rb:120:inblock in spawn_thread'


@laf commented on Wed Nov 01 2017

Please post your config.


@chibi4588 commented on Wed Nov 01 2017

Iaf, Thanks. Here is the config (scrubbed).

---
username: admin
password: xxxxxxxx
model: cisco
interval: 604800
use_syslog: false
debug: false
threads: 30
timeout: 35
retries: 3
prompt: !ruby/regexp /^([\w.@-]+[#>]\s?)$/
rest: 127.0.0.1:8787
next_adds_job: false
vars:  {}
groups:
  XXX_XXXX_Routing_Backbone:
    vars:
      enable: xxxxxxx
models:
  eos:
    vars:
      enable: true
  powerconnect:
    vars:
      enable: XXXXX
pid: /home/oxidized/.config/oxidized/pid
input:
  default: ssh, telnet
  debug: false
  ssh:
    secure: false
output:
  default: file
  file:
    directory: /home/oxidized/deviceconfigs/*groups
source:
  default: csv
  csv:
    file: /home/oxidized/.config/oxidized/router.db
    delimiter: !ruby/regexp /:/
    map:
      name: 0
      model: 1
      group: 2
      username: 3
      password: 4
    gpg: false
model_map:
   cisco: ios

@laf commented on Wed Nov 01 2017

Are the configs themselves being stored ok?


@chibi4588 commented on Wed Nov 01 2017

Yeah, its is just the "Search in Configs" that is broken... and I can't for the life of me figure out why (not that I am a Ruby guy by any stretch). This is my 3rd deployment of Ox, all with the same config file. The only thing that I see has changed between the previous 2* deployments, is the version of Puma was updated from 3.9.1 to 3.4.0. Not sure if this would have any influence, but again, this is the only difference.


@chibi4588 commented on Thu Nov 02 2017

If anyone has any thoughts... would be greatly appreciated.

Thanks!


@laf commented on Sun Nov 05 2017

Maybe try Puma 3.9.1 again to see?


@laf commented on Sat Jan 06 2018

No further response provided so this issue is being closed.

I've moved this to oxidized-web in the meantime.

Alexanderis commented 5 years ago

I think this happens because not all nodes have a configuration file stored. I use HTML as source and when the node list is generated the app which generates it also checks if each node has a file and if there is none then a placeholder empty file is put in place.

This fixes the issue for me.