Class: Pfm::Command::Plan
- Inherits:
-
Base
- Object
- Base
- Pfm::Command::Plan
show all
- Defined in:
- lib/idlc-sdk-pfm/command/plan.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 ⇒ Plan
Returns a new instance of Plan.
40
41
42
43
44
|
# File 'lib/idlc-sdk-pfm/command/plan.rb', line 40
def initialize
super
@params_valid = true
@errors = []
end
|
Instance Method Details
#params_valid? ⇒ Boolean
91
92
93
|
# File 'lib/idlc-sdk-pfm/command/plan.rb', line 91
def params_valid?
@params_valid
end
|
#plan(dir) ⇒ Object
71
72
73
74
75
76
77
78
|
# File 'lib/idlc-sdk-pfm/command/plan.rb', line 71
def plan(dir)
begin
Terraform::Binary.plan(dir.to_s) unless @config[:landscape]
Terraform::Binary.plan("#{dir} | landscape") if @config[:landscape]
rescue
raise DeploymentFailure, 'Finished with errors'
end
end
|
#read_and_validate_params ⇒ Object
80
81
82
83
84
85
86
87
88
89
|
# File 'lib/idlc-sdk-pfm/command/plan.rb', line 80
def read_and_validate_params
arguments = parse_options(@params)
case arguments.size
when 0
@params_valid = true
else
@params_valid = false
end
end
|
#run(params) ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/idlc-sdk-pfm/command/plan.rb', line 46
def run(params)
@params = params
read_and_validate_params
if params_valid?
if (@config[:config_file])
deploy_setupv2
plan(@config[:working_dir])
else
deploy_setup
plan(@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
|