bosh-director 1.2905.0 → 1.2915.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: 6def001c4329ad3d02e5feeff37da1d51a97cec6
4
- data.tar.gz: 564d4bf3e1dfad1e1e0b4814a7a00dcfa48cfe28
3
+ metadata.gz: 2707ebb2544ad4d8baf7c9db6fc3d0898c9f34f5
4
+ data.tar.gz: 0693702bcac970f90a94bf9b5930f956bc14c339
5
5
  SHA512:
6
- metadata.gz: 964977ba089ecbc0a2f889da0cd577ae7fa38370f82a9f3edd44f2ba10e97ce234f77ba543d2df750cc799486c61355c6e3083343b3d68533097e8acadc9ed08
7
- data.tar.gz: 7b3eebd5a9f3da5fd6308a8b051f9a81860a5535de308b593f687d6d02a569db4b193a5c49c6a5f3740f6255250ccd614efba4d03f24dd493601389dedeee58a
6
+ metadata.gz: 037437f2a42d47c8ddc99623e48e952f649dab2dd2e114c9e57c999e73b67098d52bc2ee1f0bc0ae56598240b6eb3e01a29bc838e3ede330504c0e57f0258f55
7
+ data.tar.gz: 8f5d470c563313bc2e8808800d83dd2de013a3e7c9f29b68d9ddf34515c49566892b191183f6d079bc4d2ca2a825204b6b3f5c7a9b0b5e80e95f39dc7f6d0d02
@@ -0,0 +1,19 @@
1
+ Sequel.migration do
2
+ change do
3
+ adapter_scheme = self.adapter_scheme
4
+
5
+ create_table :cloud_configs do
6
+ primary_key :id
7
+
8
+ if [:mysql2, :mysql].include?(adapter_scheme)
9
+ longtext :properties
10
+ else
11
+ text :properties
12
+ end
13
+
14
+ Time :created_at, null: false
15
+
16
+ index :created_at
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,7 @@
1
+ Sequel.migration do
2
+ change do
3
+ alter_table(:deployments) do
4
+ add_foreign_key :cloud_config_id, :cloud_configs
5
+ end
6
+ end
7
+ end
data/lib/bosh/director.rb CHANGED
@@ -1,5 +1,3 @@
1
- # Copyright (c) 2009-2012 VMware, Inc.
2
-
3
1
  module Bosh
4
2
  module Director
5
3
  end
@@ -152,5 +150,6 @@ require 'bosh/director/api/controllers/tasks_controller'
152
150
  require 'bosh/director/api/controllers/task_controller'
153
151
  require 'bosh/director/api/controllers/users_controller'
154
152
  require 'bosh/director/api/controllers/compiled_packages_controller'
153
+ require 'bosh/director/api/controllers/cloud_configs_controller'
155
154
  require 'bosh/director/api/controllers/locks_controller'
156
155
  require 'bosh/director/api/route_configuration'
@@ -25,6 +25,7 @@ require 'bosh/director/api/user_manager'
25
25
  require 'bosh/director/api/vm_state_manager'
26
26
  require 'bosh/director/api/backup_manager'
27
27
  require 'bosh/director/api/resurrector_manager'
28
+ require 'bosh/director/api/cloud_config_manager'
28
29
 
29
30
  require 'bosh/director/api/instance_lookup'
30
31
  require 'bosh/director/api/deployment_lookup'
@@ -0,0 +1,22 @@
1
+ module Bosh
2
+ module Director
3
+ module Api
4
+ class CloudConfigManager
5
+ def update(cloud_config_yaml)
6
+ cloud_config = Bosh::Director::Models::CloudConfig.new(
7
+ properties: cloud_config_yaml
8
+ )
9
+ cloud_config.save
10
+ end
11
+
12
+ def list(limit)
13
+ Bosh::Director::Models::CloudConfig.order(Sequel.desc(:created_at)).limit(limit).to_a
14
+ end
15
+
16
+ def latest
17
+ list(1).first
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -14,8 +14,8 @@ module Bosh::Director
14
14
  @backup_manager = BackupManager.new
15
15
  @instance_manager = InstanceManager.new
16
16
  @resurrector_manager = ResurrectorManager.new
17
- @problem_manager = ProblemManager.new
18
- @property_manager = PropertyManager.new
17
+ @problem_manager = ProblemManager.new(@deployment_manager)
18
+ @property_manager = PropertyManager.new(@deployment_manager)
19
19
  @release_manager = ReleaseManager.new
20
20
  @snapshot_manager = SnapshotManager.new
21
21
  @stemcell_manager = StemcellManager.new
