Class: Bolt::PAL::YamlPlan::Step::Script

Inherits:
Bolt::PAL::YamlPlan::Step show all
Defined in:
lib/bolt/pal/yaml_plan/step/script.rb

Constant Summary

Constants inherited from Bolt::PAL::YamlPlan::Step

STEP_KEYS

Instance Attribute Summary

Attributes inherited from Bolt::PAL::YamlPlan::Step

#body

Class Method Summary collapse

Methods inherited from Bolt::PAL::YamlPlan::Step

create, #evaluate, #initialize, parse_code_string, #transpile, validate, validate_puppet_code

Constructor Details

This class inherits a constructor from Bolt::PAL::YamlPlan::Step

Class Method Details

.allowed_keysObject



8
9
10
# File 'lib/bolt/pal/yaml_plan/step/script.rb', line 8

def self.allowed_keys
  super + Set['arguments', 'pwsh_params']
end

.option_keysObject



12
13
14
# File 'lib/bolt/pal/yaml_plan/step/script.rb', line 12

def self.option_keys
  Set['catch_errors', 'env_vars', 'run_as']
end

.required_keysObject



16
17
18
# File 'lib/bolt/pal/yaml_plan/step/script.rb', line 16

def self.required_keys
  Set['script', 'targets']
end

.validate_step_keys(body, number) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/bolt/pal/yaml_plan/step/script.rb', line 20

def self.validate_step_keys(body, number)
  super

  if body.key?('arguments') && !body['arguments'].nil? && !body['arguments'].is_a?(Array)
    raise StepError.new('arguments key must be an array', body['name'], number)
  end

  if body.key?('pwsh_params') && !body['pwsh_params'].nil? && !body['pwsh_params'].is_a?(Hash)
    raise StepError.new('pwsh_params key must be a hash', body['name'], number)
  end

  if body.key?('env_vars') && ![Hash, String].include?(body['env_vars'].class)
    raise StepError.new('env_vars key must be a hash or evaluable string', body['name'], number)
  end
end