Class: TemplateInvocation

Inherits:
ApplicationRecord
  • Object
show all
Includes:
Authorizable, ForemanRemoteExecution::ErrorsFlattener, ForemanTasks::Concerns::ActionSubject
Defined in:
app/models/template_invocation.rb

Defined Under Namespace

Classes: TaskResultMap

Constant Summary collapse

FLATTENED_ERRORS_MAPPING =
{ :input_values => lambda do |input_value|
 _('Input') + " #{input_value.template_input.name}"
end }.freeze

Instance Method Summary collapse

Methods included from ForemanRemoteExecution::ErrorsFlattener

#flattened_errors, #flattened_validation_exception

Instance Method Details

#deep_cloneObject



83
84
85
86
87
88
# File 'app/models/template_invocation.rb', line 83

def deep_clone
  self.dup.tap do |invocation|
    invocation.input_values = self.input_values.map(&:dup)
    invocation.provider_input_values = self.provider_input_values.map(&:dup)
  end
end

#deep_clone!Object



90
91
92
# File 'app/models/template_invocation.rb', line 90

def deep_clone!
  deep_clone.tap(&:save!)
end

#templateObject



75
76
77
# File 'app/models/template_invocation.rb', line 75

def template
  JobTemplate.unscoped { super }
end

#to_action_inputObject



79
80
81
# File 'app/models/template_invocation.rb', line 79

def to_action_input
  { :id => id, :name => template.name }
end