Class: Pfm::Command::ValidatorCommands::Infrastructure

Inherits:
Base
  • Object
show all
Defined in:
lib/idlc-sdk-pfm/command/validator_commands/infrastructure.rb

Instance Attribute Summary

Attributes inherited from Base

#errors, #params

Instance Method Summary collapse

Methods inherited from Base

#initialize, #params_valid?, #read_and_validate_params, #setup_artifacts_dirs, #setup_context, #use_circle_ci?

Methods inherited from Base

#build_base_dir, #build_dir, #build_exists?, #build_setup, #deploy_setup, #deploy_setupv2, #inf_base_dir, #initialize, #needs_help?, #needs_version?, #run_with_default_options, #templates_dir, #verbose?

Methods included from Helpers

debug, err, msg, system_command

Constructor Details

This class inherits a constructor from Pfm::Command::ValidatorCommands::Base

Instance Method Details

#runObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/idlc-sdk-pfm/command/validator_commands/infrastructure.rb', line 15

def run
  @config[:validator_name] = 'infrastructure'

  read_and_validate_params
  setup_artifacts_dirs

  if params_valid?
    deploy_setup
    validate
    # @workspace.cleanup causing bundler issues
    0
  else
    errors.each { |error| err("Error: #{error}") }
    parse_options(params)
    msg(opt_parser)
    1
  end
rescue ValidationError => e
  err("ERROR: #{e}")
  1
end

#validateObject



37
38
39
40
41
42
# File 'lib/idlc-sdk-pfm/command/validator_commands/infrastructure.rb', line 37

def validate
  Terraform::Binary.validate(@workspace.tmp_dir.to_s)
  msg('Verified repository..')
rescue Terraform::Binary::Command::CommandFailure
  raise ValidationError, 'Failures reported during validation!'
end