Method: Inspec::Resources::Cmd#initialize
- Defined in:
- lib/resources/command.rb
#initialize(cmd, options = {}) ⇒ Cmd
Returns a new instance of Cmd.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/resources/command.rb', line 25 def initialize(cmd, = {}) if cmd.nil? raise 'InSpec `command` was called with `nil` as the argument. This is not supported. Please provide a valid command instead.' end @command = cmd if [:redact_regex] unless [:redact_regex].is_a?(Regexp) # Make sure command is replaced so sensitive output isn't shown @command = 'ERROR' raise Inspec::Exceptions::ResourceFailed, 'The `redact_regex` option must be a regular expression' end @redact_regex = [:redact_regex] end end |