bosh-director 1.2347.0 → 1.2354.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/bosh/director/api/controller.rb +2 -0
- data/lib/bosh/director/api/controllers/locks_controller.rb +25 -0
- data/lib/bosh/director/deployment_plan/job.rb +0 -17
- data/lib/bosh/director/job_updater.rb +2 -19
- data/lib/bosh/director/lock_helper.rb +2 -2
- data/lib/bosh/director/version.rb +1 -1
- data/lib/cloud/dummy.rb +2 -2
- metadata +21 -20
|
@@ -10,6 +10,7 @@ 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
12
|
require 'bosh/director/api/controllers/errands_controller'
|
|
13
|
+
require 'bosh/director/api/controllers/locks_controller'
|
|
13
14
|
|
|
14
15
|
module Bosh::Director
|
|
15
16
|
module Api
|
|
@@ -26,6 +27,7 @@ module Bosh::Director
|
|
|
26
27
|
use Controllers::UsersController
|
|
27
28
|
use Controllers::CompiledPackagesController
|
|
28
29
|
use Controllers::ErrandsController
|
|
30
|
+
use Controllers::LocksController
|
|
29
31
|
end
|
|
30
32
|
end
|
|
31
33
|
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module Bosh::Director
|
|
2
|
+
module Api::Controllers
|
|
3
|
+
class LocksController < BaseController
|
|
4
|
+
get '/locks' do
|
|
5
|
+
redis = Config.redis
|
|
6
|
+
|
|
7
|
+
locks = []
|
|
8
|
+
lock_keys = redis.keys('lock:*')
|
|
9
|
+
# Deliberatelly not using redis futures here as we expect that the number of lock keys will be very small
|
|
10
|
+
lock_keys.each do |lock_key|
|
|
11
|
+
lock_value = redis.get(lock_key)
|
|
12
|
+
unless lock_value.nil?
|
|
13
|
+
lock_type = lock_key.split(':')[1]
|
|
14
|
+
lock_resource = lock_key.split(':')[2..-1]
|
|
15
|
+
lock_timeout = lock_value.split(':')[0]
|
|
16
|
+
locks << { type: lock_type, resource: lock_resource, timeout: lock_timeout }
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
content_type(:json)
|
|
21
|
+
json_encode(locks)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -66,10 +66,6 @@ module Bosh::Director
|
|
|
66
66
|
# @return [Hash<Integer, String>] Individual instance expected states
|
|
67
67
|
attr_accessor :instance_states
|
|
68
68
|
|
|
69
|
-
# @return [Exception] Exception that requires job update process to be
|
|
70
|
-
# interrupted
|
|
71
|
-
attr_accessor :halt_exception
|
|
72
|
-
|
|
73
69
|
attr_accessor :all_properties
|
|
74
70
|
|
|
75
71
|
# @param [Bosh::Director::DeploymentPlan::Planner]
|
|
@@ -94,9 +90,7 @@ module Bosh::Director
|
|
|
94
90
|
@unneeded_instances = []
|
|
95
91
|
@instance_states = {}
|
|
96
92
|
|
|
97
|
-
@error_mutex = Mutex.new
|
|
98
93
|
@packages = {}
|
|
99
|
-
@halt = false
|
|
100
94
|
end
|
|
101
95
|
|
|
102
96
|
def self.is_legacy_spec?(job_spec)
|
|
@@ -190,17 +184,6 @@ module Bosh::Director
|
|
|
190
184
|
@packages[compiled_package.name] = compiled_package
|
|
191
185
|
end
|
|
192
186
|
|
|
193
|
-
def should_halt?
|
|
194
|
-
@halt
|
|
195
|
-
end
|
|
196
|
-
|
|
197
|
-
def record_update_error(error, options = {})
|
|
198
|
-
@error_mutex.synchronize do
|
|
199
|
-
@halt = true
|
|
200
|
-
@halt_exception = error
|
|
201
|
-
end
|
|
202
|
-
end
|
|
203
|
-
|
|
204
187
|
# Extracts only the properties needed by this job. This is decoupled from
|
|
205
188
|
# parsing properties because templates need to be bound to their models
|
|
206
189
|
# before 'bind_properties' is being called (as we persist job template
|
|
@@ -5,7 +5,6 @@ module Bosh::Director
|
|
|
5
5
|
def initialize(deployment_plan, job)
|
|
6
6
|
@deployment_plan = deployment_plan
|
|
7
7
|
@job = job
|
|
8
|
-
@cloud = Config.cloud
|
|
9
8
|
@logger = Config.logger
|
|
10
9
|
@event_log = Config.event_log
|
|
11
10
|
end
|
|
@@ -36,24 +35,12 @@ module Bosh::Director
|
|
|
36
35
|
pool.wait
|
|
37
36
|
|
|
38
37
|
@logger.info("Finished canary update")
|
|
39
|
-
if @job.should_halt?
|
|
40
|
-
@logger.warn("Halting deployment due to a canary failure")
|
|
41
|
-
halt
|
|
42
|
-
end
|
|
43
38
|
|
|
44
39
|
@logger.info("Continuing the rest of the update")
|
|
45
40
|
update_instances(pool, instances, event_log_stage)
|
|
46
41
|
end
|
|
47
42
|
|
|
48
43
|
@logger.info("Finished the rest of the update")
|
|
49
|
-
if @job.should_halt?
|
|
50
|
-
@logger.warn("Halting deployment due to an update failure")
|
|
51
|
-
halt
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def halt
|
|
56
|
-
raise(@job.halt_exception || RuntimeError.new("Deployment has been halted"))
|
|
57
44
|
end
|
|
58
45
|
|
|
59
46
|
private
|
|
@@ -79,14 +66,12 @@ module Bosh::Director
|
|
|
79
66
|
def update_canary_instance(instance, event_log_stage)
|
|
80
67
|
desc = "#{@job.name}/#{instance.index}"
|
|
81
68
|
event_log_stage.advance_and_track("#{desc} (canary)") do |ticker|
|
|
82
|
-
next if @job.should_halt?
|
|
83
|
-
|
|
84
69
|
with_thread_name("canary_update(#{desc})") do
|
|
85
70
|
begin
|
|
86
71
|
InstanceUpdater.new(instance, ticker).update(:canary => true)
|
|
87
72
|
rescue Exception => e
|
|
88
73
|
@logger.error("Error updating canary instance: #{e.inspect}\n#{e.backtrace.join("\n")}")
|
|
89
|
-
|
|
74
|
+
raise
|
|
90
75
|
end
|
|
91
76
|
end
|
|
92
77
|
end
|
|
@@ -101,14 +86,12 @@ module Bosh::Director
|
|
|
101
86
|
def update_instance(instance, event_log_stage)
|
|
102
87
|
desc = "#{@job.name}/#{instance.index}"
|
|
103
88
|
event_log_stage.advance_and_track(desc) do |ticker|
|
|
104
|
-
next if @job.should_halt?
|
|
105
|
-
|
|
106
89
|
with_thread_name("instance_update(#{desc})") do
|
|
107
90
|
begin
|
|
108
91
|
InstanceUpdater.new(instance, ticker).update
|
|
109
92
|
rescue Exception => e
|
|
110
93
|
@logger.error("Error updating instance: #{e.inspect}\n#{e.backtrace.join("\n")}")
|
|
111
|
-
|
|
94
|
+
raise
|
|
112
95
|
end
|
|
113
96
|
end
|
|
114
97
|
end
|
|
@@ -30,7 +30,7 @@ module Bosh::Director
|
|
|
30
30
|
# @yield [void] block to surround
|
|
31
31
|
def with_stemcell_lock(name, version, opts = {})
|
|
32
32
|
timeout = opts[:timeout] || 10
|
|
33
|
-
Config.logger.info("Acquiring
|
|
33
|
+
Config.logger.info("Acquiring stemcell lock on #{name}:#{version}")
|
|
34
34
|
Lock.new("lock:stemcells:#{name}:#{version}", :timeout => timeout).
|
|
35
35
|
lock { yield }
|
|
36
36
|
end
|
|
@@ -43,7 +43,7 @@ module Bosh::Director
|
|
|
43
43
|
# @yield [void] block to surround
|
|
44
44
|
def with_release_lock(release, opts = {})
|
|
45
45
|
timeout = opts[:timeout] || 10
|
|
46
|
-
Config.logger.info("Acquiring
|
|
46
|
+
Config.logger.info("Acquiring release lock on #{release}")
|
|
47
47
|
Lock.new("lock:release:#{release}", :timeout => timeout).lock { yield }
|
|
48
48
|
end
|
|
49
49
|
|
data/lib/cloud/dummy.rb
CHANGED
|
@@ -173,10 +173,10 @@ module Bosh
|
|
|
173
173
|
end
|
|
174
174
|
|
|
175
175
|
def agent_cmd(agent_id, root_dir)
|
|
176
|
-
go_agent_exe = File.
|
|
176
|
+
go_agent_exe = File.expand_path('../../../../go_agent/out/bosh-agent', __FILE__)
|
|
177
177
|
{
|
|
178
178
|
'ruby' => %W[bosh_agent -b #{agent_base_dir(agent_id)} -I dummy -r #{root_dir} --no-alerts],
|
|
179
|
-
'go' => %W[#{go_agent_exe} -b #{agent_base_dir(agent_id)} -I dummy -P dummy -M dummy],
|
|
179
|
+
'go' => %W[#{go_agent_exe} -b #{agent_base_dir(agent_id)} -I dummy -P dummy -M dummy-nats],
|
|
180
180
|
}[@agent_type.to_s]
|
|
181
181
|
end
|
|
182
182
|
|
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.
|
|
4
|
+
version: 1.2354.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-04-
|
|
12
|
+
date: 2014-04-04 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.
|
|
37
|
+
version: 1.2354.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.
|
|
45
|
+
version: 1.2354.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.
|
|
53
|
+
version: 1.2354.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.
|
|
61
|
+
version: 1.2354.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.
|
|
69
|
+
version: 1.2354.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.
|
|
77
|
+
version: 1.2354.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.
|
|
85
|
+
version: 1.2354.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.
|
|
93
|
+
version: 1.2354.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.
|
|
101
|
+
version: 1.2354.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.
|
|
109
|
+
version: 1.2354.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.
|
|
117
|
+
version: 1.2354.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.
|
|
125
|
+
version: 1.2354.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.
|
|
133
|
+
version: 1.2354.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.
|
|
141
|
+
version: 1.2354.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.
|
|
149
|
+
version: 1.2354.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.
|
|
157
|
+
version: 1.2354.0
|
|
158
158
|
- !ruby/object:Gem::Dependency
|
|
159
159
|
name: bosh_vcloud_cpi
|
|
160
160
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -493,7 +493,7 @@ dependencies:
|
|
|
493
493
|
version: '1.0'
|
|
494
494
|
description: ! 'BOSH Director
|
|
495
495
|
|
|
496
|
-
|
|
496
|
+
fdf40d'
|
|
497
497
|
email: support@cloudfoundry.com
|
|
498
498
|
executables:
|
|
499
499
|
- bosh-director
|
|
@@ -550,6 +550,7 @@ files:
|
|
|
550
550
|
- lib/bosh/director/api/controllers/deployments_controller.rb
|
|
551
551
|
- lib/bosh/director/api/controllers/errands_controller.rb
|
|
552
552
|
- lib/bosh/director/api/controllers/info_controller.rb
|
|
553
|
+
- lib/bosh/director/api/controllers/locks_controller.rb
|
|
553
554
|
- lib/bosh/director/api/controllers/packages_controller.rb
|
|
554
555
|
- lib/bosh/director/api/controllers/releases_controller.rb
|
|
555
556
|
- lib/bosh/director/api/controllers/resources_controller.rb
|
|
@@ -748,7 +749,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
748
749
|
version: '0'
|
|
749
750
|
segments:
|
|
750
751
|
- 0
|
|
751
|
-
hash:
|
|
752
|
+
hash: -506812019420664428
|
|
752
753
|
requirements: []
|
|
753
754
|
rubyforge_project:
|
|
754
755
|
rubygems_version: 1.8.23
|