lib/mkit/app/model/pod.rb in mkit-0.8.0 vs lib/mkit/app/model/pod.rb in mkit-0.9.0

- old
+ new

@@ -38,11 +38,11 @@ self.dns_host.ip = self.ip self.dns_host.save end def set_status_from_docker - if self.instance + if !self.instance.nil? if instance.State.Running self.status = MKIt::Status::RUNNING else self.status = MKIt::Status::STOPPED end @@ -82,8 +82,17 @@ remove_instance(self.name) unless self.instance.nil? rescue => e MKItLogger.warn(e) end MkitJob.publish(topic: :pod_destroyed, service_id: self.service.id, data: {pod_id: self.id}) + end + + def to_h + { + 'name' => self.name, + 'ip' => self.dns_host.nil? || self.dns_host.ip.nil? ? self.ip : self.dns_host.ip, + 'dns' => self.dns_host.nil? || self.dns_host.name.nil? ? self.ip : self.dns_host.name, + 'status' => self.status + } end end