Class: ForemanDeployments::Deployment
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- ForemanDeployments::Deployment
- Includes:
- Authorizable, Concerns::BelongsToStackTaxonomy
- Defined in:
- app/models/foreman_deployments/deployment.rb
Instance Method Summary collapse
Methods inherited from ActiveRecord::Base
Instance Method Details
#configurator ⇒ Object
23 24 25 |
# File 'app/models/foreman_deployments/deployment.rb', line 23 def configurator @configurator ||= ForemanDeployments::Config::Configurator.new(parsed_stack) end |
#parsed_stack ⇒ Object
19 20 21 |
# File 'app/models/foreman_deployments/deployment.rb', line 19 def parsed_stack @parsed_stack ||= ForemanDeployments::StackParser.parse(stack.definition) unless stack.nil? end |
#run ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/models/foreman_deployments/deployment.rb', line 27 def run fail(Foreman::Exception, _("You can't start a deployment that is already running!")) if status == :running # configure with user input configurator.configure(configuration) # validate parsed_stack.validate! self.task = ForemanTasks.async_task(Tasks::StackDeployAction, parsed_stack) save end |
#stack ⇒ Object
15 16 17 |
# File 'app/models/foreman_deployments/deployment.rb', line 15 def stack configuration.stack if configuration end |
#status ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/models/foreman_deployments/deployment.rb', line 40 def status # configuration, running, deployed, failed if task.nil? :configuration elsif task.state == 'paused' :paused elsif task.state == 'stopped' if task.result == 'success' :deployed else :failed end else :running end end |