summaryrefslogtreecommitdiff
path: root/lib/oxidized/node.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/oxidized/node.rb')
-rw-r--r--lib/oxidized/node.rb22
1 files changed, 9 insertions, 13 deletions
diff --git a/lib/oxidized/node.rb b/lib/oxidized/node.rb
index d50317f..1bbf6dc 100644
--- a/lib/oxidized/node.rb
+++ b/lib/oxidized/node.rb
@@ -54,9 +54,7 @@ module Oxidized
end
end
begin
- if input.connect self
- input.get
- end
+ input.connect(self) and input.get
rescue *rescue_fail.keys => err
resc = ''
if not level = rescue_fail[err.class]
@@ -122,19 +120,17 @@ module Oxidized
private
def resolve_prompt opt
- prompt = opt[:prompt]
- prompt ||= @model.prompt
- prompt ||= CFG.prompt
+ opt[:prompt] || @model.prompt || Oxidized.config.prompt
end
def resolve_auth opt
# Resolve configured username/password, give priority to group level configuration
# TODO: refactor to use revised behaviour of Asetus
cfg_username, cfg_password =
- if CFG.groups.has_key?(@group) and ['username', 'password'].all? {|e| CFG.groups[@group].has_key?(e)}
- [CFG.groups[@group].username, CFG.groups[@group].password]
- elsif ['username', 'password'].all? {|e| CFG.has_key?(e)}
- [CFG.username, CFG.password]
+ if Oxidized.config.groups.has_key?(@group) and ['username', 'password'].all? {|e| Oxidized.config.groups[@group].has_key?(e)}
+ [Oxidized.config.groups[@group].username, Oxidized.config.groups[@group].password]
+ elsif ['username', 'password'].all? {|e| Oxidized.config.has_key?(e)}
+ [Oxidized.config.username, Oxidized.config.password]
else
[nil, nil]
end
@@ -145,7 +141,7 @@ module Oxidized
end
def resolve_input opt
- inputs = (opt[:input] or CFG.input.default)
+ inputs = (opt[:input] or Oxidized.config.input.default)
inputs.split(/\s*,\s*/).map do |input|
if not Oxidized.mgr.input[input]
Oxidized.mgr.add_input input or raise MethodNotFound, "#{input} not found for node #{ip}"
@@ -155,7 +151,7 @@ module Oxidized
end
def resolve_output opt
- output = (opt[:output] or CFG.output.default)
+ output = (opt[:output] or Oxidized.config.output.default)
if not Oxidized.mgr.output[output]
Oxidized.mgr.add_output output or raise MethodNotFound, "#{output} not found for node #{ip}"
end
@@ -163,7 +159,7 @@ module Oxidized
end
def resolve_model opt
- model = (opt[:model] or CFG.model)
+ model = (opt[:model] or Oxidized.config.model)
if not Oxidized.mgr.model[model]
Oxidized.mgr.add_model model or raise ModelNotFound, "#{model} not found for node #{ip}"
end