Sha256: 421cad57179be7a1160377333a43502b5b344c3d06d9fb94b3891f36e32bb1b8

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

class SmartCS < Oxidized::Model
  using Refinements

  prompt /^\r?([\w.@() -]+[#>]\s?)$/
  comment '# '

  expect /-more <Press SPACE for another page, 'q' to quit>-/ do |data, re|
    send ' '
    data.sub re, ''
  end

  cmd :all do |cfg|
    cfg
  end

  cmd 'show version' do |cfg|
    comment cfg.insert(0, "--------------------------------------------------------------------------------! \n")
    # Unhash below to write a comment in the config file.
    cfg.insert(0, "Starting: show version cmd \n")
    cfg << "\n \nEnding: show version cmd"
    comment cfg << "\n--------------------------------------------------------------------------------! \n \n"
    comment cfg
  end

  cmd 'show config' do |cfg|
    # remove "Press SPACE for another page" add SPACE(\s)
    cfg.gsub! /\s{5,}/, ""
  end

  cfg :telnet, :ssh do
    # preferred way to handle additional passwords
    post_login do
      pw = vars(:enable)
      pw ||= ""
      send "su\r"
      expect /[pP]assword:\s?$/
      cmd pw
    end
    pre_logout 'exit'
    pre_logout 'exit'
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
oxidized-0.31.0 lib/oxidized/model/smartcs.rb
oxidized-0.30.1 lib/oxidized/model/smartcs.rb
oxidized-0.30.0 lib/oxidized/model/smartcs.rb
oxidized-0.29.1 lib/oxidized/model/smartcs.rb