lib/oxidized/script/script.rb in oxidized-script-0.1.1 vs lib/oxidized/script/script.rb in oxidized-script-0.1.2
- old
+ new
@@ -17,11 +17,12 @@
# @param [String] command command to be sent
# @return [String] output for command
def cmd command
out = ''
out += "## OXS - #{command}\n" if @verbose
- out += @model.cmd command
+ cmd_out = @model.cmd command
+ out += cmd_out if cmd_out
out
end
# disconnects from ssh/telnet session
# @return [void]
@@ -51,11 +52,11 @@
username = opts.delete :username
password = opts.delete :password
enable = opts.delete :enable
community = opts.delete :community
@verbose = opts.delete :verbose
- CFG.input.default = opts.delete :protocols if opts[:protocols]
+ Oxidized.config.input.default = opts.delete :protocols if opts[:protocols]
raise InvalidOption, "#{opts} not recognized" unless opts.empty?
@@oxi ||= false
if not @@oxi
Oxidized.mgr = Manager.new
@@ -78,11 +79,11 @@
raise NoNode, 'node not found' unless node
@node = Node.new :name=>host, :model=>node[:model]
end
@node.auth[:username] = username if username
@node.auth[:password] = password if password
- CFG.vars.enable = enable if enable
- CFG.timeout = timeout if timeout
+ Oxidized.config.vars.enable = enable if enable
+ Oxidized.config.timeout = timeout if timeout
@model = @node.model
@input = nil
connect
if block_given?
yield self