bosh-director 1.3112.0 → 1.3115.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: b04d4dfc4ecd3f8ea16a604286d10d6fd3fceb3e
4
- data.tar.gz: 1f14af1610053a8d44b84849629368503e092a13
3
+ metadata.gz: 55328ec9d042beefb1bf840777ea01ef3e2f22ed
4
+ data.tar.gz: d2af38792bd179f949e3cf79c9dab94ef12de2e6
5
5
  SHA512:
6
- metadata.gz: 330916a2acaac730ba63b36c10fefeae40ca48c2d5254ce2050c2c9bd1b118c901c076a999f48ec9d9d5d5c24425a84cce413ad706b1e8dcb474110f19b5260f
7
- data.tar.gz: 132b5cdf46faba85d1462093b9f8abebb8813ff62835c7da8cea8836bae724a99ecbd7c0026aec24bec42b3a0df075383e4b3759a3743fa728e8fd2e322b2823
6
+ metadata.gz: 09953e2a0f95ea0da277f98ee89948b740e0b40c286cb1585128a91848a47662d30e97da9eb1ca4e34d646b58905d9f2f8ae4ba0889b9d2a34e1183854e07f3e
7
+ data.tar.gz: e8afa094deb406029e902b414e852212c9f384d6e015a122baee7ae4fe31ebb3b38a29288aa440919cb763ff54e0a57475edd0a85a1101f06e02a3d15abcd89e
@@ -29,15 +29,61 @@ module Bosh::Director
29
29
  end
30
30
 
31
31
  fingerprint_list = []
32
-
33
32
  manifest['compiled_packages'].each do |package|
34
33
  fingerprint_list << package['fingerprint'] if package['fingerprint']
35
34
  end
36
35
 
37
- matching_packages = Models::Package.join(Models::CompiledPackage, :package_id=>:id).where(fingerprint: fingerprint_list).all
36
+ matching_packages = Models::Package.join(Models::CompiledPackage, :package_id=>:id)
37
+ .select(:packages__name, :packages__fingerprint, :compiled_packages__dependency_key, :stemcells__operating_system, :stemcells__version)
38
+ .join(Models::Stemcell, :id=>:stemcell_id)
39
+ .where(fingerprint: fingerprint_list).all
40
+
41
+ matching_packages = filter_matching_packages(matching_packages, manifest)
38
42
 
39
43
  json_encode(matching_packages.map(&:fingerprint).compact.uniq)
40
44
  end
45
+
46
+ # dependencies & stemcell should also match
47
+ def filter_matching_packages(matching_packages, manifest)
48
+ filtered_packages = []
49
+
50
+ matching_packages.each do |package|
51
+ stemcell_match = "#{package[:operating_system]}/#{package[:version]}" == compiled_package_meta(package.name, manifest)['stemcell']
52
+ dependencies_match = package[:dependency_key] == dependency_key(package, manifest)
53
+
54
+ if stemcell_match && dependencies_match
55
+ filtered_packages << package
56
+ end
57
+ end
58
+
59
+ filtered_packages
60
+ end
61
+
62
+ def dependency_key(package, manifest)
63
+ compiled_package_meta = compiled_package_meta(package.name, manifest)
64
+ dependencies = transitive_dependencies(compiled_package_meta, manifest)
65
+
66
+ key = dependencies.to_a.sort_by {|k| k["name"]}.map { |p| [p['name'], p['version']]}
67
+ Yajl::Encoder.encode(key)
68
+ end
69
+
70
+ def transitive_dependencies(compiled_package_meta, manifest)
71
+ dependencies = Set.new
72
+ return dependencies if compiled_package_meta['dependencies'].nil?
73
+
74
+ compiled_package_meta['dependencies'].each do |dependency_package_name|
75
+ dependency_compiled_package_meta = compiled_package_meta(dependency_package_name, manifest)
76
+ dependencies << dependency_compiled_package_meta
77
+ dependencies.merge(transitive_dependencies(dependency_compiled_package_meta, manifest))
78
+ end
79
+
80
+ dependencies
81
+ end
82
+
83
+ def compiled_package_meta(package_name, manifest)
84
+ manifest['compiled_packages'].select { |p| p['name'] == package_name}[0]
85
+ end
86
+
41
87
  end
