bosh-director 1.2063.0 → 1.2068.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/bosh/director.rb CHANGED
@@ -110,6 +110,7 @@ require 'bosh/director/jobs/update_release'
110
110
  require 'bosh/director/jobs/update_stemcell'
111
111
  require 'bosh/director/jobs/fetch_logs'
112
112
  require 'bosh/director/jobs/vm_state'
113
+ require 'bosh/director/jobs/run_errand'
113
114
  require 'bosh/director/jobs/cloud_check/scan'
114
115
  require 'bosh/director/jobs/cloud_check/scan_and_fix'
115
116
  require 'bosh/director/jobs/cloud_check/apply_resolutions'
@@ -76,6 +76,10 @@ module Bosh::Director
76
76
  send_long_running_message(:stop, *args)
77
77
  end
78
78
 
79
+ def run_errand(*args)
80
+ send_long_running_message(:run_errand, *args)
81
+ end
82
+
79
83
  def wait_until_ready(deadline = 600)
80
84
  old_timeout = @timeout
81
85
  @timeout = 1.0
@@ -9,6 +9,7 @@ require 'bosh/director/api/controllers/stemcells_controller'
9
9
  require 'bosh/director/api/controllers/tasks_controller'
10
10
  require 'bosh/director/api/controllers/users_controller'
11
11
  require 'bosh/director/api/controllers/compiled_packages_controller'
12
+ require 'bosh/director/api/controllers/errands_controller'
12
13
 
13
14
  module Bosh::Director
14
15
  module Api
@@ -24,6 +25,7 @@ module Bosh::Director
24
25
  use Controllers::TasksController
25
26
  use Controllers::UsersController
26
27
  use Controllers::CompiledPackagesController
28
+ use Controllers::ErrandsController
27
29
  end
28
30
  end
29
31
  end
@@ -0,0 +1,26 @@
1
+ require 'json'
2
+ require 'bosh/director/api/controllers/base_controller'
3
+
4
+ module Bosh::Director
5
+ module Api::Controllers
6
+ class ErrandsController < BaseController
7
+ post '/deployments/:deployment_name/errands/:errand_name/runs' do
8
+ deployment_name = params[:deployment_name]
9
+ errand_name = params[:errand_name]
10
+
11
+ task = JobQueue.new.enqueue(
12
+ @user,
13
+ Jobs::RunErrand,
14
+ "run errand #{errand_name} from deployment #{deployment_name}",
15
+ [deployment_name, errand_name],
16
+ )
17
+
18
+ redirect "/tasks/#{task.id}"
19
+ end
20
+
21
+ def body_params
22
+ @body_params ||= JSON.load(request.body)
23
+ end
24
+ end
25
+ end
26
+ end
@@ -180,6 +180,7 @@ module Bosh::Director
180
180
  AgentJobNotStopped = err(400008)
181
181
  AgentUnexpectedDisk = err(400009)
182
182
  AgentDiskOutOfSync = err(400010)
183
+ AgentInvalidTaskResult = err(400011)
183
184
 
184
185
  CloudcheckTooManySimilarProblems = err(410001)
185
186
  CloudcheckResolutionNotProvided = err(410002)
