62 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			62 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| require "db/mongo/models/mongo_model"
 | |
| 
 | |
| module Devops
 | |
|   module Model
 | |
|     class Report < MongoModel
 | |
| 
 | |
|       DEPLOY_TYPE = 1
 | |
|       SERVER_TYPE = 2
 | |
|       BOOTSTRAP_TYPE = 3
 | |
|       PROJECT_TEST_TYPE = 4
 | |
|       STACK_TYPE = 5
 | |
|       DEPLOY_STACK_TYPE = 6
 | |
|       DELETE_SERVER_TYPE = 7
 | |
|       EXPIRE_SERVER_TYPE = 8
 | |
|       SYNC_STACK_TYPE = 9
 | |
|       WAIT_BOOTSTRAP = 10
 | |
| 
 | |
| 
 | |
|       SYSTEM_OWNER = 'SYSTEM'
 | |
| 
 | |
|       attr_accessor :id, :file, :updated_at, :created_by, :project, :deploy_env, :type, :chef_node_name, :host, :status, :stack, :subreports, :job_result_code
 | |
| 
 | |
|       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"]
 | |
| #        self.created_at = r["created_at"]
 | |
|         self.chef_node_name = r["chef_node_name"]
 | |
|         self.host = r["host"]
 | |
|         self.stack = r["stack"]
 | |
|         self.created_at = r["created_at"].localtime unless r["created_at"].nil?
 | |
|         self.updated_at = r["updated_at"].localtime unless r["updated_at"].nil?
 | |
|         self.status = r["status"]
 | |
|         self.subreports = r["subreports"]
 | |
|         self.job_result_code = r["job_result_code"]
 | |
|       end
 | |
| 
 | |
|       def to_hash_without_id
 | |
|         {
 | |
|           "file" => self.file,
 | |
|           "created_at" => self.created_at,
 | |
|           "updated_at" => self.updated_at,
 | |
|           "created_by" => self.created_by,
 | |
|           "project" => self.project,
 | |
|           "deploy_env" => self.deploy_env,
 | |
|           "type" => self.type,
 | |
|           "chef_node_name" => self.chef_node_name,
 | |
|           "host" => self.host,
 | |
|           "status" => self.status,
 | |
|           "stack" => self.stack,
 | |
|           "subreports" => self.subreports,
 | |
|           "job_result_code" => self.job_result_code
 | |
|         }
 | |
|       end
 | |
| 
 | |
|     end
 | |
|   end
 | |
| end
 | 
