Skip to content

Commit

Permalink
Merge pull request #3276 from benasse/fix-firewareos-prompt
Browse files Browse the repository at this point in the history
firewareos: fix prompt not matching when the node is managed and master
  • Loading branch information
robertcheramy authored Oct 2, 2024
2 parents fea6647 + ee6cd58 commit 7b61575
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
- cnos: show information before config, remove secrets only when told to do so (@robje)

### Fixed
- fixed prompt for Watchguard FirewareOS not matching the regex when the node is managed and master (@benasse)
- fixed prompt for vyos/vyatta to allow logins with non-priviliged accounts. Fixes #3111 (@h-lopez)
- fixed power consumption included in ArubaOS-CX diffs starting with FL.10.13.xxx. Fixes #3142 (@terratalpi)
- fixed oxidized-web getting "version not found" when fetching a version from git and no group is defined. Fixes #2222 (@robertcheramy)
Expand Down
11 changes: 10 additions & 1 deletion lib/oxidized/model/firewareos.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
class FirewareOS < Oxidized::Model
using Refinements

prompt /^\[?\w*\]?\w*?(<[\w-]*>)?(#|>)\s*$/
# matched prompts:
# [FAULT]WG<managed-by-wsm><master>>
# WG<managed-by-wsm><master>>
# WG<managed-by-wsm>>
# [FAULT]WG<non-master>>
# [FAULT]WG>
# WG>

prompt /^\[?\w*\]?\w*?(?:<[\w-]+>)*(#|>)\s*$/

comment '-- '

cmd :all do |cfg|
Expand Down
25 changes: 25 additions & 0 deletions spec/model/firewareos_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require_relative '../spec_helper'

describe 'Model firewareos' do
before(:each) do
Oxidized.asetus = Asetus.new
Oxidized.asetus.cfg.debug = false
Oxidized.setup_logger

Oxidized::Node.any_instance.stubs(:resolve_repo)
Oxidized::Node.any_instance.stubs(:resolve_output)

@node = Oxidized::Node.new(name: 'example.com',
input: 'ssh',
model: 'firewareos')
end

it "matches different prompts" do
_('[FAULT]WG<managed-by-wsm><master>>').must_match FirewareOS.prompt
_('WG<managed-by-wsm><master>>').must_match FirewareOS.prompt
_('WG<managed-by-wsm>>').must_match FirewareOS.prompt
_('[FAULT]WG<non-master>>').must_match FirewareOS.prompt
_('[FAULT]WG>').must_match FirewareOS.prompt
_('WG>').must_match FirewareOS.prompt
end
end

0 comments on commit 7b61575

Please sign in to comment.