@@ -0,0 +1,40 @@
1
+ require 'bosh/director/api/controllers/base_controller'
2
+
3
+ module Bosh::Director
4
+ module Api::Controllers
5
+ class CloudConfigsController < BaseController
6
+ post '/', :consumes => :yaml do
7
+ properties = request.body.string
8
+ Bosh::Director::Api::CloudConfigManager.new.update(properties)
9
+
10
+ status(201)
11
+ end
12
+
13
+ get '/' do
14
+ if params['limit'].nil? || params['limit'].empty?
15
+ status(400)
16
+ body("limit is required")
17
+ return
18
+ end
19
+
20
+ begin
21
+ limit = Integer(params['limit'])
22
+ rescue ArgumentError
23
+ status(400)
24
+ body("limit is invalid: '#{params['limit']}' is not an integer")
25
+ return
26
+ end
27
+
28
+ cloud_configs = Bosh::Director::Api::CloudConfigManager.new.list(limit)
29
+ json_encode(
30
+ cloud_configs.map do |cloud_config|
31
+ {
32
+ "properties" => cloud_config.properties,
33
+ "created_at" => cloud_config.created_at,
34
+ }
35
+ end
36
+ )
37
+ end
38
+ end
39
+ end
40
+ end
@@ -43,7 +43,8 @@ module Bosh::Director
43
43
  # we get the deployment here even though it isn't used here, to make sure
44
44
  # the call returns a 404 if the deployment doesn't exist
45
45
  @deployment_manager.find_by_name(params[:deployment])
46
- task = @deployment_manager.create_deployment(@user, request.body, options)
46
+ latest_cloud_config = Bosh::Director::Api::CloudConfigManager.new.latest
47
+ task = @deployment_manager.create_deployment(@user, request.body, latest_cloud_config, options)
47
48
  redirect "/tasks/#{task.id}"
48
49
  end
49
50
 
@@ -67,7 +68,8 @@ module Bosh::Director
67
68
 
68
69
  deployment = @deployment_manager.find_by_name(params[:deployment])
69
70
  manifest = request.content_length.nil? ? StringIO.new(deployment.manifest) : request.body
70
- task = @deployment_manager.create_deployment(@user, manifest, options)
71
+ latest_cloud_config = Bosh::Director::Api::CloudConfigManager.new.latest
72
+ task = @deployment_manager.create_deployment(@user, manifest, latest_cloud_config, options)
71
73
  redirect "/tasks/#{task.id}"
72
74
  end
73
75
 
@@ -253,8 +255,9 @@ module Bosh::Director
253
255
  post '/', :consumes => :yaml do
254
256
  options = {}
255
257
  options['recreate'] = true if params['recreate'] == 'true'
258
+ latest_cloud_config = Bosh::Director::Api::CloudConfigManager.new.latest
256
259
 
257
- task = @deployment_manager.create_deployment(@user, request.body, options)
260
+ task = @deployment_manager.create_deployment(@user, request.body, latest_cloud_config, options)
258
261
  redirect "/tasks/#{task.id}"
259
262
  end
260
263
 
@@ -11,7 +11,7 @@ module Bosh::Director
11
11
  DeploymentLookup.new.by_name(name)
12
12
  end
13
13
 
14
- def create_deployment(username, deployment_manifest, options = {})
14
+ def create_deployment(username, deployment_manifest, cloud_config, options = {})
15
15
  random_name = "deployment-#{SecureRandom.uuid}"
16
16
  deployment_manifest_dir = Dir::tmpdir
17
17
  deployment_manifest_file = File.join(deployment_manifest_dir, random_name)
@@ -22,7 +22,8 @@ module Bosh::Director
22
22
 
23
23
  write_file(deployment_manifest_file, deployment_manifest)
24
24
 
25
- JobQueue.new.enqueue(username, Jobs::UpdateDeployment, 'create deployment', [deployment_manifest_file, options])
25
+ cloud_config_id = cloud_config.nil? ? nil : cloud_config.id
26
+ JobQueue.new.enqueue(username, Jobs::UpdateDeployment, 'create deployment', [deployment_manifest_file, cloud_config_id, options])
26
27
  end
27
28
 
28
29
  def delete_deployment(username, deployment, options = {})
@@ -2,7 +2,7 @@ module Bosh::Director
2
2
  module Api
3
3
  class ProblemManager
4
4
 
5
- def initialize(deployment_manager = DeploymentManager.new)
5
+ def initialize(deployment_manager)
6
6
  @deployment_manager = deployment_manager
7
7
  end
8
8
 
@@ -4,8 +4,8 @@ module Bosh::Director
4
4
  module Api
5
5
  class PropertyManager
6
6
 
7
- def initialize
8
- @deployment_manager = DeploymentManager.new
7
+ def initialize(deployment_manager)
8
+ @deployment_manager = deployment_manager
9
9
  end
10
10
 
