Class: MKIt::CreatePodSaga

Inherits:
ASaga
  • Object
show all
Defined in:
lib/mkit/sagas/create_pod_saga.rb

Instance Method Summary collapse

Methods inherited from ASaga

#initialize

Constructor Details

This class inherits a constructor from MKIt::ASaga

Instance Method Details

#do_the(job) ⇒ Object

create_pod_saga:

payload:

* service_id

triggers

* nothing


17
18
19
20
21
22
23
24
25
26
# File 'lib/mkit/sagas/create_pod_saga.rb', line 17

def do_the(job)
  MKItLogger.info("#{self.class} <#{job.topic}> #{job.inspect}....")
  service = Service.find(job.service_id)
  # create pod

  pd = Pod.new( service: service, status: MKIt::Status::CREATED, name: SecureRandom.uuid.gsub('-','')[0..11])
  service.pod << pd
  service.save
  MkitJob.publish(topic: :start_pod, service_id: job.service_id, pod_id: pd.id)
end

#topicsObject



4
5
6
# File 'lib/mkit/sagas/create_pod_saga.rb', line 4

def topics
  %w{create_pod_saga}
end