Class: ForemanDeployments::Tasks::BaseDefinition
- Inherits:
-
Object
- Object
- ForemanDeployments::Tasks::BaseDefinition
show all
- Defined in:
- app/lib/foreman_deployments/tasks/base_definition.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of BaseDefinition.
7
8
9
|
# File 'app/lib/foreman_deployments/tasks/base_definition.rb', line 7
def initialize(params = nil)
@parameters = ForemanDeployments::Config.cast_to_configuration(params || {})
end
|
Instance Attribute Details
#parameters ⇒ Object
Returns the value of attribute parameters.
4
5
6
|
# File 'app/lib/foreman_deployments/tasks/base_definition.rb', line 4
def parameters
@parameters
end
|
#planned ⇒ Object
Returns the value of attribute planned.
5
6
7
|
# File 'app/lib/foreman_deployments/tasks/base_definition.rb', line 5
def planned
@planned
end
|
#task_id ⇒ Object
Returns the value of attribute task_id.
4
5
6
|
# File 'app/lib/foreman_deployments/tasks/base_definition.rb', line 4
def task_id
@task_id
end
|
Class Method Details
.build(params = {}) ⇒ Object
55
56
57
|
# File 'app/lib/foreman_deployments/tasks/base_definition.rb', line 55
def self.build(params = {})
new(params)
end
|
.tag_name ⇒ Object
51
52
53
|
# File 'app/lib/foreman_deployments/tasks/base_definition.rb', line 51
def self.tag_name
name.split('::').last
end
|
Instance Method Details
#accept(visitor) ⇒ Object
39
40
41
42
|
# File 'app/lib/foreman_deployments/tasks/base_definition.rb', line 39
def accept(visitor)
visit_parameters(visitor, parameters)
visitor.visit(self)
end
|
#configuration ⇒ Object
35
36
37
|
# File 'app/lib/foreman_deployments/tasks/base_definition.rb', line 35
def configuration
@parameters.configuration
end
|
27
28
29
|
# File 'app/lib/foreman_deployments/tasks/base_definition.rb', line 27
def configure(parameters)
@parameters.configure(parameters)
end
|
#dynflow_action ⇒ Object
15
16
17
|
# File 'app/lib/foreman_deployments/tasks/base_definition.rb', line 15
def dynflow_action
fail NotImplementedError, "Method 'dynflow_action' method needs to be implemented"
end
|
#merge_configuration(additional_parameters) ⇒ Object
31
32
33
|
# File 'app/lib/foreman_deployments/tasks/base_definition.rb', line 31
def merge_configuration(additional_parameters)
@parameters.merge_configuration(additional_parameters)
end
|
#plan(parent_task) ⇒ Object
11
12
13
|
# File 'app/lib/foreman_deployments/tasks/base_definition.rb', line 11
def plan(parent_task)
@planned ||= parent_task.send(:plan_action, dynflow_action, parameters.configured)
end
|
#preliminary_output ⇒ Object
23
24
25
|
# File 'app/lib/foreman_deployments/tasks/base_definition.rb', line 23
def preliminary_output
fail NotImplementedError, "Method 'preliminary_output' needs to be implemented"
end
|
#to_hash ⇒ Object
44
45
46
47
48
49
|
# File 'app/lib/foreman_deployments/tasks/base_definition.rb', line 44
def to_hash
@parameters.configured.merge(
'_type' => 'task',
'_name' => self.class.tag_name
)
end
|
#validate ⇒ Object
19
20
21
|
# File 'app/lib/foreman_deployments/tasks/base_definition.rb', line 19
def validate
fail NotImplementedError, "Method 'validate' needs to be implemented"
end
|