Module: Vulnerability::Config
- Defined in:
- lib/puppet_x/vulnerability/config.rb
Overview
Manage the vulnerability config data
Instance Method Summary collapse
Instance Method Details
#config_data ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/puppet_x/vulnerability/config.rb', line 33 def config_data config_text = File.read("#{grype_root}/etc/vulnerability.conf") config_data = config_text.match(/directories = (?<directories>.*)excludes = (?<excludes>.*)level = (?<level>.*)/m) directories = config_data['directories'].strip.split(',') excludes = config_data['excludes'].strip.split(',') level = config_data['level'].strip # Return the config data as a Hash { :level => level, :directories => directories, :excludes => excludes } end |
#grype_binary ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/puppet_x/vulnerability/config.rb', line 21 def grype_binary kernel = Facter.value(:kernel) case kernel when 'Linux' '/usr/local/bin/grype' when 'windows' 'C:\vulnerability\bin\grype.exe' else fail "'#{kernel}' not (yet) supported." end end |
#grype_root ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/puppet_x/vulnerability/config.rb', line 9 def grype_root kernel = Facter.value(:kernel) case kernel when 'Linux' '/usr/local' when 'windows' 'c:/vulnerability' else fail "'#{kernel}' not (yet) supported." end end |