Class: InspecPlugins::Parallelism::Validator
- Inherits:
-
Object
- Object
- InspecPlugins::Parallelism::Validator
- Defined in:
- lib/plugins/inspec-parallel/lib/inspec-parallel/validator.rb
Constant Summary collapse
- PARALLEL_SAFE_REPORTERS =
TODO: make this list dynamic so plugins can self-declare
[ "automate", # Performs HTTP transactions, silent on STDOUT "child-status", # Writes dedicated protocol to STDOUT, expected by parent ].freeze
Instance Attribute Summary collapse
-
#aliases_mapping ⇒ Object
Returns the value of attribute aliases_mapping.
-
#cli_options ⇒ Object
Returns the value of attribute cli_options.
-
#config_content ⇒ Object
Returns the value of attribute config_content.
-
#invocations ⇒ Object
Returns the value of attribute invocations.
-
#stdin_config ⇒ Object
Returns the value of attribute stdin_config.
-
#sub_cmd ⇒ Object
Returns the value of attribute sub_cmd.
-
#thor_options_for_sub_cmd ⇒ Object
Returns the value of attribute thor_options_for_sub_cmd.
Instance Method Summary collapse
-
#initialize(invocations, cli_options, sub_cmd = "exec") ⇒ Validator
constructor
A new instance of Validator.
- #validate ⇒ Object
- #validate_log_path ⇒ Object
Constructor Details
#initialize(invocations, cli_options, sub_cmd = "exec") ⇒ Validator
Returns a new instance of Validator.
14 15 16 17 18 19 20 21 22 |
# File 'lib/plugins/inspec-parallel/lib/inspec-parallel/validator.rb', line 14 def initialize(invocations, , sub_cmd = "exec") @invocations = invocations @sub_cmd = sub_cmd @thor_options_for_sub_cmd = Inspec::InspecCLI.commands[sub_cmd]. @aliases_mapping = create_aliases_mapping @cli_options = @config_content = nil @stdin_config = nil end |
Instance Attribute Details
#aliases_mapping ⇒ Object
Returns the value of attribute aliases_mapping.
12 13 14 |
# File 'lib/plugins/inspec-parallel/lib/inspec-parallel/validator.rb', line 12 def aliases_mapping @aliases_mapping end |
#cli_options ⇒ Object
Returns the value of attribute cli_options.
12 13 14 |
# File 'lib/plugins/inspec-parallel/lib/inspec-parallel/validator.rb', line 12 def @cli_options end |
#config_content ⇒ Object
Returns the value of attribute config_content.
12 13 14 |
# File 'lib/plugins/inspec-parallel/lib/inspec-parallel/validator.rb', line 12 def config_content @config_content end |
#invocations ⇒ Object
Returns the value of attribute invocations.
12 13 14 |
# File 'lib/plugins/inspec-parallel/lib/inspec-parallel/validator.rb', line 12 def invocations @invocations end |
#stdin_config ⇒ Object
Returns the value of attribute stdin_config.
12 13 14 |
# File 'lib/plugins/inspec-parallel/lib/inspec-parallel/validator.rb', line 12 def stdin_config @stdin_config end |
#sub_cmd ⇒ Object
Returns the value of attribute sub_cmd.
12 13 14 |
# File 'lib/plugins/inspec-parallel/lib/inspec-parallel/validator.rb', line 12 def sub_cmd @sub_cmd end |
#thor_options_for_sub_cmd ⇒ Object
Returns the value of attribute thor_options_for_sub_cmd.
12 13 14 |
# File 'lib/plugins/inspec-parallel/lib/inspec-parallel/validator.rb', line 12 def @thor_options_for_sub_cmd end |
Instance Method Details
#validate ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/plugins/inspec-parallel/lib/inspec-parallel/validator.rb', line 24 def validate invocations.each do |invocation_data| invocation_data[:validation_errors] = [] (invocation_data) (invocation_data) check_for_required_fields(invocation_data) (invocation_data) end end |
#validate_log_path ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/plugins/inspec-parallel/lib/inspec-parallel/validator.rb', line 36 def validate_log_path return [] unless ["log_path"] if File.directory?(["log_path"]) [] else [true, "Log path #{["log_path"]} is not accessible"] end end |