bosh-director 1.3115.0 → 1.3120.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 55328ec9d042beefb1bf840777ea01ef3e2f22ed
4
- data.tar.gz: d2af38792bd179f949e3cf79c9dab94ef12de2e6
3
+ metadata.gz: c1eacdabcbd476e1f91d998548798bb89eb9c4ad
4
+ data.tar.gz: 0c5e2a9e7dc48d82345507e4517efbb1e4288f30
5
5
  SHA512:
6
- metadata.gz: 09953e2a0f95ea0da277f98ee89948b740e0b40c286cb1585128a91848a47662d30e97da9eb1ca4e34d646b58905d9f2f8ae4ba0889b9d2a34e1183854e07f3e
7
- data.tar.gz: e8afa094deb406029e902b414e852212c9f384d6e015a122baee7ae4fe31ebb3b38a29288aa440919cb763ff54e0a57475edd0a85a1101f06e02a3d15abcd89e
6
+ metadata.gz: 019db9f1123839223530f8d344d11970b0adf971cf22b1eae5a244a4793f845e05cdf18e5b008caf38c7f39ef16037d57d4568d29b675f5b1bd6d8e9d7e660af
7
+ data.tar.gz: 76dbb0c9467656cd9d67f035bfaf69d7d3e064f24e703e159a5a8ea6ae078097c483b10164ee52cf803d629cb77a00256ab10c1d695bf37a6f0ea138dbbc14b1
@@ -264,7 +264,10 @@ module Bosh::Director
264
264
  jobs_json = json_decode(request.body)['jobs']
265
265
  payload = convert_job_instance_hash(jobs_json)
266
266
 
267
- start_task { @problem_manager.scan_and_fix(current_user, params[:deployment], payload) }
267
+ deployment = @deployment_manager.find_by_name(params[:deployment])
268
+ if deployment_has_instance_to_resurrect?(deployment)
269
+ start_task { @problem_manager.scan_and_fix(current_user, params[:deployment], payload) }
270
+ end
268
271
  end
269
272
 
270
273
  post '/', :consumes => :yaml do
@@ -321,6 +324,16 @@ module Bosh::Director
321
324
  jobs + indicies.map { |index| [job, index] }
322
325
  end
323
326
  end
327
+
328
+ def deployment_has_instance_to_resurrect?(deployment)
329
+ false if deployment.nil?
330
+ filter = {
331
+ deployment_id: deployment.id,
332
+ resurrection_paused: false
333
+ }
334
+ instances = @instance_manager.filter_by(filter)
335
+ instances.any?
336
+ end
324
337
  end
325
338
  end
326
339
  end
@@ -6,7 +6,8 @@ module Bosh::Director
6
6
  post '/', :consumes => :json do
7
7
  payload = json_decode(request.body)
8
8
  options = {
9
- rebase: params['rebase'] == 'true',
9
+ rebase: params['rebase'] == 'true',
10
+ sha1: params['sha1']
10
11
  }
11
12
  task = @release_manager.create_release_from_url(current_user, payload['location'], options)
12
13
  redirect "/tasks/#{task.id}"
@@ -7,6 +7,7 @@ module Bosh::Director
7
7
  payload = json_decode(request.body)
8
8
  options = {
9
9
  fix: params['fix'] == 'true',
10
+ sha1: payload['sha1']
10
11
  }
11
12
  task = @stemcell_manager.create_stemcell_from_url(current_user, payload['location'], options)
12
13
  redirect "/tasks/#{task.id}"
@@ -15,6 +16,7 @@ module Bosh::Director
15
16
  post '/', :consumes => :multipart do
16
17
  options = {
17
18
  fix: params['fix'] == 'true',
19
+ sha1: params['sha1']
18
20
  }
19
21
  task = @stemcell_manager.create_stemcell_from_file_path(current_user, params[:nginx_upload_path], options)
20
22
  redirect "/tasks/#{task.id}"
