Class: DopCommon::Plan
Instance Method Summary
collapse
Methods included from RunOptions
#canary_host, #max_in_flight, #max_per_role, #valitdate_shared_options
Methods included from Validator
#log_validation_method, #set_not_valid, #try_validate_obj, #valid?
Methods included from HashParser
deep_symbolize_keys, hash_of_pattern_lists_valid?, is_valid_regexp?, key_aliases, load_content, load_content_valid?, parse_hash_of_pattern_lists, parse_pattern_list, pattern_list_valid?, represents_regexp?, symbolize_keys
Constructor Details
#initialize(hash) ⇒ Plan
Returns a new instance of Plan.
15
16
17
|
# File 'lib/dop_common/plan.rb', line 15
def initialize(hash)
@hash = symbolize_keys(hash)
end
|
Instance Method Details
#credentials ⇒ Object
61
62
63
64
|
# File 'lib/dop_common/plan.rb', line 61
def credentials
@credentials ||= credentials_valid? ?
create_credentials : {}
end
|
#find_node(name) ⇒ Object
66
67
68
|
# File 'lib/dop_common/plan.rb', line 66
def find_node(name)
nodes.find{|node| node.name == name}
end
|
#hooks ⇒ Object
70
71
72
|
# File 'lib/dop_common/plan.rb', line 70
def hooks
@hooks ||= ::DopCommon::Hooks.new(hooks_valid? ? @hash[:hooks] : {})
end
|
#infrastructures ⇒ Object
40
41
42
43
|
# File 'lib/dop_common/plan.rb', line 40
def infrastructures
@infrastructures ||= infrastructures_valid? ?
create_infrastructures : nil
end
|
#name ⇒ Object
35
36
37
38
|
# File 'lib/dop_common/plan.rb', line 35
def name
@name ||= name_valid? ?
@hash[:name] : Digest::SHA2.hexdigest(@hash.to_s)
end
|
#nodes ⇒ Object
45
46
47
48
|
# File 'lib/dop_common/plan.rb', line 45
def nodes
@nodes ||= nodes_valid? ?
inflate_nodes : nil
end
|
#step_sets ⇒ Object
50
51
52
53
|
# File 'lib/dop_common/plan.rb', line 50
def step_sets
@step_sets ||= step_sets_valid? ?
create_step_sets : []
end
|
#validate ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/dop_common/plan.rb', line 19
def validate
valitdate_shared_options
log_validation_method('name_valid?')
log_validation_method('infrastructures_valid?')
log_validation_method('nodes_valid?')
log_validation_method('step_sets_valid?')
log_validation_method('configuration_valid?')
log_validation_method('credentials_valid?')
log_validation_method(:hooks_valid?)
try_validate_obj("Plan: Can't validate the infrastructures part because of a previous error"){infrastructures}
try_validate_obj("Plan: Can't validate the nodes part because of a previous error"){nodes}
try_validate_obj("Plan: Can't validate the steps part because of a previous error"){step_sets}
try_validate_obj("Plan: Can't validate the credentials part because of a previous error"){credentials}
try_validate_obj("Infrastructure #{name}: Can't validate hooks part because of a previous error") { hooks }
end
|