bosh-registry 1.3074.0 → 1.3087.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: 97de729d8bf32a6a9100db0cfae9d6000b9f5abe
4
- data.tar.gz: 02776e6ef6c5b061c189dfec19160851082f0678
3
+ metadata.gz: f00a7d3c4c404d4476a44d2f6d7222c615f2faae
4
+ data.tar.gz: ade5cfa2fc3e6e38a8fafeb77b1016620ef89502
5
5
  SHA512:
6
- metadata.gz: a4a374a6ec8252edbcbe7dedd5acc74f102e59c530488bdb8ccde81f78126ea122dbb55c01337d532f55cfc3951b72d2654a40072b4c72ec63d427c6e79a155d
7
- data.tar.gz: 769612516555cc65d4d83562117fd22a2d469bdfe1f3e1194613574bdab1a735a759683d8cf00426f89552d446a27020108d9f7ee201de8633584a5071b579d0
6
+ metadata.gz: 01f2e826f55f57285d07461550096064ffa8e2ec43d566eb1bf06f7251d87ebb2aa86616a5c189a976b13d28cd268f0f6628a270d5240a7560517d576af2a911
7
+ data.tar.gz: 4c7272ead1ef067882f8d7240686c78967639d6017f174eed372b5bd773ff184309db8816a034eb8b6e1a7db5c971b50b6ae0f09d83ce2124ef2babf35e56268
data/README.md CHANGED
@@ -52,12 +52,14 @@ the IP addresses belonging to a instances:
52
52
 
53
53
  These are the credentials to connect to AWS services:
54
54
 
55
- * `access_key_id` (required)
56
- IAM Access Key ID
57
- * `secret_access_key` (required)
58
- AWS IAM Secret Access Key
59
55
  * `region` (required)
60
56
  AWS EC2 Region
57
+ * `credentials_source` (optional)
58
+ Where to get AWS credentials. This can be set to `static` for to use an `access_key_id` and `secret_access_key` or `env_or_profile` to get the credentials from environment variables or an EC2 instance profile. Defaults to `static` if not set.
59
+ * `access_key_id` (optional, required when `credentials_source` is `static`)
60
+ AWS IAM user access key
61
+ * `secret_access_key` (optional, required when `credentials_source` is `static`)
62
+ AWS IAM secret access key
61
63
  * `max_retries` (optional, defaults to 2)
62
64
  Max number of retries to connect to AWS
63
65
 
@@ -107,4 +109,4 @@ This is a sample of an Bosh Registry configuration file:
107
109
  api_key: bar
108
110
  tenant: foo
109
111
  domain: bar
110
- region:
112
+ region:
@@ -15,14 +15,14 @@ module Bosh::Registry
15
15
 
16
16
  @aws_properties = cloud_config["aws"]
17
17
  @aws_options = {
18
- :access_key_id => @aws_properties["access_key_id"],
19
- :secret_access_key => @aws_properties["secret_access_key"],
20
18
  :max_retries => @aws_properties["max_retries"] || AWS_MAX_RETRIES,
21
19
  :ec2_endpoint => @aws_properties['ec2_endpoint'] || "ec2.#{@aws_properties['region']}.amazonaws.com",
22
20
  :logger => @logger
23
21
  }
24
22
  # configure optional parameters
25
23
  %w(
24
+ access_key_id
25
+ secret_access_key
26
26
  ssl_verify_peer
27
27
  ssl_ca_file
28
28
  ssl_ca_path
@@ -30,17 +30,45 @@ module Bosh::Registry
30
30
  @aws_options[k.to_sym] = @aws_properties[k] unless @aws_properties[k].nil?
31
31
  end
32
32
 
33
+ # credentials_source could be static (default) or env_or_profile
34
+ # static credentials must be included in aws_properties
35
+ # env_or_profile credentials will use the AWS DefaultCredentialsProvider
36
+ # to find AWS credentials in environment variables or EC2 instance profiles
37
+
38
+ if cloud_config['aws']['credentials_source'] == 'static' || cloud_config['aws']['credentials_source'].nil?
39
+ @aws_options[:access_key_id] = cloud_config['aws']['access_key_id']
40
+ @aws_options[:secret_access_key] = cloud_config['aws']['secret_access_key']
41
+ end
42
+
33
43
  @ec2 = AWS::EC2.new(@aws_options)
34
44
  end
35
45
 
36
46
  def validate_options(cloud_config)
37
47
  unless cloud_config.has_key?("aws") &&
38
48
  cloud_config["aws"].is_a?(Hash) &&
39
- cloud_config["aws"]["access_key_id"] &&
40
- cloud_config["aws"]["secret_access_key"] &&
41
49
  cloud_config["aws"]["region"]
42
50
  raise ConfigError, "Invalid AWS configuration parameters"
43
51
  end
52
+
53
+ credentials_source = cloud_config['aws']['credentials_source'] || 'static'
54
+
55
+ if credentials_source != 'env_or_profile' && credentials_source != 'static'
56
+ raise ConfigError, "Unknown credentials_source #{credentials_source}"
57
+ end
58
+
59
+ if credentials_source == 'static'
60
+ if cloud_config["aws"]["access_key_id"].nil? || cloud_config["aws"]["secret_access_key"].nil?
61
+ raise ConfigError, "Must use access_key_id and secret_access_key with static credentials_source"
62
+ end
63
+ end
64
+
65
+ if credentials_source == 'env_or_profile'
66
+ if cloud_config["aws"]["access_key_id"] || cloud_config["aws"]["secret_access_key"]
67
+ raise ConfigError, "Can't use access_key_id and secret_access_key with env_or_profile credentials_source"
68
+ end
69
+ end
70
+
71
+
44
72
  end
45
73
 
46
74
  # Get the list of IPs belonging to this instance
@@ -59,4 +87,4 @@ module Bosh::Registry
59
87
 
60
88
  end
61
89
 
62
- end
90
+ end
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Registry
3
- VERSION = '1.3074.0'
3
+ VERSION = '1.3087.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh-registry
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3074.0
4
+ version: 1.3087.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-09-19 00:00:00.000000000 Z
11
+ date: 2015-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 1.3074.0
117
+ version: 1.3087.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.3074.0
124
+ version: 1.3087.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rake
127
127
  requirement: !ruby/object:Gem::Requirement