@@ -77,6 +77,7 @@ module Bosh::Director
77
77
  ReleaseInvalidPackage = err(30012)
78
78
  ReleaseExistingJobFingerprintMismatch = err(30013)
79
79
  ReleaseVersionCommitHashMismatch = err(30014)
80
+ ReleaseSha1DoesNotMatch = err(30015)
80
81
 
81
82
  ValidationInvalidType = err(40000)
82
83
  ValidationMissingField = err(40001)
@@ -88,6 +89,7 @@ module Bosh::Director
88
89
  StemcellAlreadyExists = err(50002)
89
90
  StemcellNotFound = err(50003, NOT_FOUND)
90
91
  StemcellInUse = err(50004)
92
+ StemcellSha1DoesNotMatch = err(50005)
91
93
 
92
94
  PackageInvalidArchive = err(60000)
93
95
  PackageMissingSourceCode = err(60001)
@@ -124,17 +124,6 @@ module Bosh::Director
124
124
 
125
125
  def start!
126
126
  agent.start
127
- rescue RuntimeError => e
128
- # FIXME: this is somewhat ghetto: we don't have a good way to
129
- # negotiate on BOSH protocol between director and agent (yet),
130
- # so updating from agent version that doesn't support 'start' RPC
131
- # to the one that does might be hard. Right now we decided to
132
- # just swallow the exception.
133
- # This needs to be removed in one of the following cases:
134
- # 1. BOSH protocol handshake gets implemented
135
- # 2. All agents updated to support 'start' RPC
136
- # and we no longer care about backward compatibility.
137
- @logger.warn("Agent start raised an exception: #{e.inspect}, ignoring for compatibility")
138
127
  end
139
128
 
140
129
  def need_start?
@@ -11,6 +11,7 @@ module Bosh::Director
11
11
  @compiled_release = false
12
12
 
13
13
  attr_accessor :release_model
14
+ attr_reader :release_path, :release_url, :sha1
14
15
 
15
16
  def self.job_type
16
17
  :update_release
@@ -23,6 +24,7 @@ module Bosh::Director
23
24
  # file will be downloaded to the release_path
24
25
  @release_path = File.join(Dir.tmpdir, "release-#{SecureRandom.uuid}")
25
26
  @release_url = release_path
27
+ @sha1 = options['sha1']
26
28
  else
27
29
  # file already exists at the release_path
28
30
  @release_path = release_path
@@ -39,7 +41,9 @@ module Bosh::Director
39
41
  logger.info("Processing update release")
40
42
  logger.info("Release rebase will be performed") if @rebase
41
43
 
42
- single_step_stage("Downloading remote release") { download_remote_release } if @release_url
44
+ single_step_stage("Downloading remote release") { download_remote_release } if release_url
45
+
46
+ single_step_stage("Verifying remote release") { verify_sha1 } if sha1
43
47
 
44
48
  release_dir = nil
45
49
  single_step_stage("Extracting release") { release_dir = extract_release }
@@ -55,11 +59,11 @@ module Bosh::Director
55
59
 
56
60
  ensure
57
61
  FileUtils.rm_rf(release_dir) if release_dir
58
- FileUtils.rm_rf(@release_path) if @release_path
62
+ FileUtils.rm_rf(release_path) if release_path
59
63
  end
60
64
 
61
65
  def download_remote_release
62
- download_remote_file('release', @release_url, @release_path)
66
+ download_remote_file('release', release_url, release_path)
63
67
  end
64
68
 
65
69
  # Extracts release tarball
@@ -67,9 +71,9 @@ module Bosh::Director
67
71
  def extract_release
68
72
  release_dir = Dir.mktmpdir
69
73
 
70
- result = Bosh::Exec.sh("tar -C #{release_dir} -xzf #{@release_path} 2>&1", :on_error => :return)
74
+ result = Bosh::Exec.sh("tar -C #{release_dir} -xzf #{release_path} 2>&1", :on_error => :return)
71
75
  if result.failed?
