Sha256: 0f240e57932440552f54583a83fead3810f3005caa5d8ec612ea84305e9c8b61
Contents?: true
Size: 1.3 KB
Versions: 3
Compression:
Stored size: 1.3 KB
Contents
class NetScaler < Oxidized::Model using Refinements prompt /^(.*[\w\.-]*>\s?)$/ comment '# ' cmd :all do |cfg| cfg.each_line.to_a[1..-3].join end cmd 'show version' do |cfg| comment cfg end cmd 'show hardware' do |cfg| comment cfg end cmd 'show partition' do |cfg| comment cfg end cmd :secret do |cfg| cfg.gsub! /\w+\s(-encrypted)/, '<secret hidden> \\1' cfg end # check for multiple partitions cmd 'show partition' do |cfg| @is_multiple_partition = cfg.include? 'Name:' end post do if @is_multiple_partition multiple_partition else single_partition end end def single_partition # Single partition mode cmd 'show ns ns.conf' do |cfg| cfg end end def multiple_partition # Multiple partition mode cmd 'show partition' do |cfg| allcfg = "" partitions = [["default"]] + cfg.scan(/Name: (\S+)$/) partitions.each do |part| allcfg = allcfg + "\n\n####################### [ partition " + part.join(" ") + " ] #######################\n\n" cmd "switch ns partition " + part.join(" ") + "; show ns ns.conf; switch ns partition default" do |cfgpartition| allcfg += cfgpartition end end allcfg end end cfg :ssh do pre_logout 'exit' end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
oxidized-0.31.0 | lib/oxidized/model/netscaler.rb |
oxidized-0.30.1 | lib/oxidized/model/netscaler.rb |
oxidized-0.30.0 | lib/oxidized/model/netscaler.rb |