Merge pull request #4437 from inspec/zenspider/waivers/input

Rough draft on waiver input
This commit is contained in:
Ryan Davis 2019-09-10 11:18:17 -07:00 committed by GitHub
commit 576370cf62
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 2 deletions

View file

@ -137,6 +137,8 @@ module Inspec
desc: "Specify one or more inputs directly on the command line, as --input NAME=VALUE"
option :input_file, type: :array,
desc: "Load one or more input files, a YAML file with values for the profile to use"
option :waiver_file, type: :array,
desc: "Load one or more waiver files."
option :attrs, type: :array,
desc: "Legacy name for --input-file - deprecated."
option :create_lockfile, type: :boolean,

View file

@ -220,8 +220,8 @@ module Inspec
path = determine_cfg_path(cli_opts)
cfg_io = File.open(path) if path
cfg_io || StringIO.new('{ "version": "1.1" }')
ver = KNOWN_VERSIONS.max
path ? File.open(path) : StringIO.new({ "version" => ver }.to_json)
end
def check_for_piped_config(cli_opts)

View file

@ -56,6 +56,12 @@ module Inspec
RunnerRspec.new(@conf)
end
if @conf[:waiver_file]
waivers = @conf.delete(:waiver_file)
@conf[:input_file] ||= []
@conf[:input_file].concat waivers
end
# About reading inputs:
# @conf gets passed around a lot, eventually to
# Inspec::InputRegistry.register_external_inputs.