Class: Bosh::Director::Api::ProblemManager

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh/director/api/problem_manager.rb

Instance Method Summary collapse

Constructor Details

#initialize(deployment_manager = DeploymentManager.new) ⇒ ProblemManager

Returns a new instance of ProblemManager.



5
6
7
# File 'lib/bosh/director/api/problem_manager.rb', line 5

def initialize(deployment_manager = DeploymentManager.new)
  @deployment_manager = deployment_manager
end

Instance Method Details

#apply_resolutions(user, deployment_name, resolutions) ⇒ Object



26
27
28
29
# File 'lib/bosh/director/api/problem_manager.rb', line 26

def apply_resolutions(user, deployment_name, resolutions)
  deployment = @deployment_manager.find_by_name(deployment_name)
  JobQueue.new.enqueue(user, Jobs::CloudCheck::ApplyResolutions, 'apply resolutions', [deployment.name, resolutions])
end

#get_problems(deployment_name) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/bosh/director/api/problem_manager.rb', line 15

def get_problems(deployment_name)
  deployment = @deployment_manager.find_by_name(deployment_name)

  filters = {
    :deployment_id => deployment.id,
    :state => 'open'
  }

  Models::DeploymentProblem.filter(filters).order(:created_at).all
end

#perform_scan(user, deployment_name) ⇒ Object



9
10
11
12
13
# File 'lib/bosh/director/api/problem_manager.rb', line 9

def perform_scan(user, deployment_name)
  deployment = @deployment_manager.find_by_name(deployment_name)

  JobQueue.new.enqueue(user, Jobs::CloudCheck::Scan, 'scan cloud', [deployment.name])
end

#scan_and_fix(user, deployment_name, jobs) ⇒ Object



31
32
33
34
35
# File 'lib/bosh/director/api/problem_manager.rb', line 31

def scan_and_fix(user, deployment_name, jobs)
  deployment = @deployment_manager.find_by_name(deployment_name)

  JobQueue.new.enqueue(user, Jobs::CloudCheck::ScanAndFix, 'scan and fix', [deployment.name, jobs, Bosh::Director::Config.fix_stateful_nodes])
end