summaryrefslogtreecommitdiff
path: root/lib/oxidized/model/asa.rb
diff options
context:
space:
mode:
authorytti <saku@ytti.fi>2016-04-08 12:12:40 +0300
committerytti <saku@ytti.fi>2016-04-08 12:12:40 +0300
commitb4477cb07c5b90a734f87a0bdb279bbb14967104 (patch)
tree14ffd3ca45e33aa1e7f2e824fd40313712eea8e7 /lib/oxidized/model/asa.rb
parent7f8648944dfefac7d45683282c6532e93eb78741 (diff)
parentf37d63a9f03096ab897b95ef538c5b65c5ba9818 (diff)
Merge pull request #384 from gcotone/asacfg
asa.rb enhancements
Diffstat (limited to 'lib/oxidized/model/asa.rb')
-rw-r--r--lib/oxidized/model/asa.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/oxidized/model/asa.rb b/lib/oxidized/model/asa.rb
index 547afd7..48e6bf4 100644
--- a/lib/oxidized/model/asa.rb
+++ b/lib/oxidized/model/asa.rb
@@ -18,7 +18,7 @@ class ASA < Oxidized::Model
cmd 'show version' do |cfg|
# avoid commits due to uptime / ixo-router01 up 2 mins 28 secs / ixo-router01 up 1 days 2 hours
- cfg = cfg.each_line.select { |line| not line.match /\s+up\s+\d+\s+/ }
+ cfg = cfg.each_line.select { |line| not line.match /(\s+up\s+\d+\s+)|(.*days.*)/ }
cfg = cfg.join
comment cfg
end
@@ -30,6 +30,22 @@ class ASA < Oxidized::Model
cmd 'more system:running-config' do |cfg|
cfg = cfg.each_line.to_a[3..-1].join
cfg.gsub! /^: [^\n]*\n/, ''
+ # backup any xml referenced in the configuration.
+ anyconnect_profiles = cfg.scan(Regexp.new('(\sdisk0:/.+\.xml)')).flatten
+ anyconnect_profiles.each do |profile|
+ cfg << (comment profile + "\n" )
+ cmd ("more" + profile) do |xml|
+ cfg << (comment xml)
+ end
+ end
+ # if DAP is enabled, also backup dap.xml
+ if cfg.rindex(/dynamic-access-policy-record\s(?!DfltAccessPolicy)/)
+ cfg << (comment "disk0:/dap.xml\n")
+ cmd "more disk0:/dap.xml" do |xml|
+ cfg << (comment xml)
+ puts xml
+ end
+ end
cfg
end