bosh-director 1.2862.0 → 1.2865.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: 90797724c4418af74e74de81c8b5c9955ebfbd31
4
- data.tar.gz: fdac207018629e7463ba22a05dee08e0493e3a12
3
+ metadata.gz: d691fc291096229e10ae5d5d8e6da83337727e1c
4
+ data.tar.gz: 3aafd6149acf31aabeb76de9280ce530dec90b8f
5
5
  SHA512:
6
- metadata.gz: a4f2dfa82f0e1c11acac4fb2d01342f6da5056d61107eb625ae2f30468ebfcccdfd52629d900ede43a86492d2d78066d73607f036792d27f78409e95f10420d4
7
- data.tar.gz: b5dfff754b5543d8896537bf3774a826f5f51f641e671c7154845fd71ea0200a5ffc53af59c2cdf356d4d477915a8e69526cc7204ff827147f13e44b8da3111f
6
+ metadata.gz: 426f25380bffc4e9565094f6342fe4bca45651e48050f908a1c2e5b7b1a3c233a365cc8f4afc2b8e32c4a0b5a01389feadc62557965344c675efa5faa0ef3881
7
+ data.tar.gz: 348c2b119a34feff5b64422e67460a9b96634525246fdc436b1a931a075045aed4a96c53fdfd94fe876ef31f85d81e5fd93a0e821b11c6dfb4a264fb42dcfa4e
data/bin/bosh-director CHANGED
@@ -18,7 +18,7 @@ config = Bosh::Director::Config.load_file(config_file)
18
18
 
19
19
  route_configuration = Bosh::Director::Api::RouteConfiguration.new(config)
20
20
 
21
- thin_server = Thin::Server.new('127.0.0.1', config.hash['port'], signals: false) do
21
+ thin_server = Thin::Server.new('127.0.0.1', config.port, signals: false) do
22
22
  use Rack::CommonLogger
23
23
 
24
24
  route_configuration.controllers.each do |route, controller|
@@ -33,5 +33,5 @@ end
33
33
  end
34
34
  end
35
35
 
36
- Bosh::Director::Config.logger.info("Listening on port #{config.hash['port']}")
36
+ Bosh::Director::Config.logger.info("Listening on port #{config.port}")
37
37
  thin_server.start!
@@ -16,7 +16,7 @@ opts.parse!(ARGV.dup)
16
16
  config = Bosh::Director::Config.load_file(config_file)
17
17
  Bosh::Director::App.new(config)
18
18
 
19
- scheduler = Bosh::Director::Scheduler.new(config.hash.fetch('scheduled_jobs', []))
19
+ scheduler = Bosh::Director::Scheduler.new(config.scheduled_jobs)
20
20
 
21
21
  %w(TERM INT QUIT).each do |signal|
22
22
  trap(signal) do
@@ -51,15 +51,7 @@ end
51
51
 
52
52
  Bosh::Director::App.new(config)
53
53
 
54
- logger = Logging::Logger.new('DirectorWorker')
55
- resque_logging = config.hash.fetch('resque', {}).fetch('logging', {})
56
- if resque_logging.has_key?('file')
57
- logger.add_appenders(Logging.appenders.file('DirectorWorkerFile', filename: resque_logging.fetch('file'), layout: ThreadFormatter.layout))
58
- else
59
- logger.add_appenders(Logging.appenders.stdout('DirectorWorkerIO', layout: ThreadFormatter.layout))
60
- end
61
- logger.level = Logging.levelify(resque_logging.fetch('level', 'info'))
62
- Resque.logger = logger
54
+ Resque.logger = config.resque_logger
63
55
 
64
56
  worker = nil
65
57
  queues = (ENV['QUEUES'] || ENV['QUEUE']).to_s.split(',')
@@ -6,9 +6,10 @@ module Bosh::Director
6
6
  include Http
7
7
  include DnsHelper
8
8
 
9
- def initialize(identity_provider)
9
+ def initialize(config)
10
10
  super()
11
- @identity_provider = identity_provider
11
+ @config = config
12
+ @identity_provider = config.identity_provider
12
13
  @deployment_manager = DeploymentManager.new
13
14
  @backup_manager = BackupManager.new
14
15
  @instance_manager = InstanceManager.new
@@ -11,8 +11,8 @@ require 'bosh/director/jobs/import_compiled_packages'
11
11
  module Bosh::Director
