class Pfm::Command::Apply
def apply(dir)
def apply(dir) if upgraded_terraform? Terraform::Binary::Command.run("-chdir #{dir} apply") else Terraform::Binary.apply(dir.to_s) || raise end rescue raise DeploymentFailure, 'Finished with errors' end
def initialize
def initialize super @params_valid = true @errors = [] end
def params_valid?
def params_valid? @params_valid end
def read_and_validate_params
def read_and_validate_params arguments = parse_options(@params) @params_valid = case arguments.size when 0 true else false end end
def run(params)
def run(params) @params = params read_and_validate_params if params_valid? if (@config[:config_file]) deploy_setupv2 apply(@config[:working_dir]) else deploy_setup apply(@workspace.tmp_dir) end # @workspace.cleanup causing bundler issues 0 else @errors.each { |error| err("Error: #{error}") } parse_options(params) msg(opt_parser) 1 end rescue DeploymentFailure => e err("ERROR: #{e.message}\n") 1 end