Fix error message introduced by PR #3495
Pre-Request Checklist
- [X] Passes rubocop code analysis (try
rubocop --auto-correct) - [X] Tests added or adapted (try
rake test) - [ ] Changes are reflected in the documentation
- [ ] User-visible changes appended to CHANGELOG.md
Description
Fix error message introduced by PR #3495 Applying the fix proposed by @systeembeheerder Closes: #3512
Note - cfg = cfg.cut_both if screenscrape does not seam to work correctly. resulting in the prompt being spread through the output. But this is not the topic of this fix.
@systeembeheerder - if this works for you, I'll merge into master.
@robertcheramy seems to work for SRX. But I think we should also fix this for the switches; unfortunately i don't have any junos switches that are not member of a virtual chassis. Maybe revert #3495 until we have a solid test on those as well?
Personally I dont think static unchanging error line on config which you can load to device, because error is comment isnt broken. I’m not against fixing it, but I’m not willing to say as a rule it is broken.
Perhaps easy test is return ”” if cfg.len < 2 —- or some such.
This is a pattern used some models, at least for unsupported commands (https://github.com/ytti/oxidized/blob/master/lib/oxidized/model/aosw.rb#L57)
But I agree that this case is different as the command is supported, only the output of the command itself is an error.
Would if cfg.lines.count <= 3 and cfg.include?("error:") be an option?
@shigechika - do you have some srx switches not member of a virtual chassis? Knowing how their output is on show chassis cluster status would help to fix the problem.
Note -
cfg = cfg.cut_both if screenscrapedoes not seam to work correctly. resulting in the prompt being spread through the output. But this is not the topic of this fix.
It does. The YAML Simulation file is not in exec mode.