@@ -0,0 +1,51 @@
1
+ require 'membrane'
2
+
3
+ module Bosh::Director
4
+ module Jobs
5
+ class RunErrand < BaseJob
6
+ @queue = :normal
7
+
8
+ def self.job_type
9
+ :run_errand
10
+ end
11
+
12
+ def initialize(deployment_name, errand_name)
13
+ @deployment_name = deployment_name
14
+ @errand_name = errand_name
15
+ @instance_manager = Api::InstanceManager.new
16
+ end
17
+
18
+ def perform
19
+ instance = @instance_manager.find_by_name(@deployment_name, @errand_name, 0)
20
+
21
+ agent = @instance_manager.agent_client_for(instance)
22
+ agent_task_result = agent.run_errand
23
+
24
+ director_task_result = extract_director_task_result(agent_task_result)
25
+ result_file.write(JSON.dump(director_task_result) + "\n")
26
+ end
27
+
28
+ private
29
+
30
+ AGENT_TASK_RESULT_SCHEMA = ::Membrane::SchemaParser.parse do
31
+ { 'exit_code' => Integer,
32
+ 'stdout' => String,
33
+ 'stderr' => String,
34
+ }
35
+ end
36
+
37
+ # Explicitly write out schema of the director task result
38
+ # to avoid accidently leaking agent task result extra fields.
39
+ def extract_director_task_result(agent_task_result)
40
+ AGENT_TASK_RESULT_SCHEMA.validate(agent_task_result)
41
+ {
42
+ 'exit_code' => agent_task_result['exit_code'],
43
+ 'stdout' => agent_task_result['stdout'],
44
+ 'stderr' => agent_task_result['stderr'],
45
+ }
46
+ rescue Membrane::SchemaValidationError => e
47
+ raise AgentInvalidTaskResult, e.message
48
+ end
49
+ end
50
+ end
51
+ end
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Director
3
- VERSION = '1.2063.0'
3
+ VERSION = '1.2068.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh-director
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2063.0
4
+ version: 1.2068.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-25 00:00:00.000000000 Z
12
+ date: 2014-02-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bcrypt-ruby
@@ -34,7 +34,7 @@ dependencies:
34
34
  requirements:
35
35
  - - ~>
36
36
  - !ruby/object:Gem::Version
37
- version: 1.2063.0
37
+ version: 1.2068.0
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
- version: 1.2063.0
45
+ version: 1.2068.0
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: bosh-core
48
48
  requirement: !ruby/object:Gem::Requirement
@@ -50,7 +50,7 @@ dependencies:
50
50
  requirements:
51
51
  - - ~>
52
52
  - !ruby/object:Gem::Version
53
- version: 1.2063.0
53
+ version: 1.2068.0
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,7 +58,7 @@ dependencies:
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: 1.2063.0
61
+ version: 1.2068.0
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: bosh-director-core
64
64
  requirement: !ruby/object:Gem::Requirement
@@ -66,7 +66,7 @@ dependencies:
66
66
  requirements:
67
67
  - - ~>
68
68
  - !ruby/object:Gem::Version
69
- version: 1.2063.0
69
+ version: 1.2068.0
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
@@ -74,7 +74,7 @@ dependencies:
74
74
  requirements:
75
75
  - - ~>
76
76
  - !ruby/object:Gem::Version
77
- version: 1.2063.0
77
+ version: 1.2068.0
78
78
  - !ruby/object:Gem::Dependency
79
79
  name: bosh_common
80
80
  requirement: !ruby/object:Gem::Requirement
@@ -82,7 +82,7 @@ dependencies:
82
82
  requirements:
83
83
  - - ~>
84
84
  - !ruby/object:Gem::Version
85
- version: 1.2063.0
85
+ version: 1.2068.0
86
86
  type: :runtime
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
@@ -90,7 +90,7 @@ dependencies:
90
90
  requirements:
91
91
  - - ~>
92
92
  - !ruby/object:Gem::Version
93
- version: 1.2063.0
93
+ version: 1.2068.0
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: bosh_cpi
96
96
  requirement: !ruby/object:Gem::Requirement
@@ -98,7 +98,7 @@ dependencies:
98
98
  requirements:
99
99
  - - ~>
100
100
  - !ruby/object:Gem::Version
101
- version: 1.2063.0
101
+ version: 1.2068.0
102
102
  type: :runtime
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
@@ -106,7 +106,7 @@ dependencies:
106
106
  requirements:
107
107
  - - ~>
108
108
  - !ruby/object:Gem::Version
109
- version: 1.2063.0
109
+ version: 1.2068.0
110
110
  - !ruby/object:Gem::Dependency
111
111
  name: bosh_openstack_cpi
112
112
  requirement: !ruby/object:Gem::Requirement
@@ -114,7 +114,7 @@ dependencies:
114
114
  requirements:
115
115
  - - ~>
116
116
  - !ruby/object:Gem::Version
117
- version: 1.2063.0
117
+ version: 1.2068.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
@@ -122,7 +122,7 @@ dependencies:
122
122
  requirements:
123
123
  - - ~>
124
124
  - !ruby/object:Gem::Version