72
- logger.error("Failed to extract release archive '#{@release_path}' into dir '#{release_dir}', tar returned #{result.exit_status}, output: #{result.output})")
76
+ logger.error("Failed to extract release archive '#{release_path}' into dir '#{release_dir}', tar returned #{result.exit_status}, output: #{result.output})")
73
77
  FileUtils.rm_rf(release_dir)
74
78
  raise ReleaseInvalidArchive, "Extracting release archive failed. Check task debug log for details."
75
79
  end
@@ -104,6 +108,13 @@ module Bosh::Director
104
108
  @uncommitted_changes = @manifest.fetch("uncommitted_changes", nil)
105
109
  end
106
110
 
111
+ def verify_sha1
112
+ release_hash = Digest::SHA1.file(release_path).hexdigest
113
+ if release_hash != sha1
114
+ raise ReleaseSha1DoesNotMatch, "Release SHA1 `#{release_hash}' does not match the expected SHA1 `#{sha1}'"
115
+ end
116
+ end
117
+
107
118
  def compiled_release
108
119
  raise "Don't know what kind of release we have until verify_release is called" unless @manifest
109
120
  @compiled_release
@@ -26,6 +26,10 @@ module Bosh::Director
26
26
  @stemcell_path = stemcell_path
27
27
  end
28
28
 
29
+ if options['sha1']
30
+ @stemcell_sha1 = options['sha1']
31
+ end
32
+
29
33
  @cloud = Config.cloud
30
34
  @stemcell_manager = Api::StemcellManager.new
31
35
  @fix = options['fix']
@@ -40,6 +44,8 @@ module Bosh::Director
40
44
 
41
45
  stemcell_dir = Dir.mktmpdir("stemcell")
42
46
 
47
+ track_and_log("Verifying remote stemcell") { verify_sha1 } if @stemcell_sha1
48
+
43
49
  track_and_log("Extracting stemcell archive") do
44
50
  result = Bosh::Exec.sh("tar -C #{stemcell_dir} -xzf #{@stemcell_path} 2>&1", :on_error => :return)
45
51
  if result.failed?
@@ -101,6 +107,13 @@ module Bosh::Director
101
107
 
102
108
  private
103
109
 
110
+ def verify_sha1
111
+ stemcell_hash = Digest::SHA1.file(@stemcell_path).hexdigest
112
+ if stemcell_hash != @stemcell_sha1
113
+ raise StemcellSha1DoesNotMatch, "Stemcell SHA1 `#{stemcell_hash}' does not match the expected SHA1 `#{@stemcell_sha1}'"
114
+ end
115
+ end
116
+
104
117
  def download_remote_stemcell
105
118
  download_remote_file('stemcell', @stemcell_url, @stemcell_path)
106
119
  end
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Director
3
- VERSION = '1.3115.0'
3
+ VERSION = '1.3120.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh-director
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3115.0
4
+ version: 1.3120.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - VMware
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-23 00:00:00.000000000 Z
11
+ date: 2015-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bosh_common
@@ -16,98 +16,98 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.3115.0
19
+ version: 1.3120.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.3115.0
26
+ version: 1.3120.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bosh_cpi
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.3115.0
33
+ version: 1.3120.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.3115.0
40
+ version: 1.3120.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bosh-registry
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.3115.0
47
+ version: 1.3120.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.3115.0
54
+ version: 1.3120.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: blobstore_client
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.3115.0
61
+ version: 1.3120.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.3115.0
68
+ version: 1.3120.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bosh-core
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.3115.0
75
+ version: 1.3120.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.3115.0
82
+ version: 1.3120.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: bosh-director-core
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 1.3115.0
89
+ version: 1.3120.0
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 1.3115.0
96
+ version: 1.3120.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: bosh-template
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 1.3115.0
103
+ version: 1.3120.0
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 1.3115.0
110
+ version: 1.3120.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: bosh_openstack_cpi
113
113
  requirement: !ruby/object:Gem::Requirement