oxidized icon indicating copy to clipboard operation
oxidized copied to clipboard

Fix error message introduced by PR #3495

Open robertcheramy opened this issue 11 months ago • 4 comments

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.

robertcheramy avatar May 12 '25 06:05 robertcheramy

@systeembeheerder - if this works for you, I'll merge into master.

robertcheramy avatar May 12 '25 06:05 robertcheramy

@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?

systeembeheerder avatar May 12 '25 12:05 systeembeheerder

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.

ytti avatar May 12 '25 12:05 ytti

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.

robertcheramy avatar May 12 '25 19:05 robertcheramy

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.

It does. The YAML Simulation file is not in exec mode.

robertcheramy avatar Jun 26 '25 15:06 robertcheramy