2014-11-17 14:23:59 +03:00
|
|
|
require "db/mongo/models/mongo_model"
|
|
|
|
|
|
2015-03-06 12:20:30 +03:00
|
|
|
module Devops
|
|
|
|
|
module Model
|
|
|
|
|
class Report < MongoModel
|
2014-11-17 14:23:59 +03:00
|
|
|
|
2015-03-06 12:20:30 +03:00
|
|
|
DEPLOY_TYPE = 1
|
|
|
|
|
SERVER_TYPE = 2
|
|
|
|
|
BOOTSTRAP_TYPE = 3
|
|
|
|
|
PROJECT_TEST_TYPE = 4
|
2015-07-20 18:59:26 +03:00
|
|
|
STACK_TYPE = 5
|
2015-09-28 14:10:14 +03:00
|
|
|
DEPLOY_STACK_TYPE = 6
|
|
|
|
|
DELETE_SERVER_TYPE = 7
|
2016-02-02 10:34:17 +03:00
|
|
|
EXPIRE_SERVER_TYPE = 8
|
2014-11-17 14:23:59 +03:00
|
|
|
|
2015-11-03 12:05:07 +03:00
|
|
|
attr_accessor :id, :file, :updated_at, :created_by, :project, :deploy_env, :type, :chef_node_name, :host, :status, :stack, :subreports, :job_result_code
|
2014-11-17 14:23:59 +03:00
|
|
|
|
2015-03-06 12:20:30 +03:00
|
|
|
def initialize r
|
|
|
|
|
self.id = r["_id"]
|
|
|
|
|
self.file = r["file"]
|
|
|
|
|
self.created_by = r["created_by"]
|
|
|
|
|
self.project = r["project"]
|
|
|
|
|
self.deploy_env = r["deploy_env"]
|
|
|
|
|
self.type = r["type"]
|
2015-11-03 12:05:07 +03:00
|
|
|
# self.created_at = r["created_at"]
|
2015-07-30 15:37:43 +03:00
|
|
|
self.chef_node_name = r["chef_node_name"]
|
|
|
|
|
self.host = r["host"]
|
2015-09-28 14:10:14 +03:00
|
|
|
self.stack = r["stack"]
|
2015-07-30 15:37:43 +03:00
|
|
|
self.created_at = r["created_at"].localtime unless r["created_at"].nil?
|
|
|
|
|
self.updated_at = r["updated_at"].localtime unless r["updated_at"].nil?
|
2015-09-14 10:48:38 +03:00
|
|
|
self.status = r["status"]
|
2015-11-03 12:05:07 +03:00
|
|
|
self.subreports = r["subreports"]
|
|
|
|
|
self.job_result_code = r["job_result_code"]
|
2015-03-06 12:20:30 +03:00
|
|
|
end
|
2014-11-17 14:23:59 +03:00
|
|
|
|
2015-03-06 12:20:30 +03:00
|
|
|
def to_hash_without_id
|
|
|
|
|
{
|
|
|
|
|
"file" => self.file,
|
|
|
|
|
"created_at" => self.created_at,
|
2015-07-30 15:37:43 +03:00
|
|
|
"updated_at" => self.updated_at,
|
2015-03-06 12:20:30 +03:00
|
|
|
"created_by" => self.created_by,
|
|
|
|
|
"project" => self.project,
|
|
|
|
|
"deploy_env" => self.deploy_env,
|
2015-07-30 15:37:43 +03:00
|
|
|
"type" => self.type,
|
|
|
|
|
"chef_node_name" => self.chef_node_name,
|
2015-09-14 10:48:38 +03:00
|
|
|
"host" => self.host,
|
2015-09-28 14:10:14 +03:00
|
|
|
"status" => self.status,
|
2015-11-03 12:05:07 +03:00
|
|
|
"stack" => self.stack,
|
|
|
|
|
"subreports" => self.subreports,
|
|
|
|
|
"job_result_code" => self.job_result_code
|
2015-03-06 12:20:30 +03:00
|
|
|
}
|
|
|
|
|
end
|
2014-11-17 14:23:59 +03:00
|
|
|
|
2015-03-06 12:20:30 +03:00
|
|
|
end
|
|
|
|
|
end
|
2014-11-17 14:23:59 +03:00
|
|
|
end
|