Class: Inspec::Deprecation::ConfigFile
- Inherits:
-
Object
- Object
- Inspec::Deprecation::ConfigFile
- Defined in:
- lib/inspec/utils/deprecation/config_file.rb
Defined Under Namespace
Classes: FallbackEntry, GroupEntry
Constant Summary collapse
- VALID_ACTIONS =
What actions may you specify to be taken when a deprecation is encountered?
[ :exit, # Hard exit `inspec`, no stacktrace, exit code specified or Inspec::UI::EXIT_FATAL_DEPRECATION :fail_control, # Fail the control with a message. If not in a control, do :warn action instead. :ignore, # Do nothing. :warn, # Issue a warning ].freeze
- VALID_GROUP_FIELDS =
Note that ‘comment’ is ignored, but listed here so you can have it present and pass validation.
%w{action suffix prefix exit_status comment}.freeze
Instance Attribute Summary collapse
-
#fallback_resource_packs ⇒ Object
readonly
Returns the value of attribute fallback_resource_packs.
-
#groups ⇒ Object
readonly
Returns the value of attribute groups.
-
#unknown_group_action ⇒ Object
readonly
Returns the value of attribute unknown_group_action.
Instance Method Summary collapse
-
#initialize(io = nil) ⇒ ConfigFile
constructor
A new instance of ConfigFile.
Constructor Details
#initialize(io = nil) ⇒ ConfigFile
Returns a new instance of ConfigFile.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/inspec/utils/deprecation/config_file.rb', line 26 def initialize(io = nil) io ||= open_default_config_io begin @raw_data = JSON.parse(io.read) rescue JSON::ParserError => e raise Inspec::Deprecation::MalformedConfigFileError, "Could not parse deprecation config file: #{e.message}" end @groups = {} @fallback_resource_packs = [] @unknown_group_action = :warn validate! silence_deprecations_from_cli end |
Instance Attribute Details
#fallback_resource_packs ⇒ Object (readonly)
Returns the value of attribute fallback_resource_packs.
24 25 26 |
# File 'lib/inspec/utils/deprecation/config_file.rb', line 24 def fallback_resource_packs @fallback_resource_packs end |
#groups ⇒ Object (readonly)
Returns the value of attribute groups.
24 25 26 |
# File 'lib/inspec/utils/deprecation/config_file.rb', line 24 def groups @groups end |
#unknown_group_action ⇒ Object (readonly)
Returns the value of attribute unknown_group_action.
24 25 26 |
# File 'lib/inspec/utils/deprecation/config_file.rb', line 24 def unknown_group_action @unknown_group_action end |