12
12
  module Api::Controllers
13
13
  class CompiledPackagesController < BaseController
14
- def initialize(identity_provider, compiled_package_group_manager)
15
- super(identity_provider)
14
+ def initialize(config, compiled_package_group_manager)
15
+ super(config)
16
16
  @compiled_package_group_manager = compiled_package_group_manager
17
17
  end
18
18
 
@@ -14,14 +14,15 @@ module Bosh::Director
14
14
  'version' => "#{VERSION} (#{Config.revision})",
15
15
  'user' => @user,
16
16
  'cpi' => Config.cloud_type,
17
+ 'user_authentication' => @config.identity_provider.client_info,
17
18
  'features' => {
18
19
  'dns' => {
19
20
  'status' => Config.dns_enabled?,
20
- 'extras' => { 'domain_name' => dns_domain_name }
21
+ 'extras' => {'domain_name' => dns_domain_name}
21
22
  },
22
23
  'compiled_package_cache' => {
23
24
  'status' => Config.use_compiled_package_cache?,
24
- 'extras' => { 'provider' => Config.compiled_package_cache_provider }
25
+ 'extras' => {'provider' => Config.compiled_package_cache_provider}
25
26
  },
26
27
  'snapshots' => {
27
28
  'status' => Config.enable_snapshots
@@ -4,8 +4,8 @@ module Bosh::Director
4
4
  module Api::Controllers
5
5
  class ResourcesController < BaseController
6
6
 
7
- def initialize(identity_provider, resource_manager)
8
- super(identity_provider)
7
+ def initialize(config, resource_manager)
8
+ super(config)
9
9
  @resource_manager = resource_manager
10
10
  end
11
11
 
@@ -2,8 +2,12 @@ module Bosh
2
2
  module Director
3
3
  module Api
4
4
  class LocalIdentityProvider
5
- def initialize(user_manager)
6
- @user_manager = user_manager
5
+ def initialize(*_)
6
+ @user_manager = Bosh::Director::Api::UserManager.new
7
+ end
8
+
9
+ def client_info
10
+ {'type' => 'basic', 'options' => {}}
7
11
  end
8
12
 
9
13
  def corroborate_user(request_env)
@@ -3,8 +3,6 @@ module Bosh
3
3
  module Api
4
4
  class RouteConfiguration
5
5
 
6
- USER_MANAGEMENT_PROVIDERS = %w[uaa local]
7
-
8
6
  def initialize(config)
9
7
  @config = config
10
8
  end
@@ -12,55 +10,27 @@ module Bosh
12
10
  def controllers
13
11
  director_app = Bosh::Director::App.new(@config)
14
12
  controllers = {}
15
- controllers['/info'] = Bosh::Director::Api::Controllers::InfoController.new(identity_provider)
16
- controllers['/tasks'] = Bosh::Director::Api::Controllers::TasksController.new(identity_provider)
17
- controllers['/backups'] = Bosh::Director::Api::Controllers::BackupsController.new(identity_provider)
18
- controllers['/deployments'] = Bosh::Director::Api::Controllers::DeploymentsController.new(identity_provider)
19
- controllers['/packages'] = Bosh::Director::Api::Controllers::PackagesController.new(identity_provider)
20
- controllers['/releases'] = Bosh::Director::Api::Controllers::ReleasesController.new(identity_provider)
13
+ controllers['/info'] = Bosh::Director::Api::Controllers::InfoController.new(@config)
14
+ controllers['/tasks'] = Bosh::Director::Api::Controllers::TasksController.new(@config)
15
+ controllers['/backups'] = Bosh::Director::Api::Controllers::BackupsController.new(@config)
16
+ controllers['/deployments'] = Bosh::Director::Api::Controllers::DeploymentsController.new(@config)
17
+ controllers['/packages'] = Bosh::Director::Api::Controllers::PackagesController.new(@config)
18
+ controllers['/releases'] = Bosh::Director::Api::Controllers::ReleasesController.new(@config)
21
19
  controllers['/resources'] = Bosh::Director::Api::Controllers::ResourcesController.new(
22
- identity_provider,
20
+ @config,
23
21
  Bosh::Director::Api::ResourceManager.new(director_app.blobstores.blobstore)
24
22
  )
25
- controllers['/resurrection'] = Bosh::Director::Api::Controllers::ResurrectionController.new(identity_provider)
26
- controllers['/stemcells'] = Bosh::Director::Api::Controllers::StemcellsController.new(identity_provider)
27
- controllers['/task'] = Bosh::Director::Api::Controllers::TaskController.new(identity_provider)
28
- controllers['/users'] = Bosh::Director::Api::Controllers::UsersController.new(identity_provider)
23
+ controllers['/resurrection'] = Bosh::Director::Api::Controllers::ResurrectionController.new(@config)
24
+ controllers['/stemcells'] = Bosh::Director::Api::Controllers::StemcellsController.new(@config)
25
+ controllers['/task'] = Bosh::Director::Api::Controllers::TaskController.new(@config)
26
+ controllers['/users'] = Bosh::Director::Api::Controllers::UsersController.new(@config)
29
27
  controllers['/compiled_package_groups'] = Bosh::Director::Api::Controllers::CompiledPackagesController.new(
30
- identity_provider,
28
+ @config,
31
29
  Bosh::Director::Api::CompiledPackageGroupManager.new
32
30
  )
33
- controllers['/locks'] = Bosh::Director::Api::Controllers::LocksController.new(identity_provider)
31
+ controllers['/locks'] = Bosh::Director::Api::Controllers::LocksController.new(@config)
34
32
  controllers
35
33
  end
36
-
37
- private
38
-
39
- def identity_provider
40
- @identity_provider ||= begin
41
- # no fetching w defaults?
42
- user_management = @config.hash['user_management']
43
- user_management ||= { 'provider' => 'local' }
44
- user_management_provider = user_management['provider']
45
-
46
- unless USER_MANAGEMENT_PROVIDERS.include?(user_management_provider)
47
- raise ArgumentError,
48
- "Unknown user management provider '#{user_management_provider}', " +
49
- "available providers are: #{USER_MANAGEMENT_PROVIDERS}"
50
- end
51
- if user_management_provider == 'uaa'
52
- Config.logger.debug("Director configured with 'uaa' user management provider")
53
- unless user_management['options'] && user_management['options']['key']
54
- raise ArgumentError, "Missing UAA secret key in user_management.options.key"
55
- end
56
-
57
- Bosh::Director::Api::UAAIdentityProvider.new(user_management['options']['key'])
58
- else
59
- Config.logger.debug("Director configured with 'local' user management provider")
60
- Bosh::Director::Api::LocalIdentityProvider.new(Bosh::Director::Api::UserManager.new)
61
- end
62
- end
63
- end
64
34
  end
65
35
  end
66
36
  end
@@ -4,8 +4,18 @@ module Bosh
4
4
  module Director
5
5
  module Api
6
6
  class UAAIdentityProvider
7
- def initialize(key)
8
- @token_coder = CF::UAA::TokenCoder.new(skey: key, audience_ids: ['bosh'])
7
+ def initialize(options)
8
+ @token_coder = CF::UAA::TokenCoder.new(skey: options.fetch('key'), audience_ids: ['bosh'])
9
+ @url = options.fetch('url')
10
+ end
11
+
12
+ def client_info
13
+ {
14
+ 'type' => 'uaa',
15
+ 'options' => {
16
+ 'url' => @url
17
+ }
18
+ }
9
19
  end
10
20
 
11
21
  def corroborate_user(request_env)
@@ -23,9 +23,7 @@ module Bosh::Director
23
23
  # it becomes the authoritative official version across the whole app.
24
24
  @@instance = self
25
25
 
26
- # This is the legacy config system that we are trying to get rid of by
27
- # decomposing and moving all the dependent components into this App
28
- Bosh::Director::Config.configure(config.hash)
26
+ config.configure_evil_config_singleton!
29
27
 
30
28
  @blobstores = Blobstores.new(config)
31
29
  end
@@ -3,8 +3,8 @@ module Bosh::Director
3
3
  attr_reader :blobstore
4
4
 
5
5
  def initialize(config)
6
- b_config = config.hash.fetch('blobstore')
7
- bd_config = config.hash['backup_destination']
6
+ b_config = config.blobstore_config
7
+ bd_config = config.backup_blobstore_config
8
8
  @blobstore = create_client(b_config)
9
9
  @backup_destination = create_client(bd_config) if bd_config
10
10
  end
@@ -4,10 +4,7 @@ require 'bosh/director/dns_helper'
4
4
 
5
5
  module Bosh::Director
6
6
 
7
- # We are in the slow painful process of extracting all of this class-level
8
- # behavior into instance behavior, much of it on the App class. When this
9
- # process is complete, the Config will be responsible only for maintaining
10
- # configuration information - not holding the state of the world.
7
+ # We want to shift from class methods to instance methods here.
11
8
 
12
9
  class Config
13
10
  class << self
@@ -353,10 +350,70 @@ module Bosh::Director
353
350
  end
354
351
  end
355
352
 
356
- attr_reader :hash
353
+ def name
354
+ hash['name']
355
+ end
356
+
357
+ def port
358
+ hash['port']
359
+ end
360
+
361
+ def scheduled_jobs
362
+ hash['scheduled_jobs'] || []
363
+ end
364
+
365
+ def identity_provider
366
+ @identity_provider ||= begin
367
+ # no fetching w defaults?
368
+ user_management = hash['user_management']
369
+ user_management ||= {'provider' => 'local'}
370
+ provider_name = user_management['provider']
371
+
372
+ providers = {
373
+ 'uaa' => Bosh::Director::Api::UAAIdentityProvider,
374
+ 'local' => Bosh::Director::Api::LocalIdentityProvider,
375
+ }
376
+ provider_class = providers[provider_name]
377
+
378
+ if provider_class.nil?
379
+ raise ArgumentError,
380
+ "Unknown user management provider '#{provider_name}', " +
381
+ "available providers are: #{providers.keys.join(", ")}"
382
+ end
383
+
384
+ Config.logger.debug("Director configured with '#{provider_name}' user management provider")
385
+ provider_class.new(user_management['options'] || {})
386
+ end
387
+ end
388
+
389
+ def resque_logger
390
+ logger = Logging::Logger.new('DirectorWorker')
391
+ resque_logging = hash.fetch('resque', {}).fetch('logging', {})
392
+ if resque_logging.has_key?('file')
393
+ logger.add_appenders(Logging.appenders.file('DirectorWorkerFile', filename: resque_logging.fetch('file'), layout: ThreadFormatter.layout))
394
+ else
395
+ logger.add_appenders(Logging.appenders.stdout('DirectorWorkerIO', layout: ThreadFormatter.layout))
396
+ end
397
+ logger.level = Logging.levelify(resque_logging.fetch('level', 'info'))
398
+ logger
399
+ end
400
+
401
+ def blobstore_config
402
+ hash.fetch('blobstore')
403
+ end
404
+
405
+ def backup_blobstore_config
406
+ hash['backup_destination']
407
+ end
408
+
409
+ def configure_evil_config_singleton!
410
+ Config.configure(hash)
411
+ end
357
412
 
358
413
  private
359
414
 
415
+ attr_reader :hash
416
+
360
417
  def initialize(hash)
361
418
  @hash = hash
362
419
  end
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Director
3
- VERSION = '1.2862.0'
3
+ VERSION = '1.2865.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.2862.0
4
+ version: 1.2865.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-03 00:00:00.000000000 Z
11
+ date: 2015-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bcrypt-ruby
@@ -30,126 +30,126 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.2862.0
33
+ version: 1.2865.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.2862.0
40
+ version: 1.2865.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.2862.0
47
+ version: 1.2865.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.2862.0
54
+ version: 1.2865.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.2862.0
61
+ version: 1.2865.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.2862.0
68
+ version: 1.2865.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.2862.0
75
+ version: 1.2865.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.2862.0
82
+ version: 1.2865.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.2862.0
89
+ version: 1.2865.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.2862.0
96
+ version: 1.2865.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.2862.0
103
+ version: 1.2865.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.2862.0
110
+ version: 1.2865.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.2862.0
117
+ version: 1.2865.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.2862.0
124
+ version: 1.2865.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.2862.0
131
+ version: 1.2865.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.2862.0
138
+ version: 1.2865.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.2862.0
145
+ version: 1.2865.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.2862.0
152
+ version: 1.2865.0
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: bosh_vcloud_cpi
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -460,7 +460,7 @@ dependencies:
460
460
  version: '0'
461
461
  description: |-
462
462
  BOSH Director
463
- c8ad5c
463
+ 14ebaf
464
464
  email: support@cloudfoundry.com
465
465
  executables:
466
466
  - bosh-director