Method: Rbeapi::Client::Node#run_commands
- Defined in:
- lib/rbeapi/client.rb
#run_commands(commands, opts = {}) ⇒ Object
This method will send the ordered list of commands to the destination node using the transport. It is also response for inserting enable onto the command stack and popping the enable result on the response.
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 |
# File 'lib/rbeapi/client.rb', line 466 def run_commands(commands, opts = {}) encoding = opts.fetch(:encoding, 'json') commands = [*commands] unless commands.respond_to?('each') commands = commands.dup if @enablepwd commands.insert(0, 'cmd' => 'enable', 'input' => @enablepwd) else commands.insert(0, 'enable') end opts[:format] = encoding response = @connection.execute(commands, opts) response.shift response end |