/gist:5b4994406df1cd349872 Secret
Last active
August 29, 2015 14:22
-
-
Save olistik/5b4994406df1cd349872 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_with_object({}) do |pair, memo| | |
key,value = pair.split(/\n/) | |
memo["qlogicmodel#{index}"] = key | |
end | |
Facter.add("qlogicmodels") do | |
setcode do | |
modelshash | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment