bosh_openstack_cpi 1.2732.0 → 1.2739.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: e496034c8207e60a568572d638a86c59d0ef63e2
4
- data.tar.gz: af7a72c50e33892fcf8f5f45a14746051953075a
3
+ metadata.gz: ee4017a97b49dc2f34ddd078fc99feaa345f6cc3
4
+ data.tar.gz: 9e0d98ca439ee06d5dcb46482eaa6af6a7d9ad67
5
5
  SHA512:
6
- metadata.gz: be3c8410a5e6edde7c0620865b97532292f56e41a326bddd2c35920748027d5168b0bf54b6b6648cf19136a026d10a21bc59f2fde3b93e9160f1fbe286cb36d3
7
- data.tar.gz: 7cf41525139be33c7d6868eeb2a8f86887a357485881c5436489e1bf17bcaad726a640285a002fe581a1394a0deae8d7dc0c017fae6402013b54e457f7320a7f
6
+ metadata.gz: 17da6ca3cc2b06ba342604dea03121cf17ca00a00ce834fc606c06b369a6525b86815b4e42a85b2a65461fd97dca17c56465a1781650c324f1b87c2a937c7d08
7
+ data.tar.gz: ae55d354e839c650c4d074e53221c4c789c361c12dcca851b4578837db969698a4e2e8ad44a87b7eb70dcb4822c84b6f54430d7378884e0500ee347c4c37f870
@@ -7,6 +7,8 @@ module Bosh::OpenStackCloud
7
7
  class Cloud < Bosh::Cloud
8
8
  include Helpers
9
9
 
10
+ OPTION_KEYS = ['openstack', 'registry', 'agent']
11
+
10
12
  BOSH_APP_DIR = '/var/vcap/bosh'
11
13
  FIRST_DEVICE_NAME_LETTER = 'b'
12
14
 
@@ -24,7 +26,7 @@ module Bosh::OpenStackCloud
24
26
  # @option options [Hash] agent agent options
25
27
  # @option options [Hash] registry agent options
26
28
  def initialize(options)
27
- @options = options.dup
29
+ @options = normalize_options(options)
28
30
 
29
31
  validate_options
30
32
  initialize_registry
@@ -253,7 +255,7 @@ module Bosh::OpenStackCloud
253
255
  @logger.debug("Using boot volume: `#{boot_vol_id}'")
254
256
  end
255
257
 
256
- use_config_drive = @openstack_properties.fetch("use_config_drive", false)
258
+ use_config_drive = !!@openstack_properties.fetch("config_drive", nil)
257
259
 
258
260
  server_params = {
259
261
  :name => server_name,
@@ -800,6 +802,7 @@ module Bosh::OpenStackCloud
800
802
 
801
803
  letter.succ! if flavor_has_ephemeral_disk?(flavor)
802
804
  letter.succ! if flavor_has_swap_disk?(flavor)
805
+ letter.succ! if @openstack_properties['config_drive'] == 'disk'
803
806
  letter
804
807
  end
805
808
 
@@ -900,22 +903,35 @@ module Bosh::OpenStackCloud
900
903
  # @return [void]
901
904
  # @raise [ArgumentError] if options are not valid
902
905
  def validate_options
903
- unless @options['openstack'].is_a?(Hash) &&
904
- @options.has_key?('openstack') &&
905
- @options['openstack']['auth_url'] &&
906
- @options['openstack']['username'] &&
907
- @options['openstack']['api_key'] &&
908
- @options['openstack']['tenant']
909
- raise ArgumentError, 'Invalid OpenStack configuration parameters'
910
- end
911
-
912
- unless @options.has_key?('registry') &&
913
- @options['registry'].is_a?(Hash) &&
914
- @options['registry']['endpoint'] &&
915
- @options['registry']['user'] &&
916
- @options['registry']['password']
917
- raise ArgumentError, 'Invalid registry configuration parameters'
906
+ schema = Membrane::SchemaParser.parse do
907
+ {
908
+ 'openstack' => {
909
+ 'auth_url' => String,
910
+ 'username' => String,
911
+ 'api_key' => String,
912
+ 'tenant' => String,
913
+ optional('region') => String,
914
+ optional('endpoint_type') => String,
915
+ optional('state_timeout') => Numeric,
916
+ optional('stemcell_public_visibility') => enum(String, bool),
917
+ optional('connection_options') => Hash,
918
+ optional('boot_from_volume') => bool,
919
+ optional('default_key_name') => String,
920
+ optional('default_security_groups') => [String],
921
+ optional('wait_resource_poll_interval') => Integer,
922
+ optional('config_drive') => enum('disk', 'cdrom'),
923
+ },
924
+ 'registry' => {
925
+ 'endpoint' => String,
926
+ 'user' => String,
927
+ 'password' => String,
928
+ },
929
+ optional('agent') => Hash,
930
+ }
918
931
  end
932
+ schema.validate(@options)
933
+ rescue Membrane::SchemaValidationError => e
934
+ raise ArgumentError, "Invalid OpenStack cloud properties: #{e.inspect}"
919
935
  end
920
936
 
921
937
  def initialize_registry
@@ -929,5 +945,34 @@ module Bosh::OpenStackCloud
929
945
  registry_password)
930
946
  end
931
947
 
948
+ def normalize_options(options)
949
+ unless options.kind_of?(Hash)
950
+ raise ArgumentError, "Invalid OpenStack cloud properties: Hash expected, received #{options}"
951
+ end
952
+ # we only care about two top-level fields
953
+ options = hash_filter(options.dup) { |key| OPTION_KEYS.include?(key) }
954
+ # nil values should be treated the same as missing keys (makes validating optional fields easier)
955
+ delete_entries_with_nil_keys(options)
956
+ end
957
+
958
+ def hash_filter(hash)
959
+ copy = {}
960
+ hash.each do |key, value|
961
+ copy[key] = value if yield(key)
962
+ end
963
+ copy
964
+ end
965
+
966
+ def delete_entries_with_nil_keys(options)
967
+ options.each do |key, value|
968
+ if value == nil
969
+ options.delete(key)
970
+ elsif value.kind_of?(Hash)
971
+ options[key] = delete_entries_with_nil_keys(value.dup)
972
+ end
973
+ end
974
+ options
975
+ end
976
+
932
977
  end
933
978
  end
@@ -3,6 +3,6 @@
3
3
 
4
4
  module Bosh
5
5
  module OpenStackCloud
6
- VERSION = '1.2732.0'
6
+ VERSION = '1.2739.0'
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh_openstack_cpi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2732.0
4
+ version: 1.2739.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piston Cloud Computing / VMware
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-30 00:00:00.000000000 Z
11
+ date: 2014-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog
@@ -30,42 +30,42 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.2732.0
33
+ version: 1.2739.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.2732.0
40
+ version: 1.2739.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bosh_cpi
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.2732.0
47
+ version: 1.2739.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.2732.0
54
+ version: 1.2739.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bosh-registry
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.2732.0
61
+ version: 1.2739.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.2732.0
68
+ version: 1.2739.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: httpclient
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -94,9 +94,23 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: 0.8.2
97
+ - !ruby/object:Gem::Dependency
98
+ name: membrane
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.0.2
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.0.2
97
111
  description: |-
98
112
  BOSH OpenStack CPI
99
- f6dedd
113
+ 0d77bd
100
114
  email: support@cloudfoundry.com
101
115
  executables:
102
116
  - bosh_openstack_console