11
11
  def create_property(deployment_name, property_name, value)
@@ -10,10 +10,15 @@ module Bosh
10
10
  def controllers
11
11
  director_app = Bosh::Director::App.new(@config)
12
12
  controllers = {}
13
- controllers['/info'] = Bosh::Director::Api::Controllers::InfoController.new(@config)
14
- controllers['/tasks'] = Bosh::Director::Api::Controllers::TasksController.new(@config)
15
13
  controllers['/backups'] = Bosh::Director::Api::Controllers::BackupsController.new(@config)
14
+ controllers['/cloud_configs'] = Bosh::Director::Api::Controllers::CloudConfigsController.new(@config)
15
+ controllers['/compiled_package_groups'] = Bosh::Director::Api::Controllers::CompiledPackagesController.new(
16
+ @config,
17
+ Bosh::Director::Api::CompiledPackageGroupManager.new
18
+ )
16
19
  controllers['/deployments'] = Bosh::Director::Api::Controllers::DeploymentsController.new(@config)
20
+ controllers['/info'] = Bosh::Director::Api::Controllers::InfoController.new(@config)
21
+ controllers['/locks'] = Bosh::Director::Api::Controllers::LocksController.new(@config)
17
22
  controllers['/packages'] = Bosh::Director::Api::Controllers::PackagesController.new(@config)
18
23
  controllers['/releases'] = Bosh::Director::Api::Controllers::ReleasesController.new(@config)
