bosh_aws_cpi 1.2989.0 → 1.2992.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: 2028a63025b046bf83df0de41cbfca8b14e4494a
4
- data.tar.gz: fa2ca5b8d2d505f19b7527438efa56794afeff4b
3
+ metadata.gz: 161bccd1a02f77f5c44caada4be4ace8557996d0
4
+ data.tar.gz: 244ec285585ea16f80ac0f1919f8cdc999fd225e
5
5
  SHA512:
6
- metadata.gz: d9d826475b1c094682f780216e6ab4822d5a9bddc8396420cf71b41166fb8d5b662aafcdc0d014002020ba3ac0a016c36be574368aba385801b50d42de97fd85
7
- data.tar.gz: c242b1c0e2ef77f7731d6da22587f4e0bb0506204a1e4c8c8855ffb8125388bd9ccc7a99d3fc29f2d0aec754ee7534b39968839844c5d1cfd7f46ad335c5ef34
6
+ metadata.gz: 8c66e5cd0a0ddd21b5a8f55307ea26ef6aef70510ede200ee0c6b35d7136f1684826f457fef3fff7efd413f65daced7e98ee1e1eb24bdb861ca7dc31cb74c455
7
+ data.tar.gz: da9f62f7108eb9a4ce5992d5b0b9b5dd6b464c8e500f9385484c677605b7a41582790891165685281d9e724606db5ffd7b43a742ddd11782dbd01b96d1eae63a
data/README.md CHANGED
@@ -16,7 +16,7 @@ These options are passed to the AWS CPI when it is instantiated.
16
16
  * `default_key_name` (required)
17
17
  default AWS ssh key name to assign to created virtual machines
18
18
  * `default_security_groups` (required)
19
- list of AWS security group to assign to created virtual machines
19
+ list of AWS security group names or ids to assign to created virtual machines, note that name and id can not be used together in this attribute.
20
20
  * `ec2_private_key` (required)
21
21
  local path to the ssh private key, must match `default_key_name`
22
22
  * `region` (required)
@@ -66,6 +66,9 @@ These options are specified under `cloud_options` in the `networks` section of a
66
66
  can be either `dynamic` for a DHCP assigned IP by AWS, or `vip` to use an Elastic IP (which needs to be already
67
67
  allocated)
68
68
 
69
+ * `security_groups` (optional)
70
+ the AWS security group names or ids to assign to VMs. If not specified, it'll use the default security groups set at the AWS options. Note that name and id can not be used together in this attribute.
71
+
69
72
  ## Example
70
73
 
71
74
  This is a sample of how AWS specific properties are used in a BOSH deployment manifest:
@@ -398,7 +398,7 @@ module Bosh::AwsCloud
398
398
  # we need to send the InstanceUpdater a request to do it for us
399
399
  def compare_security_groups(instance, network_spec)
400
400
  actual_group_names = instance.security_groups.collect { |sg| sg.name }
401
- specified_group_names = extract_security_group_names(network_spec)
401
+ specified_group_names = extract_security_groups(network_spec)
402
402
  if specified_group_names.empty?
403
403
  new_group_names = Array(aws_properties["default_security_groups"])
404
404
  else
@@ -17,7 +17,7 @@ module Bosh::AwsCloud
17
17
  raise Bosh::Clouds::CloudError, message
18
18
  end
19
19
 
20
- def extract_security_group_names(networks_spec)
20
+ def extract_security_groups(networks_spec)
21
21
  networks_spec.
22
22
  values.
23
23
  select { |network_spec| network_spec.has_key? "cloud_properties" }.
@@ -118,11 +118,11 @@ module Bosh::AwsCloud
118
118
  end
119
119
 
120
120
  def set_security_groups_parameter(instance_params, networks_spec, default_security_groups)
121
- security_group_names = extract_security_group_names(networks_spec)
122
- if security_group_names.empty?
123
- instance_params[:security_groups] = default_security_groups
121
+ security_groups = extract_security_groups(networks_spec)
122
+ if security_groups.empty?
123
+ validate_and_prepare_security_groups_parameter(instance_params, default_security_groups)
124
124
  else
125
- instance_params[:security_groups] = security_group_names
125
+ validate_and_prepare_security_groups_parameter(instance_params, security_groups)
126
126
  end
127
127
  end
128
128
 
@@ -154,5 +154,27 @@ module Bosh::AwsCloud
154
154
 
155
155
  instance_params[:user_data] = Yajl::Encoder.encode(user_data)
156
156
  end
157
+
158
+ def validate_and_prepare_security_groups_parameter(instance_params, security_groups)
159
+ return if security_groups.nil? || security_groups.empty?
160
+
161
+ is_id = is_security_group_id?(security_groups.first)
162
+
163
+ security_groups.drop(1).each do |security_group|
164
+ unless is_security_group_id?(security_group) == is_id
165
+ raise Bosh::Clouds::CloudError, 'security group names and ids can not be used together in security groups'
166
+ end
167
+ end
168
+
169
+ if is_id
170
+ instance_params[:security_group_ids] = security_groups
171
+ else
172
+ instance_params[:security_groups] = security_groups
173
+ end
174
+ end
175
+
176
+ def is_security_group_id?(security_group)
177
+ security_group.start_with?('sg-') && security_group.size == 11
178
+ end
157
179
  end
158
180
  end
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module AwsCloud
3
- VERSION = '1.2989.0'
3
+ VERSION = '1.2992.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh_aws_cpi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2989.0
4
+ version: 1.2992.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-06-16 00:00:00.000000000 Z
11
+ date: 2015-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -30,42 +30,42 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.2989.0
33
+ version: 1.2992.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.2989.0
40
+ version: 1.2992.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.2989.0
47
+ version: 1.2992.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.2989.0
54
+ version: 1.2992.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.2989.0
61
+ version: 1.2992.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.2989.0
68
+ version: 1.2992.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: httpclient
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -138,7 +138,7 @@ dependencies:
138
138
  version: '0'
139
139
  description: |-
140
140
  BOSH AWS CPI
141
- 0c4ecd
141
+ 2996bb
142
142
  email: support@cloudfoundry.com
143
143
  executables:
144
144
  - aws_cpi