Class: ForemanDeployments::Tasks::CreationTaskDefinition
Defined Under Namespace
Classes: Action
Instance Attribute Summary
#parameters, #planned, #task_id
Class Method Summary
collapse
Instance Method Summary
collapse
#accept, #configuration, #configure, #initialize, #merge_configuration, #plan, #to_hash
Class Method Details
.build(parameters) ⇒ Object
58
59
60
61
62
63
64
65
|
# File 'app/lib/foreman_deployments/tasks/creation_task_definition.rb', line 58
def self.build(parameters)
case parameters['class']
when 'Host', 'Host::Managed'
HostCreationTaskDefinition.new(parameters)
else
CreationTaskDefinition.new(parameters)
end
end
|
.create_object(parameters) ⇒ Object
28
29
30
31
32
33
34
35
36
|
# File 'app/lib/foreman_deployments/tasks/creation_task_definition.rb', line 28
def self.create_object(parameters)
object_type = parameters['class']
object_params = parameters['params'] || {}
object_type = object_type.constantize if object_type.is_a? String
object = object_type.new
set_parameters(object, object_params)
end
|
.create_output(obj, output_hash = {}) ⇒ Object
49
50
51
52
|
# File 'app/lib/foreman_deployments/tasks/creation_task_definition.rb', line 49
def self.create_output(obj, output_hash = {})
output_hash['object'] = obj
output_hash
end
|
.set_parameters(object, object_params) ⇒ Object
38
39
40
41
42
43
44
45
46
47
|
# File 'app/lib/foreman_deployments/tasks/creation_task_definition.rb', line 38
def self.set_parameters(object, object_params)
object_params.each do |key, value|
if object.respond_to?("#{key}=")
object.send("#{key}=", value)
end
end
object
end
|
.tag_name ⇒ Object
54
55
56
|
# File 'app/lib/foreman_deployments/tasks/creation_task_definition.rb', line 54
def self.tag_name
'CreateResource'
end
|
Instance Method Details
#dynflow_action ⇒ Object
24
25
26
|
# File 'app/lib/foreman_deployments/tasks/creation_task_definition.rb', line 24
def dynflow_action
self.class::Action
end
|
#preliminary_output ⇒ Object
20
21
22
|
# File 'app/lib/foreman_deployments/tasks/creation_task_definition.rb', line 20
def preliminary_output
self.class.create_output(self.class.create_object(parameters.configured))
end
|