42
88
  end
43
89
  end
@@ -34,6 +34,7 @@ module Bosh::Director
34
34
  :enable_snapshots,
35
35
  :max_vm_create_tries,
36
36
  :nats_uri,
37
+ :default_ssh_options
37
38
  )
38
39
 
39
40
  attr_reader(
@@ -121,6 +122,8 @@ module Bosh::Director
121
122
  @process_uuid = SecureRandom.uuid
122
123
  @nats_uri = config['mbus']
123
124
 
125
+ @default_ssh_options = config['default_ssh_options']
126
+
124
127
  @cloud_options = config['cloud']
125
128
  @compiled_package_cache_options = config['compiled_package_cache']
126
129
  @name = config['name'] || ''
@@ -45,6 +45,11 @@ module Bosh::Director
45
45
  result = agent.ssh(@command, @params)
46
46
  result["index"] = instance.index
47
47
 
48
+ if Config.default_ssh_options
49
+ result["gateway_host"] = Config.default_ssh_options["gateway_host"]
50
+ result["gateway_user"] = Config.default_ssh_options["gateway_user"]
51
+ end
52
+
48
53
  result
49
54
  end
50
55
 
@@ -192,6 +192,7 @@ module Bosh::Director
192
192
  new_packages = []
193
193
  existing_packages = []
194
194
  registered_packages = []
195
+ packages_existing_from_other_releases = []
195
196
 
196
197
  @manifest[@packages_folder].each do |package_meta|
197
198
  # Checking whether we might have the same bits somewhere (in any release, not just the one being uploaded)
@@ -242,7 +243,6 @@ module Bosh::Director
242
243
  # We found a package with the same fingerprint but different
243
244
  # (release, name, version) tuple, so we need to make a copy
244
245
  # of the package blob and create a new db entry for it
245
-
246
246
  packages.each do |package|
247
247
  unless package.blobstore_id.nil?
248
248
  package_meta["blobstore_id"] = package.blobstore_id
@@ -251,6 +251,7 @@ module Bosh::Director
251
251
  end
252
252
  end
253
253
  new_packages << package_meta
254
+ packages_existing_from_other_releases << package_meta
254
255
  end
255
256
  end
256
257
 
@@ -268,7 +269,7 @@ module Bosh::Director
268
269
  end
269
270
  end
270
271
  consolidated_package_stemcell_hashes = Array(package_stemcell_hashes1) | Array(package_stemcell_hashes2) | compatible_stemcell_combos
271
- create_compiled_packages(consolidated_package_stemcell_hashes, release_dir)
272
+ create_compiled_packages(consolidated_package_stemcell_hashes, release_dir, packages_existing_from_other_releases)
272
273
  else
273
274
  backfill_source_for_packages(registered_packages, release_dir)
274
275
  end
@@ -361,31 +362,45 @@ module Bosh::Director
361
362
  end
362
363
 
363
364
  # @return [boolean] true if at least one job was created; false if the call had no effect.
364
- def create_compiled_packages(all_compiled_packages, release_dir)
365
+ def create_compiled_packages(all_compiled_packages, release_dir, packages_existing_from_other_releases)
365
366
  return false if all_compiled_packages.nil?
366
367
 
367
368
  event_log.begin_stage('Creating new compiled packages', all_compiled_packages.size)
368
-
369
369
  had_effect = false
370
+
370
371
  all_compiled_packages.each do |compiled_package_spec|
371
372
  package = compiled_package_spec[:package]
372
373
  stemcell = compiled_package_spec[:stemcell]
373
374
 
374
- existing_compiled_package = Models::CompiledPackage.where(
375
- :package_id => package.id,
376
- :stemcell_id => stemcell.id)
377
-
375
+ existing_compiled_package = Models::CompiledPackage.where(:package_id => package.id, :stemcell_id => stemcell.id)
378
376
  if existing_compiled_package.empty?
377
+
379
378
  package_desc = "#{package.name}/#{package.version} for #{stemcell.name}/#{stemcell.version}"
380
379
  event_log.track(package_desc) do
381
- create_compiled_package(package, stemcell, release_dir)
380
+ other_compiled_package = get_other_compiled_package(package, packages_existing_from_other_releases, stemcell)
381
+ create_compiled_package(package, stemcell, release_dir, other_compiled_package)
382
382
  had_effect = true
383
383
  end
384
384
  end
385
385
  end
386
+
386
387
  had_effect
387
388
  end
388
389
 
390
+ def get_other_compiled_package(package, packages_existing_from_other_releases, stemcell)
391
+ other_compiled_package = nil
392
+ packages_existing_from_other_releases.each do |other_package_meta|
393
+ if other_package_meta["fingerprint"] == package.fingerprint
394
+ packages = Models::Package.where(fingerprint: other_package_meta["fingerprint"]).all
395
+ packages.each do |pkg|
396
+ other_compiled_package = Models::CompiledPackage.where(:package_id => pkg.id, :stemcell_id => stemcell.id).first
397
+ break unless other_compiled_package.nil?
398
+ end
399
+ end
400
+ end
401
+ other_compiled_package
402
+ end
403
+
389
404
  def stemcells_used_by_package(package_meta)
390
405
  if package_meta['stemcell'].nil?
391
406
  raise 'stemcell informatiom(operating system/version) should be listed for each package of a compiled tarball'
@@ -406,14 +421,21 @@ module Bosh::Director
406
421
  stemcells
407
422
  end
408
423
 
409
- def create_compiled_package(package, stemcell, release_dir)
410
- tgz = File.join(release_dir, 'compiled_packages', "#{package.name}.tgz")
411
- validate_tgz(tgz, "#{package.name}.tgz")
424
+ def create_compiled_package(package, stemcell, release_dir, other_compiled_package)
425
+ if other_compiled_package.nil?
426
+ tgz = File.join(release_dir, 'compiled_packages', "#{package.name}.tgz")
427
+ validate_tgz(tgz, "#{package.name}.tgz")
412
428
 
413
- compiled_package = Models::CompiledPackage.new
429
+ blobstore_id = BlobUtil.create_blob(tgz)
430
+ sha1 = Digest::SHA1.file(tgz).hexdigest
431
+ else
432
+ blobstore_id = BlobUtil.copy_blob(other_compiled_package.blobstore_id)
433
+ sha1 = other_compiled_package.sha1
434
+ end
414
435
 
415
- compiled_package.blobstore_id = BlobUtil.create_blob(tgz)
416
- compiled_package.sha1 = Digest::SHA1.file(tgz).hexdigest
436
+ compiled_package = Models::CompiledPackage.new
437
+ compiled_package.blobstore_id = blobstore_id
438
+ compiled_package.sha1 = sha1
417
439
 
418
440
  transitive_dependencies = @release_version_model.transitive_dependencies(package)
419
441
  compiled_package.dependency_key = Models::CompiledPackage.create_dependency_key(transitive_dependencies)
@@ -45,6 +45,8 @@ module Bosh::Director
45
45
  @resolved_count
46
46
  end
47
47
 
48
+ private
49
+
48
50
  def apply_resolution(problem)
49
51
  handler = ProblemHandlers::Base.create_from_model(problem)
50
52
  handler.job = self
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Director
3
- VERSION = '1.3112.0'
3
+ VERSION = '1.3115.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.3112.0
4
+ version: 1.3115.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-21 00:00:00.000000000 Z
11
+ date: 2015-10-23 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.3112.0
19
+ version: 1.3115.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.3112.0
26
+ version: 1.3115.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.3112.0
33
+ version: 1.3115.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.3112.0
40
+ version: 1.3115.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.3112.0
47
+ version: 1.3115.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.3112.0
54
+ version: 1.3115.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.3112.0
61
+ version: 1.3115.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.3112.0
68
+ version: 1.3115.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.3112.0
75
+ version: 1.3115.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.3112.0
82
+ version: 1.3115.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.3112.0
89
+ version: 1.3115.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.3112.0
96
+ version: 1.3115.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.3112.0
103
+ version: 1.3115.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.3112.0
110
+ version: 1.3115.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: bosh_openstack_cpi
113
113
  requirement: !ruby/object:Gem::Requirement