Class: Commutateurs::HP
Overview
Work in progress
Instance Method Summary collapse
- #configuration ⇒ Object
- #connect ⇒ Object
- #disconnect ⇒ Object
- #enable ⇒ Object
-
#initialize(host, credentials, verbose = false) ⇒ HP
constructor
A new instance of HP.
- #save ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(host, credentials, verbose = false) ⇒ HP
Returns a new instance of HP.
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/commutateurs/hp.rb', line 4 def initialize(host, credentials, verbose = false) super @transport.default_prompt = /(Press any key to continue|# )/ # hpuifilter.c used by rancid - https://github.com/dotwaffle/rancid-git/blob/master/bin/hpuifilter.c#L534 @transport.filter = Proc.new do |line| line.gsub(/\e\[2K|\e\[2J|\e\[\?7l|\e\[\?6l|\e\[[0-9]+;[0-9]+r|\e\[[0-9]+;[0-9]+H|\e\[\?25l|\e\[\?25h/, "") .gsub(/\eE|\n\r|\r\n/, "\n") end end |
Instance Method Details
#configuration ⇒ Object
25 26 27 |
# File 'lib/commutateurs/hp.rb', line 25 def configuration execute('write term') end |
#connect ⇒ Object
15 16 17 18 19 |
# File 'lib/commutateurs/hp.rb', line 15 def connect @transport.connect execute("") execute("terminal length 1000") end |
#disconnect ⇒ Object
33 34 35 36 |
# File 'lib/commutateurs/hp.rb', line 33 def disconnect @transport.send 'exit' @transport.close end |
#enable ⇒ Object
21 22 23 |
# File 'lib/commutateurs/hp.rb', line 21 def enable end |
#save ⇒ Object
29 30 31 |
# File 'lib/commutateurs/hp.rb', line 29 def save execute('write memory') end |