bosh-director 1.3012.0 → 1.3016.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: b371e8ca5c84ecea103b391df527d1ec8ec9e9ca
4
- data.tar.gz: c02bda21dd172939f62495717175a6040590204e
3
+ metadata.gz: 13cd05082e949cce8da88e0ce3b104ab3b5db3cb
4
+ data.tar.gz: ad109214ab949c9b1da47ed09609436dcc902eaa
5
5
  SHA512:
6
- metadata.gz: afb5b93f7fb726d8d76bdcf59a1e7c3c937250dd4a4f6fd82b87b9ed01c418e2e74f10d5141b185e7b9bfca822f5cbb02795ca6934c041b7ca171e306babe4a9
7
- data.tar.gz: a3b6a77f739223d4d8d8f8372cfec09210c7923bb72923ae0c5d9d84b5041b05ab66abb4aa156be3f4e6ca21a1140086ea67112c346954bc5f9912f32031d26d
6
+ metadata.gz: 087eaba75dfd98fa0a496dc5b1d7acd10b4e55743ab056ac0e054013b74628cc749747bee4e6de73ece1d870bc507dfc3b2aa3f97e7331d7b548106c9a6c6732
7
+ data.tar.gz: def64e21c02dcc889608d462ce197a0ec746ea05657cc5379685dc82fe6a4bf14cfd21d9d65297b301db7f54f2838d9a297e32a76a3252be9a7e97a883dfde3b
@@ -66,11 +66,8 @@ module Bosh::Director
66
66
  def parse_jobs
67
67
  jobs = safe_property(@deployment_manifest, 'jobs', :class => Array, :default => [])
68
68
  jobs.each do |job_spec|
69
- state_overrides = @job_states[job_spec['name']]
70
- if state_overrides
71
- job_spec.recursive_merge!(state_overrides)
72
- end
73
-
69
+ state_overrides = @job_states.fetch(job_spec['name'], {})
70
+ job_spec = job_spec.recursive_merge(state_overrides)
74
71
  @deployment.add_job(Job.parse(@deployment, job_spec, @event_log, @logger))
75
72
  end
76
73
  end
@@ -177,13 +177,9 @@ module Bosh::Director
177
177
 
178
178
  def parse_properties
179
179
  # Manifest can contain global and per-job properties section
180
- job_properties = safe_property(@job_spec, "properties", :class => Hash, :optional => true)
180
+ job_properties = safe_property(@job_spec, "properties", :class => Hash, :optional => true, :default => {})
181
181
 
182
- @job.all_properties = Bosh::Common::DeepCopy.copy(@deployment.properties)
183
-
184
- if job_properties
185
- @job.all_properties.recursive_merge!(job_properties)
186
- end
182
+ @job.all_properties = @deployment.properties.recursive_merge(job_properties)
187
183
 
188
184
  mappings = safe_property(@job_spec, "property_mappings", :class => Hash, :default => {})
189
185
 
@@ -148,6 +148,10 @@ module Bosh::Director
148
148
  @jobs_name_index[name]
149
149
  end
150
150
 
151
+ def reset_jobs
152
+ @jobs = []
153
+ end
154
+
151
155
  def jobs_starting_on_deploy
152
156
  @jobs.select(&:starts_on_deploy?)
153
157
  end
@@ -1,6 +1,16 @@
1
1
  module Bosh
2
2
  module Director
3
3
  module DeploymentPlan
4
+ class TransientDeployment
5
+ def initialize(name, manifest, release_versions)
6
+ @name = name
7
+ @manifest = manifest
8
+ @release_versions = release_versions
9
+ @vms = []
10
+ end
11
+ attr_accessor :name, :manifest, :release_versions, :vms
12
+ end
13
+
4
14
  class PlannerFactory
5
15
  def self.create(event_log, logger)
6
16
  deployment_manifest_migrator = Bosh::Director::DeploymentPlan::ManifestMigrator.new
