oxidized icon indicating copy to clipboard operation
oxidized copied to clipboard

Configuration commands in the tmos.rb module without a comment return nothing.

Open ksuuk opened this issue 1 year ago • 0 comments

Hi,

Latest 0.29.1.

This part of the default module ( https://github.com/ytti/oxidized/blob/master/lib/oxidized/model/tmos.rb ) returns nothing:

  cmd 'tmsh -q list' do |cfg|
    cfg.gsub!(/state (up|down|checking|irule-down)/, '')
    cfg.gsub!(/errors (\d+)/, '')
    cfg.gsub!(/^\s+bandwidth-bps (\d+)/, '')
    cfg.gsub!(/^\s+bandwidth-cps (\d+)/, '')
    cfg.gsub!(/^\s+bandwidth-pps (\d+)\n/, '')
    cfg
  end
  

But adding a "comment" returns the information:

cmd 'tmsh -q list' do |cfg|
  cfg.gsub!(/state (up|down|checking|irule-down)/, '')
  cfg.gsub!(/errors (\d+)/, '')
  cfg.gsub!(/^\s+bandwidth-bps (\d+)/, '')
  cfg.gsub!(/^\s+bandwidth-cps (\d+)/, '')
  cfg.gsub!(/^\s+bandwidth-pps (\d+)\n/, '')
  comment cfg
end

I made a simple clear module for testing:

class TMOS < Oxidized::Model
  using Refinements
  
  comment '# '

  cmd('tmsh -q show sys version') { |cfg| cfg } # returns nothing
  cmd('tmsh -q show sys version') { |cfg| comment cfg } # returns the information

  cfg :ssh do
    exec true
  end
end

No matter how I tried, without "comment" I can't get any information with any command.

ksuuk avatar Jan 31 '24 18:01 ksuuk