bosh-director 1.5.0.pre.1168 → 1.5.0.pre.1172
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/bosh/director/compile_task.rb +5 -27
- data/lib/bosh/director/deployment_plan.rb +1 -3
- data/lib/bosh/director/deployment_plan/job.rb +1 -1
- data/lib/bosh/director/deployment_plan/planner.rb +3 -3
- data/lib/bosh/director/deployment_plan/{release.rb → release_version.rb} +9 -16
- data/lib/bosh/director/deployment_plan/template.rb +1 -1
- data/lib/bosh/director/jobs/delete_release.rb +1 -1
- data/lib/bosh/director/models/release_version.rb +32 -2
- data/lib/bosh/director/package_compiler.rb +7 -4
- data/lib/bosh/director/version.rb +1 -1
- metadata +17 -17
@@ -1,5 +1,3 @@
|
|
1
|
-
# Copyright (c) 2009-2012 VMware, Inc.
|
2
|
-
|
3
1
|
module Bosh::Director
|
4
2
|
class CompileTask
|
5
3
|
# @return [Models::Package] What package is being compiled
|
@@ -27,23 +25,18 @@ module Bosh::Director
|
|
27
25
|
# @return [String] A unique checksum based on the dependencies in this task
|
28
26
|
attr_reader :cache_key
|
29
27
|
|
30
|
-
|
31
|
-
|
32
|
-
# @param [Models::Stemcell] stemcell What stemcell package is compiled for
|
33
|
-
# @param [Array<Models::Package>] dependent_packages Package models that this task depends on
|
34
|
-
# @param [DeploymentPlan::Job] initial_job The first job that this task is associate with
|
35
|
-
def initialize(package, stemcell, dependent_packages, initial_job = nil)
|
28
|
+
|
29
|
+
def initialize(package, stemcell, initial_job, dependency_key, cache_key)
|
36
30
|
@package = package
|
37
31
|
@stemcell = stemcell
|
38
32
|
|
39
33
|
@jobs = []
|
40
|
-
add_job(initial_job)
|
34
|
+
add_job(initial_job)
|
41
35
|
@dependencies = []
|
42
36
|
@dependent_tasks = []
|
43
37
|
|
44
|
-
@dependency_key =
|
45
|
-
|
46
|
-
@cache_key = generate_cache_key(dependent_packages)
|
38
|
+
@dependency_key = dependency_key
|
39
|
+
@cache_key = cache_key
|
47
40
|
end
|
48
41
|
|
49
42
|
# @return [Boolean] Whether this task is ready to be compiled
|
@@ -172,20 +165,5 @@ module Bosh::Director
|
|
172
165
|
|
173
166
|
compiled_package
|
174
167
|
end
|
175
|
-
|
176
|
-
private
|
177
|
-
def generate_dependency_key(packages)
|
178
|
-
key = packages.sort { |a, b|
|
179
|
-
a.name <=> b.name
|
180
|
-
}.map { |p| [p.name, p.version]}
|
181
|
-
|
182
|
-
Yajl::Encoder.encode(key)
|
183
|
-
end
|
184
|
-
|
185
|
-
def generate_cache_key(dependent_packages)
|
186
|
-
dependency_fingerprints = dependent_packages.sort_by(&:name).map {|p| p.fingerprint }
|
187
|
-
hash_input = ([package.fingerprint, stemcell.sha1]+dependency_fingerprints).join("")
|
188
|
-
Digest::SHA1.hexdigest(hash_input)
|
189
|
-
end
|
190
168
|
end
|
191
169
|
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
# Copyright (c) 2009-2012 VMware, Inc.
|
2
|
-
|
3
1
|
module Bosh::Director
|
4
2
|
module DeploymentPlan
|
5
3
|
end
|
@@ -15,7 +13,7 @@ require 'bosh/director/deployment_plan/compiled_package'
|
|
15
13
|
require 'bosh/director/deployment_plan/preparer'
|
16
14
|
require 'bosh/director/deployment_plan/resource_pools'
|
17
15
|
require 'bosh/director/deployment_plan/updater'
|
18
|
-
require 'bosh/director/deployment_plan/
|
16
|
+
require 'bosh/director/deployment_plan/release_version'
|
19
17
|
require 'bosh/director/deployment_plan/resource_pool'
|
20
18
|
require 'bosh/director/deployment_plan/stemcell'
|
21
19
|
require 'bosh/director/deployment_plan/template'
|
@@ -30,7 +30,7 @@ module Bosh::Director
|
|
30
30
|
# @return [DeploymentPlan] Current deployment plan
|
31
31
|
attr_accessor :deployment
|
32
32
|
|
33
|
-
# @return [DeploymentPlan::
|
33
|
+
# @return [DeploymentPlan::ReleaseVersion] Release this job belongs to
|
34
34
|
attr_accessor :release
|
35
35
|
|
36
36
|
# @return [DeploymentPlan::ResourcePool] Resource pool this job should
|
@@ -122,13 +122,13 @@ module Bosh::Director
|
|
122
122
|
end
|
123
123
|
|
124
124
|
# Returns all releases in a deployment plan
|
125
|
-
# @return [Array<Bosh::Director::DeploymentPlan::
|
125
|
+
# @return [Array<Bosh::Director::DeploymentPlan::ReleaseVersion>]
|
126
126
|
def releases
|
127
127
|
@releases.values
|
128
128
|
end
|
129
129
|
|
130
130
|
# Returns a named release
|
131
|
-
# @return [Bosh::Director::DeploymentPlan::
|
131
|
+
# @return [Bosh::Director::DeploymentPlan::ReleaseVersion]
|
132
132
|
def release(name)
|
133
133
|
@releases[name]
|
134
134
|
end
|
@@ -182,7 +182,7 @@ module Bosh::Director
|
|
182
182
|
|
183
183
|
@releases = {}
|
184
184
|
release_specs.each do |release_spec|
|
185
|
-
release =
|
185
|
+
release = ReleaseVersion.new(self, release_spec)
|
186
186
|
if @releases.has_key?(release.name)
|
187
187
|
raise DeploymentDuplicateReleaseName,
|
188
188
|
"Duplicate release name `#{release.name}'"
|
@@ -1,8 +1,6 @@
|
|
1
|
-
# Copyright (c) 2009-2012 VMware, Inc.
|
2
|
-
|
3
1
|
module Bosh::Director
|
4
2
|
module DeploymentPlan
|
5
|
-
class
|
3
|
+
class ReleaseVersion
|
6
4
|
include ValidationHelper
|
7
5
|
|
8
6
|
# @return [String] Release name
|
@@ -18,8 +16,8 @@ module Bosh::Director
|
|
18
16
|
def initialize(deployment_plan, spec)
|
19
17
|
@deployment_plan = deployment_plan
|
20
18
|
|
21
|
-
@name = safe_property(spec,
|
22
|
-
@version = safe_property(spec,
|
19
|
+
@name = safe_property(spec, 'name', :class => String)
|
20
|
+
@version = safe_property(spec, 'version', :class => String)
|
23
21
|
|
24
22
|
@model = nil
|
25
23
|
@templates = {}
|
@@ -33,7 +31,7 @@ module Bosh::Director
|
|
33
31
|
def bind_model
|
34
32
|
deployment = @deployment_plan.model
|
35
33
|
if deployment.nil?
|
36
|
-
raise DirectorError,
|
34
|
+
raise DirectorError, 'Deployment not bound in the deployment plan'
|
37
35
|
end
|
38
36
|
|
39
37
|
release = @manager.find_by_name(@name)
|
@@ -51,10 +49,10 @@ module Bosh::Director
|
|
51
49
|
# release spec
|
52
50
|
# @return [void]
|
53
51
|
def bind_templates
|
54
|
-
#
|
52
|
+
# ReleaseVersion model needs to be known so we can look up its
|
55
53
|
# templates
|
56
54
|
if @model.nil?
|
57
|
-
raise DirectorError,
|
55
|
+
raise DirectorError, 'ReleaseVersion model not bound in release spec'
|
58
56
|
end
|
59
57
|
|
60
58
|
# By now job specs from the deployment manifest should
|
@@ -70,8 +68,8 @@ module Bosh::Director
|
|
70
68
|
# @return [Hash] Hash representation
|
71
69
|
def spec
|
72
70
|
{
|
73
|
-
|
74
|
-
|
71
|
+
'name' => @name,
|
72
|
+
'version' => @version
|
75
73
|
}
|
76
74
|
end
|
77
75
|
|
@@ -91,12 +89,7 @@ module Bosh::Director
|
|
91
89
|
# @param [String] name Package name
|
92
90
|
# @return [Models::Package]
|
93
91
|
def get_package_model_by_name(name)
|
94
|
-
@
|
95
|
-
hash[package.name] = package
|
96
|
-
hash
|
97
|
-
end
|
98
|
-
|
99
|
-
@all_packages[name]
|
92
|
+
@model.package_by_name(name)
|
100
93
|
end
|
101
94
|
|
102
95
|
# Adds template to a list of templates used by this release for the
|
@@ -10,7 +10,7 @@ module Bosh::Director
|
|
10
10
|
attr_reader :model
|
11
11
|
attr_reader :package_models
|
12
12
|
|
13
|
-
# @param [DeploymentPlan::
|
13
|
+
# @param [DeploymentPlan::ReleaseVersion] release Release version
|
14
14
|
# @param [String] name Template name
|
15
15
|
def initialize(release, name)
|
16
16
|
@release = release
|
@@ -173,7 +173,7 @@ module Bosh::Director
|
|
173
173
|
unless deployments.empty?
|
174
174
|
names = deployments.map{ |d| d.name }.join(", ")
|
175
175
|
raise ReleaseVersionInUse,
|
176
|
-
"
|
176
|
+
"ReleaseVersion `#{desc}' is still in use by: #{names}"
|
177
177
|
end
|
178
178
|
|
179
179
|
delete_release_version(release_version)
|
@@ -1,5 +1,3 @@
|
|
1
|
-
# Copyright (c) 2009-2012 VMware, Inc.
|
2
|
-
|
3
1
|
module Bosh::Director::Models
|
4
2
|
class ReleaseVersion < Sequel::Model(Bosh::Director::Config.db)
|
5
3
|
many_to_one :release
|
@@ -12,5 +10,37 @@ module Bosh::Director::Models
|
|
12
10
|
validates_unique [:release_id, :version]
|
13
11
|
validates_format VALID_ID, :version
|
14
12
|
end
|
13
|
+
|
14
|
+
def dependencies(package_name)
|
15
|
+
package_by_name(package_name).dependency_set.map do |package_name|
|
16
|
+
package_by_name(package_name)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def package_by_name(package_name)
|
21
|
+
packages_by_name.fetch(package_name)
|
22
|
+
end
|
23
|
+
|
24
|
+
def package_dependency_key(package_name)
|
25
|
+
key = dependencies(package_name).sort { |a, b|
|
26
|
+
a.name <=> b.name
|
27
|
+
}.map { |p| [p.name, p.version]}
|
28
|
+
|
29
|
+
Yajl::Encoder.encode(key)
|
30
|
+
end
|
31
|
+
|
32
|
+
def package_cache_key(package_name, stemcell)
|
33
|
+
dependency_fingerprints = dependencies(package_name).sort_by(&:name).map {|p| p.fingerprint }
|
34
|
+
hash_input = ([package_by_name(package_name).fingerprint, stemcell.sha1]+dependency_fingerprints).join("")
|
35
|
+
Digest::SHA1.hexdigest(hash_input)
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def packages_by_name
|
41
|
+
@packages_by_name ||= packages.inject({}) do |cache, package|
|
42
|
+
cache.merge(package.name => package)
|
43
|
+
end
|
44
|
+
end
|
15
45
|
end
|
16
46
|
end
|
@@ -211,11 +211,13 @@ module Bosh::Director
|
|
211
211
|
return task
|
212
212
|
end
|
213
213
|
|
214
|
-
|
215
|
-
job.release.get_package_model_by_name(name)
|
216
|
-
end
|
214
|
+
release_version = job.release.model
|
217
215
|
|
218
|
-
task = CompileTask.new(package,
|
216
|
+
task = CompileTask.new(package,
|
217
|
+
stemcell,
|
218
|
+
job,
|
219
|
+
release_version.package_dependency_key(package.name),
|
220
|
+
release_version.package_cache_key(package.name, stemcell))
|
219
221
|
|
220
222
|
compiled_package = task.find_compiled_package(@logger, @event_log)
|
221
223
|
if compiled_package
|
@@ -223,6 +225,7 @@ module Bosh::Director
|
|
223
225
|
end
|
224
226
|
|
225
227
|
@logger.info("Processing package `#{package.desc}' dependencies")
|
228
|
+
dependencies = release_version.dependencies(package.name)
|
226
229
|
dependencies.each do |dependency|
|
227
230
|
@logger.info("Package `#{package.desc}' depends on package `#{dependency.desc}'")
|
228
231
|
dependency_task = generate_compile_task(job, dependency, stemcell)
|
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.5.0.pre.
|
4
|
+
version: 1.5.0.pre.1172
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - ~>
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: 1.5.0.pre.
|
37
|
+
version: 1.5.0.pre.1172
|
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.5.0.pre.
|
45
|
+
version: 1.5.0.pre.1172
|
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.5.0.pre.
|
53
|
+
version: 1.5.0.pre.1172
|
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.5.0.pre.
|
61
|
+
version: 1.5.0.pre.1172
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: bosh_common
|
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.5.0.pre.
|
69
|
+
version: 1.5.0.pre.1172
|
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.5.0.pre.
|
77
|
+
version: 1.5.0.pre.1172
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
79
|
name: bosh_cpi
|
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.5.0.pre.
|
85
|
+
version: 1.5.0.pre.1172
|
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.5.0.pre.
|
93
|
+
version: 1.5.0.pre.1172
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
95
|
name: bosh_openstack_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.5.0.pre.
|
101
|
+
version: 1.5.0.pre.1172
|
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.5.0.pre.
|
109
|
+
version: 1.5.0.pre.1172
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
111
|
name: bosh_aws_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.5.0.pre.
|
117
|
+
version: 1.5.0.pre.1172
|
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.5.0.pre.
|
125
|
+
version: 1.5.0.pre.1172
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: bosh_vsphere_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.5.0.pre.
|
133
|
+
version: 1.5.0.pre.1172
|
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.5.0.pre.
|
141
|
+
version: 1.5.0.pre.1172
|
142
142
|
- !ruby/object:Gem::Dependency
|
143
143
|
name: eventmachine
|
144
144
|
requirement: !ruby/object:Gem::Requirement
|
@@ -445,7 +445,7 @@ dependencies:
|
|
445
445
|
version: '1.0'
|
446
446
|
description: ! 'BOSH Director
|
447
447
|
|
448
|
-
|
448
|
+
d74fd2'
|
449
449
|
email: support@cloudfoundry.com
|
450
450
|
executables:
|
451
451
|
- bosh-director
|
@@ -548,7 +548,7 @@ files:
|
|
548
548
|
- lib/bosh/director/deployment_plan/network_subnet.rb
|
549
549
|
- lib/bosh/director/deployment_plan/planner.rb
|
550
550
|
- lib/bosh/director/deployment_plan/preparer.rb
|
551
|
-
- lib/bosh/director/deployment_plan/
|
551
|
+
- lib/bosh/director/deployment_plan/release_version.rb
|
552
552
|
- lib/bosh/director/deployment_plan/resource_pool.rb
|
553
553
|
- lib/bosh/director/deployment_plan/resource_pools.rb
|
554
554
|
- lib/bosh/director/deployment_plan/stemcell.rb
|