@@ -17,15 +17,14 @@ class Array
17
17
  end
18
18
 
19
19
  class Hash
20
- def recursive_merge!(other)
21
- self.merge!(other) do |_, old_value, new_value|
20
+ def recursive_merge(other)
21
+ self.merge(other) do |_, old_value, new_value|
22
22
  if old_value.class == Hash && new_value.class == Hash
23
- old_value.recursive_merge!(new_value)
23
+ old_value.recursive_merge(new_value)
24
24
  else
25
25
  new_value
26
26
  end
27
27
  end
28
- self
29
28
  end
30
29
 
31
30
  def to_openstruct
@@ -1,5 +1,6 @@
1
1
  require 'securerandom'
2
2
  require 'common/version/release_version'
3
+ require 'pp'
3
4
 
4
5
  module Bosh::Director
5
6
  module Jobs
@@ -8,6 +9,10 @@ module Bosh::Director
8
9
 
9
10
  @queue = :normal
10
11
 
12
+ @stemcell
13
+ @targeted_deployment
14
+ @release_version
15
+
11
16
  def self.job_type
12
17
  :export_release
13
18
  end
@@ -20,24 +25,92 @@ module Bosh::Director
20
25
  @stemcell_version = stemcell_version
21
26
  end
22
27
 
23
-
24
28
  # @return [void]
25
29
  def perform
26
30
  logger.info("Exporting release: #{@release_name}/#{@release_version} for #{@stemcell_os}/#{@stemcell_version}")
31
+ validate_and_prepare
32
+ lock_timeout = 15 * 60 # 15 minutes
27
33
 
28
- deployment_manager = Bosh::Director::Api::DeploymentManager.new()
29
- deployment_manager.find_by_name(@deployment_name)
34
+ with_deployment_lock(@deployment_name, :timeout => lock_timeout) do
35
+ with_release_lock(@release_name, :timeout => lock_timeout) do
36
+ with_stemcell_lock(@stemcell.name, @stemcell.version, :timeout => lock_timeout) do
37
+
38
+ planner = create_planner
39
+ package_compile_step = DeploymentPlan::Steps::PackageCompileStep.new(
40
+ planner,
41
+ Config.cloud, # CPI
42
+ Config.logger,
43
+ Config.event_log,
44
+ self
45
+ )
46
+ package_compile_step.perform
47
+ end
48
+ end
49
+ end
50
+ end
51
+
52
+ def validate_and_prepare
53
+ stemcell_manager = Bosh::Director::Api::StemcellManager.new
54
+ @stemcell = stemcell_manager.find_by_os_and_version(@stemcell_os, @stemcell_version)
55
+
56
+ logger.info "Will compile with stemcell: #{@stemcell.desc}"
57
+
58
+ deployment_manager = Bosh::Director::Api::DeploymentManager.new
59
+ @targeted_deployment = deployment_manager.find_by_name(@deployment_name)
30
60
 
31
61
  release_manager = Bosh::Director::Api::ReleaseManager.new
32
62
  release = release_manager.find_by_name(@release_name)
33
- release_manager.find_version(release, @release_version)
63
+ @release_version = release_manager.find_version(release, @release_version)
64
+ end
34
65
 
35
- stemcell_manager = Bosh::Director::Api::StemcellManager.new
36
- stemcell = stemcell_manager.find_by_os_and_version(@stemcell_os, @stemcell_version)
66
+ def create_planner
67
+ modified_deployment_manifest = Psych.load(@targeted_deployment.manifest)
68
+ cloud_config_model = @targeted_deployment.cloud_config
69
+ network_name = cloud_config_model.manifest['networks'][0]['name']
70
+
71
+ fake_resource_pool_manifest = {
72
+ "name" => "just_for_compiling",
73
+ "network" => network_name,
74
+ "stemcell" => { "name" => @stemcell.name, "version" => @stemcell.version }
75
+ }
76
+
77
+ planner_factory = DeploymentPlan::PlannerFactory.create(Config.event_log, Config.logger)
78
+ planner = planner_factory.planner_without_vm_binding(
79
+ modified_deployment_manifest,
80
+ cloud_config_model,
81
+ {}
82
+ )
83
+
84
+ resource_pool = DeploymentPlan::ResourcePool.new(planner, fake_resource_pool_manifest, Config.logger)
85
+ planner.add_resource_pool(resource_pool)
86
+ planner.reset_jobs
37
87
 
