From de6b5fd69ba8192d9321ce7bf4ad5ea5b77f1089 Mon Sep 17 00:00:00 2001 From: Robert Cheramy Date: Fri, 6 Dec 2024 06:48:07 +0100 Subject: [PATCH] dix sonicos prompt for hostnames containing "-" Fixes #3333 --- CHANGELOG.md | 1 + lib/oxidized/model/sonicos.rb | 2 +- spec/model/sonicwall_spec.rb | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 spec/model/sonicwall_spec.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 8263b2964..3290e1661 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). ### Fixed - tplink: send 'enable' before the enable password. Fixes #3271 (@robertcheramy) - asyncos: fix prompt for hostnames containing "-" . Fixes #3327 (@robertcheramy) +- sonicos: fix prompt for hostnames containing "-" . Fixes #3333 (@robertcheramy) ## [0.31.0 – 2024-11-29] diff --git a/lib/oxidized/model/sonicos.rb b/lib/oxidized/model/sonicos.rb index 259812b21..36fed0751 100644 --- a/lib/oxidized/model/sonicos.rb +++ b/lib/oxidized/model/sonicos.rb @@ -3,7 +3,7 @@ class SonicOS < Oxidized::Model # Applies to Sonicwall NSA series firewalls - prompt /^\w+@\w+[>]\(?.+\)?\s?/ + prompt /^\w+@[\w\-]+[>]\(?.+\)?\s?/ comment '! ' cmd :all do |cfg| diff --git a/spec/model/sonicwall_spec.rb b/spec/model/sonicwall_spec.rb new file mode 100644 index 000000000..af1333949 --- /dev/null +++ b/spec/model/sonicwall_spec.rb @@ -0,0 +1,16 @@ +require_relative 'model_helper' + +describe 'model/SonicOS' do + before(:each) do + init_model_helper + @node = Oxidized::Node.new(name: 'example.com', + input: 'ssh', + model: 'sonicos') + end + + it 'matches different prompts' do + _('admin@012345> ').must_match SonicOS.prompt + # Issue #3333 + _('admin@host-with-minus> ').must_match SonicOS.prompt + end +end