Method: Inspec::Resources::AuditPolicy#method_missing
- Defined in:
- lib/resources/audit_policy.rb
#method_missing(method) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/resources/audit_policy.rb', line 35 def method_missing(method) key = method.to_s # expected result: # Machine Name,Policy Target,Subcategory,Subcategory GUID,Inclusion Setting,Exclusion Setting # WIN-MB8NINQ388J,System,Kerberos Authentication Service,{0CCE9242-69AE-11D9-BED3-505054503030},No Auditing, result ||= inspec.command("Auditpol /get /subcategory:'#{key}' /r").stdout # find line target = nil result.each_line do |s| target = s.strip if s =~ /\b.*#{key}.*\b/ end # extract value values = nil unless target.nil? # split csv values and return value values = target.split(',')[4] end values end |