38
- logger.info "Will compile with stemcell: #{stemcell.desc}"
88
+ fake_job = create_fake_job(planner, fake_resource_pool_manifest, network_name)
89
+ planner.add_job(fake_job)
39
90
 
91
+ planner
40
92
  end
93
+
94
+ def create_fake_job(planner, fake_resource_pool_manifest, network_name)
95
+ fake_job_spec_for_compiling = {
96
+ "name" => "dummy-job-for-compilation",
97
+ "release" => @release_name,
98
+ "instances" => 1,
99
+ "resource_pool" => fake_resource_pool_manifest['name'],
100
+ "templates" => @release_version.templates.map do |template|
101
+ { "name" => template.name, "release" => @release_name }
102
+ end,
103
+ "networks" => [ "name" => network_name ],
104
+ }
105
+
106
+ fake_job = DeploymentPlan::Job.parse(planner, fake_job_spec_for_compiling, Config.event_log, Config.logger)
107
+ @release_version.packages.each { |package| fake_job.packages[package.name] = package }
108
+ fake_job.resource_pool.stemcell.bind_model
109
+ fake_job.release.bind_model
110
+ fake_job.templates.each { |template| template.bind_models }
111
+ fake_job
112
+ end
113
+
41
114
  end
42
115
  end
43
116
  end
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Director
3
- VERSION = '1.3012.0'
3
+ VERSION = '1.3016.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.3012.0
4
+ version: 1.3016.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-07-07 00:00:00.000000000 Z
11
+ date: 2015-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bcrypt-ruby
@@ -30,140 +30,140 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.3012.0
33
+ version: 1.3016.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.3012.0
40
+ version: 1.3016.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bosh-core
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.3012.0
47
+ version: 1.3016.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.3012.0
54
+ version: 1.3016.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bosh-director-core
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.3012.0
61
+ version: 1.3016.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.3012.0
68
+ version: 1.3016.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bosh_common
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.3012.0
75
+ version: 1.3016.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.3012.0
82
+ version: 1.3016.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: bosh-template
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 1.3012.0
89
+ version: 1.3016.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.3012.0
96
+ version: 1.3016.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: bosh_cpi
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 1.3012.0
103
+ version: 1.3016.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.3012.0
110
+ version: 1.3016.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: bosh_openstack_cpi
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 1.3012.0
117
+ version: 1.3016.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 1.3012.0
124
+ version: 1.3016.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: bosh_aws_cpi
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 1.3012.0
131
+ version: 1.3016.0
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 1.3012.0
138
+ version: 1.3016.0
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: bosh_vsphere_cpi
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 1.3012.0
145
+ version: 1.3016.0
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 1.3012.0
152
+ version: 1.3016.0
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: bosh_vcloud_cpi
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - '='
158
158
  - !ruby/object:Gem::Version
159
- version: 0.7.7
159
+ version: 0.7.10
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - '='
165
165
  - !ruby/object:Gem::Version
166
- version: 0.7.7
166
+ version: 0.7.10
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: eventmachine
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -572,7 +572,7 @@ dependencies:
572
572
  version: '0'
573
573
  description: |-
574
574
  BOSH Director
575
- 8d43aa
575
+ 10557b
576
576
  email: support@cloudfoundry.com
577
577
  executables:
578
578
  - bosh-director