19
24
  controllers['/resources'] = Bosh::Director::Api::Controllers::ResourcesController.new(
@@ -23,12 +28,8 @@ module Bosh
23
28
  controllers['/resurrection'] = Bosh::Director::Api::Controllers::ResurrectionController.new(@config)
24
29
  controllers['/stemcells'] = Bosh::Director::Api::Controllers::StemcellsController.new(@config)
25
30
  controllers['/task'] = Bosh::Director::Api::Controllers::TaskController.new(@config)
31
+ controllers['/tasks'] = Bosh::Director::Api::Controllers::TasksController.new(@config)
26
32
  controllers['/users'] = Bosh::Director::Api::Controllers::UsersController.new(@config)
27
- controllers['/compiled_package_groups'] = Bosh::Director::Api::Controllers::CompiledPackagesController.new(
28
- @config,
29
- Bosh::Director::Api::CompiledPackageGroupManager.new
30
- )
31
- controllers['/locks'] = Bosh::Director::Api::Controllers::LocksController.new(@config)
32
33
  controllers
33
34
  end
34
35
  end
@@ -13,7 +13,7 @@ module Bosh::Director
13
13
 
14
14
  # @param [String] manifest_file Path to deployment manifest
15
15
  # @param [Hash] options Deployment options
16
- def initialize(manifest_file, options = {})
16
+ def initialize(manifest_file, cloud_config_id, options = {})
17
17
  @blobstore = App.instance.blobstores.blobstore
18
18
 
19
19
  logger.info('Reading deployment manifest')
@@ -21,6 +21,9 @@ module Bosh::Director
21
21
  @manifest = File.read(@manifest_file)
22
22
  logger.debug("Manifest:\n#{@manifest}")
23
23
 
24
+ @cloud_config = Bosh::Director::Models::CloudConfig.find(id: cloud_config_id)
25
+ logger.debug("Cloud Config:\n#{@cloud_config.inspect}")
26
+
24
27
  logger.info('Creating deployment plan')
25
28
  logger.info("Deployment plan options: #{options.pretty_inspect}")
26
29
 
@@ -99,6 +102,7 @@ module Bosh::Director
99
102
  end
100
103
 
101
104
  deployment.manifest = @manifest
105
+ deployment.cloud_config = @cloud_config
102
106
  deployment.save
103
107
  notifier.send_end_event
104
108
  logger.info('Finished updating deployment')
@@ -1,5 +1,3 @@
1
- # Copyright (c) 2009-2012 VMware, Inc.
2
-
3
1
  module Bosh::Director
4
2
 
5
3
  # Distributed lock backed by Redis.
@@ -1,10 +1,12 @@
1
1
  # Copyright (c) 2009-2012 VMware, Inc.
2
2
  #
3
3
 
4
+ require 'bosh/director/models/cloud_config'
4
5
  require 'bosh/director/models/compiled_package'
5
6
  require 'bosh/director/models/deployment'
6
7
  require 'bosh/director/models/deployment_problem'
7
8
  require 'bosh/director/models/deployment_property'
9
+ require 'bosh/director/models/director_attribute'
8
10
  require 'bosh/director/models/instance'
9
11
  require 'bosh/director/models/log_bundle'
10
12
  require 'bosh/director/models/package'
@@ -17,7 +19,6 @@ require 'bosh/director/models/template'
17
19
  require 'bosh/director/models/user'
18
20
  require 'bosh/director/models/vm'
19
21
  require 'bosh/director/models/persistent_disk'
20
- require 'bosh/director/models/director_attribute'
21
22
  require 'bosh/director/models/rendered_templates_archive'
22
23
 
23
24
  module Bosh::Director
@@ -0,0 +1,11 @@
1
+ module Bosh
2
+ module Director
3
+ module Models
4
+ class CloudConfig < Sequel::Model(Bosh::Director::Config.db)
5
+ def before_create
6
+ self.created_at ||= Time.now
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -9,6 +9,7 @@ module Bosh::Director::Models
9
9
  one_to_many :vms
10
10
  one_to_many :properties, :class => "Bosh::Director::Models::DeploymentProperty"
11
11
  one_to_many :problems, :class => "Bosh::Director::Models::DeploymentProblem"
12
+ many_to_one :cloud_config
12
13
 
13
14
  def validate
14
15
  validates_presence :name
@@ -5,6 +5,7 @@ module Bosh::Director
5
5
  class MissingVM < Base
6
6
 
7
7
  register_as :missing_vm
8
+ auto_resolution :recreate_vm
8
9
 
9
10
  def initialize(vm_id, data)
10
11
  super
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Director
3
- VERSION = '1.2905.0'
3
+ VERSION = '1.2915.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.2905.0
4
+ version: 1.2915.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-03-27 00:00:00.000000000 Z
11
+ date: 2015-04-07 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.2905.0
33
+ version: 1.2915.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.2905.0
40
+ version: 1.2915.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.2905.0
47
+ version: 1.2915.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.2905.0
54
+ version: 1.2915.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.2905.0
61
+ version: 1.2915.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.2905.0
68
+ version: 1.2915.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.2905.0
75
+ version: 1.2915.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.2905.0
82
+ version: 1.2915.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.2905.0
89
+ version: 1.2915.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.2905.0
96
+ version: 1.2915.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.2905.0
103
+ version: 1.2915.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.2905.0
110
+ version: 1.2915.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.2905.0
117
+ version: 1.2915.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.2905.0
124
+ version: 1.2915.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.2905.0
131
+ version: 1.2915.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.2905.0
138
+ version: 1.2915.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.2905.0
145
+ version: 1.2915.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.2905.0
152
+ version: 1.2915.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.2
159
+ version: 0.7.3
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.2
166
+ version: 0.7.3
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: eventmachine
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -558,7 +558,7 @@ dependencies:
558
558
  version: '0'
559
559
  description: |-
560
560
  BOSH Director
561
- 327a58
561
+ 5653ce
562
562
  email: support@cloudfoundry.com
563
563
  executables:
564
564
  - bosh-director
@@ -611,6 +611,8 @@ files:
611
611
  - db/migrations/director/20150102234124_denormalize_task_user_id_to_task_username.rb
612
612
  - db/migrations/director/20150223222605_increase_manifest_text_limit.rb
613
613
  - db/migrations/director/20150224193313_use_larger_text_types.rb
614
+ - db/migrations/director/20150331002413_add_cloud_configs.rb
615
+ - db/migrations/director/20150401184803_add_cloud_config_to_deployments.rb
614
616
  - db/migrations/dns/20120123234908_initial.rb
615
617
  - lib/bosh/director.rb
616
618
  - lib/bosh/director/agent_client.rb
@@ -618,9 +620,11 @@ files:
618
620
  - lib/bosh/director/api.rb
619
621
  - lib/bosh/director/api/api_helper.rb
620
622
  - lib/bosh/director/api/backup_manager.rb
623
+ - lib/bosh/director/api/cloud_config_manager.rb
621
624
  - lib/bosh/director/api/compiled_package_group_manager.rb
622
625
  - lib/bosh/director/api/controllers/backups_controller.rb
623
626
  - lib/bosh/director/api/controllers/base_controller.rb
627
+ - lib/bosh/director/api/controllers/cloud_configs_controller.rb
624
628
  - lib/bosh/director/api/controllers/compiled_packages_controller.rb
625
629
  - lib/bosh/director/api/controllers/deployments_controller.rb
626
630
  - lib/bosh/director/api/controllers/info_controller.rb
@@ -757,6 +761,7 @@ files:
757
761
  - lib/bosh/director/log_bundles_cleaner.rb
758
762
  - lib/bosh/director/logs_fetcher.rb
759
763
  - lib/bosh/director/models.rb
764
+ - lib/bosh/director/models/cloud_config.rb
760
765
  - lib/bosh/director/models/compiled_package.rb
761
766
  - lib/bosh/director/models/deployment.rb
762
767
  - lib/bosh/director/models/deployment_problem.rb