bosh-director 1.1777.0 → 1.1782.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -291,6 +291,10 @@ module Bosh::Director
291
291
  @deployment_plan.releases.each do |release|
292
292
  release.bind_templates
293
293
  end
294
+
295
+ @deployment_plan.jobs.each do |job|
296
+ job.validate_package_names_do_not_collide!
297
+ end
294
298
  end
295
299
 
296
300
  # Binds properties for all templates in the deployment
@@ -203,6 +203,22 @@ module Bosh::Director
203
203
  @properties = filter_properties(@all_properties)
204
204
  end
205
205
 
206
+ def validate_package_names_do_not_collide!
207
+ releases_by_package_names = templates.reduce([]) { |memo, t|
208
+ memo + t.model.package_names.product([t.release])
209
+ }.reduce({}) { |memo, package_name_and_release_version|
210
+ package_name = package_name_and_release_version.first
211
+ release_version = package_name_and_release_version.last
212
+ memo[package_name] ||= Set.new
213
+ memo[package_name] << release_version
214
+ memo
215
+ }
216
+
217
+ if releases_by_package_names.values.detect { |x| x.size > 1 }
218
+ raise JobPackageCollision, 'Unable to deploy: package name collision in job definitions.'
219
+ end
220
+ end
221
+
206
222
  private
207
223
 
208
224
  # @param [Hash] collection All properties collection
@@ -50,25 +50,18 @@ module Bosh::Director
50
50
  if release_name.nil?
51
51
  if @deployment.releases.size == 1
52
52
  @job.release = @deployment.releases.first
53
- else
54
- raise JobMissingRelease,
55
- "Cannot tell what release job `#{@job.name}' supposed to use, please reference an existing release"
56
53
  end
57
54
  else
58
55
  @job.release = @deployment.release(release_name)
59
- end
60
56
 
61
- if @job.release.nil?
62
- raise JobUnknownRelease,
63
- "Job `#{@job.name}' references an unknown release `#{release_name}'"
57
+ if @job.release.nil?
58
+ raise JobUnknownRelease,
59
+ "Job `#{@job.name}' references an unknown release `#{release_name}'"
60
+ end
64
61
  end
65
62
  end
66
63
 
67
64
  def parse_template
68
- if @job.release.nil?
69
- raise DirectorError, "Cannot parse template before parsing release"
70
- end
71
-
72
65
  template_names = safe_property(@job_spec, "template", optional: true)
73
66
  if template_names
74
67
  if template_names.is_a?(String)
@@ -93,13 +86,20 @@ module Bosh::Director
93
86
  template_name = safe_property(template, 'name', class: String)
94
87
  release_name = safe_property(template, 'release', class: String, optional: true)
95
88
 
96
- release = release_name ? @deployment.release(release_name) : @job.release
97
- if release
98
- @job.templates << release.use_template_named(template_name)
89
+ release = nil
90
+ if release_name
91
+ release = @deployment.release(release_name)
92
+ unless release
93
+ raise JobUnknownRelease,
94
+ "Template `#{template_name}' (job `#{@job.name}') references an unknown release `#{release_name}'"
95
+ end
99
96
  else
100
- raise JobUnknownRelease,
101
- "Template `#{template_name}' (job `#{@job.name}') references an unknown release `#{release_name}'"
97
+ release = @job.release
98
+ unless release
99
+ raise JobMissingRelease, "Cannot tell what release template `#{template_name}' (job `#{@job.name}') is supposed to use, please explicitly specify one"
100
+ end
102
101
  end
102
+ @job.templates << release.use_template_named(template_name)
103
103
  end
104
104
  end
105
105
  end
@@ -109,11 +109,6 @@ module Bosh::Director
109
109
  raise JobInvalidTemplates,
110
110
  "Job `#{@job.name}' templates must not have repeating names."
111
111
  end
112
-
113
- if @job.templates.uniq(&:release).size > 1
114
- raise JobInvalidTemplates,
115
- "Job `#{@job.name}' templates must come from the same release."
116
- end
117
112
  end
118
113
 
119
114
  def parse_disk
@@ -105,6 +105,7 @@ module Bosh::Director
105
105
  JobInvalidPropertySpec = err(80008)
106
106
  JobInvalidPropertyMapping = err(80009)
107
107
  JobIncompatibleSpecs = err(80010)
108
+ JobPackageCollision = err(80011)
108
109
 
109
110
  ResourceError = err(100001)
110
111
  ResourceNotFound = err(100002, NOT_FOUND)
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Director
3
- VERSION = '1.1777.0'
3
+ VERSION = '1.1782.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.1777.0
4
+ version: 1.1782.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-01-15 00:00:00.000000000 Z
12
+ date: 2014-01-16 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.1777.0
37
+ version: 1.1782.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.1777.0
45
+ version: 1.1782.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.1777.0
53
+ version: 1.1782.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.1777.0
61
+ version: 1.1782.0
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.1777.0
69
+ version: 1.1782.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.1777.0
77
+ version: 1.1782.0
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.1777.0
85
+ version: 1.1782.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.1777.0
93
+ version: 1.1782.0
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.1777.0
101
+ version: 1.1782.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.1777.0
109
+ version: 1.1782.0
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.1777.0
117
+ version: 1.1782.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.1777.0
125
+ version: 1.1782.0
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.1777.0
133
+ version: 1.1782.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.1777.0
141
+ version: 1.1782.0
142
142
  - !ruby/object:Gem::Dependency
143
143
  name: eventmachine
144
144
  requirement: !ruby/object:Gem::Requirement
@@ -461,7 +461,7 @@ dependencies:
461
461
  version: '1.0'
462
462
  description: ! 'BOSH Director
463
463
 
464
- 0308a9'
464
+ 5aedfc'
465
465
  email: support@cloudfoundry.com
466
466
  executables:
467
467
  - bosh-director
@@ -713,7 +713,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
713
713
  version: '0'
714
714
  segments:
715
715
  - 0
716
- hash: -2902799239834298514
716
+ hash: 4571235917096416855
717
717
  requirements: []
718
718
  rubyforge_project:
719
719
  rubygems_version: 1.8.23