Skip to content

Instantly share code, notes, and snippets.

Created June 3, 2015 15:03
Show Gist options
  • Save anonymous/3d9f01d770ca60e2c862 to your computer and use it in GitHub Desktop.
Save anonymous/3d9f01d770ca60e2c862 to your computer and use it in GitHub Desktop.
require 'facter'
models = Facter::Core::Execution.exec('qaucli -i | find "HBA Model"')
models.each_line.each_with_index do |line, index|
newmodels = Facter::Core::Execution.exec("qaucli -i #{index} | find \"HBA Model\"").split(':').last.strip
modelshash = {}
newmodels.split('\n').each do |pair|
key,value = pair.split(/\n/)
modelshash["qlogicmodel#{index}"] = key
# modelshash.each {|key, value| merge}
p modelshash
Facter.add("qlogicmodels") do
setcode do
modelshash
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment