class Oxidized::Source::Source
Public Class Methods
Source
# File lib/oxidized/source/source.rb, line 6 def initialize @model_map = Oxidized.config.model_map || {} @group_map = Oxidized.config.group_map || {} end
Public Instance Methods
Source
# File lib/oxidized/source/source.rb, line 45 def map_group(group) map_value(@group_map, group) end
search a match for group in the configuration and returns it. If no match is found, return group
group can be matched against a string or a regexp:
group_map:
alias1: groupA alias2: groupA alias3: groupB alias4: groupB !ruby/regexp /specialgroup/: groupS aliasN: groupZ
Source
# File lib/oxidized/source/source.rb, line 29 def map_model(model) map_value(@model_map, model) end
search a match for model in the configuration and returns it. If no match is found, return model
model can be matched against a string or a regexp:
model_map:
cisco: ios juniper: junos !ruby/regexp /procurve/: procurve
Source
Source
# File lib/oxidized/source/source.rb, line 49 def node_var_interpolate(var) case var when "nil" then nil when "false" then false when "true" then true else var end end
Private Instance Methods
Source
# File lib/oxidized/source/source.rb, line 60 def open_file file = File.expand_path(@cfg.file) if @cfg.gpg? crypto = GPGME::Crypto.new password: @cfg.gpg_password crypto.decrypt(File.open(file)).to_s else File.open(file) end end