From d63be0a0bb5864d5038cfff78c10866fad0bc2c5 Mon Sep 17 00:00:00 2001 From: Per von Zweigbergk Date: Mon, 28 Mar 2022 09:11:43 +0200 Subject: [PATCH] Check for tag in config file! If a tag is not in the config file output, there's an error, for example there are not enough permissions for the user to get the config file. This change detects this condition and throws an error, so that this doesn't fly under the radar silently. --- CHANGELOG.md | 1 + lib/oxidized/model/pfsense.rb | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64b524b52..fed6d010d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). - fixed an issue where EOS config was truncated. Fixes #2038 (@jake2184 @fhibler) - fixed missing output from routeros version command (@mjbnz) - Updated fastiron enable password prompt regex (@pepperoni-pi) +- fixed an issue where the pfsense model would not report errors in case it was unable to download the configuration e.g. due to insufficient permissions ## [0.28.0 - 2020-05-18] diff --git a/lib/oxidized/model/pfsense.rb b/lib/oxidized/model/pfsense.rb index 0e17e3c6b..310a91784 100644 --- a/lib/oxidized/model/pfsense.rb +++ b/lib/oxidized/model/pfsense.rb @@ -9,6 +9,9 @@ class PfSense < Oxidized::Model end cmd 'cat /cf/conf/config.xml' do |cfg| + if not cfg.include? "" then + raise " missing in config file!" + end cfg.gsub! /\s\s*