125
- version: 1.2063.0
125
+ version: 1.2068.0
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: bosh_aws_cpi
128
128
  requirement: !ruby/object:Gem::Requirement
@@ -130,7 +130,7 @@ dependencies:
130
130
  requirements:
131
131
  - - ~>
132
132
  - !ruby/object:Gem::Version
133
- version: 1.2063.0
133
+ version: 1.2068.0
134
134
  type: :runtime
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
@@ -138,7 +138,7 @@ dependencies:
138
138
  requirements:
139
139
  - - ~>
140
140
  - !ruby/object:Gem::Version
141
- version: 1.2063.0
141
+ version: 1.2068.0
142
142
  - !ruby/object:Gem::Dependency
143
143
  name: bosh_vsphere_cpi
144
144
  requirement: !ruby/object:Gem::Requirement
@@ -146,7 +146,7 @@ dependencies:
146
146
  requirements:
147
147
  - - ~>
148
148
  - !ruby/object:Gem::Version
149
- version: 1.2063.0
149
+ version: 1.2068.0
150
150
  type: :runtime
151
151
  prerelease: false
152
152
  version_requirements: !ruby/object:Gem::Requirement
@@ -154,7 +154,7 @@ dependencies:
154
154
  requirements:
155
155
  - - ~>
156
156
  - !ruby/object:Gem::Version
157
- version: 1.2063.0
157
+ version: 1.2068.0
158
158
  - !ruby/object:Gem::Dependency
159
159
  name: eventmachine
160
160
  requirement: !ruby/object:Gem::Requirement
@@ -395,6 +395,22 @@ dependencies:
395
395
  - - ~>
396
396
  - !ruby/object:Gem::Version
397
397
  version: 1.1.0
398
+ - !ruby/object:Gem::Dependency
399
+ name: membrane
400
+ requirement: !ruby/object:Gem::Requirement
401
+ none: false
402
+ requirements:
403
+ - - ~>
404
+ - !ruby/object:Gem::Version
405
+ version: 0.0.2
406
+ type: :runtime
407
+ prerelease: false
408
+ version_requirements: !ruby/object:Gem::Requirement
409
+ none: false
410
+ requirements:
411
+ - - ~>
412
+ - !ruby/object:Gem::Version
413
+ version: 0.0.2
398
414
  - !ruby/object:Gem::Dependency
399
415
  name: bosh_vcloud_cpi
400
416
  requirement: !ruby/object:Gem::Requirement
@@ -477,7 +493,7 @@ dependencies:
477
493
  version: '1.0'
478
494
  description: ! 'BOSH Director
479
495
 
480
- 941741'
496
+ 5f63a5'
481
497
  email: support@cloudfoundry.com
482
498
  executables:
483
499
  - bosh-director
@@ -532,6 +548,7 @@ files:
532
548
  - lib/bosh/director/api/controllers/base_controller.rb
533
549
  - lib/bosh/director/api/controllers/compiled_packages_controller.rb
534
550
  - lib/bosh/director/api/controllers/deployments_controller.rb
551
+ - lib/bosh/director/api/controllers/errands_controller.rb
535
552
  - lib/bosh/director/api/controllers/info_controller.rb
536
553
  - lib/bosh/director/api/controllers/packages_controller.rb
537
554
  - lib/bosh/director/api/controllers/releases_controller.rb
@@ -632,6 +649,7 @@ files:
632
649
  - lib/bosh/director/jobs/delete_stemcell.rb
633
650
  - lib/bosh/director/jobs/fetch_logs.rb
634
651
  - lib/bosh/director/jobs/import_compiled_packages.rb
652
+ - lib/bosh/director/jobs/run_errand.rb
635
653
  - lib/bosh/director/jobs/scheduled_backup.rb
636
654
  - lib/bosh/director/jobs/snapshot_deployment.rb
637
655
  - lib/bosh/director/jobs/snapshot_deployments.rb
@@ -722,7 +740,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
722
740
  version: '0'
723
741
  segments:
724
742
  - 0
725
- hash: -4253473859462825944
743
+ hash: 2428975643458331194
726
744
  requirements: []
727
745
  rubyforge_project:
728
746
  rubygems_version: 1.8.23