Class: Bosh::Director::Models::DeploymentProblem

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh/director/models/deployment_problem.rb

Constant Summary collapse

STATES =
%w(open closed resolved)

Instance Method Summary collapse

Instance Method Details

#before_createObject



19
20
21
22
# File 'lib/bosh/director/models/deployment_problem.rb', line 19

def before_create
  self.created_at ||= Time.now
  self.last_seen_at ||= Time.now
end

#dataObject



24
25
26
# File 'lib/bosh/director/models/deployment_problem.rb', line 24

def data
  JSON.parse(data_json)
end

#data=(raw_data) ⇒ Object



28
29
30
# File 'lib/bosh/director/models/deployment_problem.rb', line 28

def data=(raw_data)
  self.data_json = JSON.generate(raw_data)
end

#descriptionObject



40
41
42
# File 'lib/bosh/director/models/deployment_problem.rb', line 40

def description
  handler.description
end

#handlerObject



32
33
34
# File 'lib/bosh/director/models/deployment_problem.rb', line 32

def handler
  @handler ||= Bosh::Director::ProblemHandlers::Base.create_from_model(self)
end

#open?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/bosh/director/models/deployment_problem.rb', line 44

def open?
  state == "open"
end

#resolutionsObject



36
37
38
# File 'lib/bosh/director/models/deployment_problem.rb', line 36

def resolutions
  handler.resolutions
end

#validateObject



10
11
12
13
14
15
16
17
# File 'lib/bosh/director/models/deployment_problem.rb', line 10

def validate
  validates_presence :deployment_id
  validates_presence :resource_id
  validates_presence :type
  validates_presence :data_json
  validates_presence :state
  validates_includes STATES, :state
end