Class: Pfm::Command::Apply
- Inherits:
-
Base
- Object
- Base
- Pfm::Command::Apply
show all
- Defined in:
- lib/iapi-idlc-sdk-pfm/command/apply.rb
Instance Method Summary
collapse
Methods inherited from Base
#build_base_dir, #build_dir, #build_exists?, #build_setup, #deploy_setup, #deploy_setupv2, #inf_base_dir, #needs_help?, #needs_version?, #run_with_default_options, #templates_dir, #verbose?
Methods included from Helpers
debug, err, msg, system_command
Constructor Details
#initialize ⇒ Apply
Returns a new instance of Apply.
33
34
35
36
37
|
# File 'lib/iapi-idlc-sdk-pfm/command/apply.rb', line 33
def initialize
super
@params_valid = true
@errors = []
end
|
Instance Method Details
#apply(dir) ⇒ Object
64
65
66
67
68
|
# File 'lib/iapi-idlc-sdk-pfm/command/apply.rb', line 64
def apply(dir)
Terraform::Binary.apply(dir.to_s) || raise
rescue
raise DeploymentFailure, 'Finished with errors'
end
|
#params_valid? ⇒ Boolean
81
82
83
|
# File 'lib/iapi-idlc-sdk-pfm/command/apply.rb', line 81
def params_valid?
@params_valid
end
|
#read_and_validate_params ⇒ Object
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/iapi-idlc-sdk-pfm/command/apply.rb', line 70
def read_and_validate_params
arguments = parse_options(@params)
@params_valid = case arguments.size
when 0
true
else
false
end
end
|
#run(params) ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/iapi-idlc-sdk-pfm/command/apply.rb', line 39
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
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
|