Method: InspecDelta::Object::Profile#update_existing_control_file

Defined in:
lib/inspec_delta/objects/profile.rb

#update_existing_control_file(profile_control_path, benchmark_control) ⇒ Object

Updates a control file with the updates from the stig

Parameters:

  • String (profile_control_path)
    • The location of the Inspec profile on disk

  • Control (benchmark_control)
    • Control built from the Inspec Benchmark



54
55
56
57
58
# File 'lib/inspec_delta/objects/profile.rb', line 54

def update_existing_control_file(profile_control_path, benchmark_control)
  profile_control = InspecDelta::Object::Control.from_ruby(profile_control_path)
  updated_control = profile_control.apply_updates(benchmark_control)
  File.open(profile_control_path, 'w') { |f| f.puts updated_control }
end