kitchen-ec2 0.6.0 → 0.7.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: 8175b385d762471ef97ce9284d22097c0f22c5c9
4
- data.tar.gz: 01c885f833e299df244fb2ea400954626d0e39e3
3
+ metadata.gz: 04327b0481d7914db71e72ee411cdcab4fd6eb9b
4
+ data.tar.gz: 6fd0d5a57e11c1866e706616a7a8e61945973f72
5
5
  SHA512:
6
- metadata.gz: a3d6c367265a0f8ff646a2d3018fc008e553bbdddf1d92692fc64e986d6d9f24bd787617d83bdc7cdc11d9e39eb45c7330aa9fdcf9076d776d4c4802a93e9c43
7
- data.tar.gz: 47303e7a66e892ccc7a357cb746b9b06cc9ace14166e36d15bd000a93d1ffe97b3bda2ea844cbbbba75efeec64b444e873aa9af7941a627602de38bb45eaf9ee
6
+ metadata.gz: 1ff3b4a368e69d2fc0233b402440e1bdf8f2d39451d22486a895124d86ca84aede65187bdba92f6da1acbf18b85a2c5ecce6b635d9e70b31200368a2f7120bcf
7
+ data.tar.gz: d5e7123d787c59ae27b54c2ee3f2d0c43ad6d898722c8a55f150fe440e8cfca88efd28fe77631fdeaf86997cd687000b6e8440d3bd5570853cd36005a2252efb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## 0.7.0 / 2013-08-29
2
+
3
+ ### Bug fixes
4
+
5
+ * Pull request #13: #wait_for_ssh takes 2 arguments. (@dysinger)
6
+
7
+ ### Improvements
8
+
9
+ * Support computed defaults for a select list of pre-determined platforms (see readme for quick example). ([@fnichol][])~
10
+
11
+
1
12
  ## 0.6.0 / 2013-07-23
2
13
 
3
14
  ### Bug fixes
data/README.md CHANGED
@@ -18,6 +18,46 @@ will need access to an [AWS][aws_site] account.
18
18
 
19
19
  Please read the [Driver usage][driver_usage] page for more details.
20
20
 
21
+ ## <a name="default-config"></a> Default Configuration
22
+
23
+ This driver can determine AMI and username login for a select number of
24
+ platforms in each region. Currently, the following platform names are
25
+ supported:
26
+
27
+ ```ruby
28
+ ---
29
+ platforms:
30
+ - name: ubuntu-10.04
31
+ - name: ubuntu-12.04
32
+ - name: ubuntu-12.10
33
+ - name: ubuntu-13.04
34
+ - name: centos-6.4
35
+ - name: debian-7.1.0
36
+ ```
37
+
38
+ This will effectively generate a configuration similar to:
39
+
40
+ ```ruby
41
+ ---
42
+ platforms:
43
+ - name: ubuntu-10.04
44
+ driver_config:
45
+ image_id: ami-1ab3ce73
46
+ username: ubuntu
47
+ - name: ubuntu-12.04
48
+ driver_config:
49
+ image_id: ami-2f115c46
50
+ username: ubuntu
51
+ # ...
52
+ - name: centos-6.4
53
+ driver_config:
54
+ image_id: ami-bf5021d6
55
+ username: root
56
+ # ...
57
+ ```
58
+
59
+ For specific default values, please consult [amis.json][amis_json].
60
+
21
61
  ## <a name="config"></a> Configuration
22
62
 
23
63
  ### <a name="config-az"></a> availability\_zone
@@ -30,19 +70,22 @@ The default is `"us-east-1b"`.
30
70
 
31
71
  **Required** The AWS [access key id][credentials_docs] to use.
32
72
 
33
- The default is unset, or `nil`.
73
+ The default will be read from the `AWS_ACCESS_KEY` environment variable if set,
74
+ or `nil` otherwise.
34
75
 
35
76
  ### <a name="config-aws-secret-access-key"></a> aws\_secret\_access\_key
36
77
 
37
78
  **Required** The AWS [secret access key][credentials_docs] to use.
38
79
 
39
- The default is unset, or `nil`.
80
+ The default will be read from the `AWS_SECRET_KEY` environment variable if set,
81
+ or `nil` otherwise.
40
82
 
41
83
  ### <a name="config-aws-ssh-key-id"></a> aws\_ssh\_key\_id
42
84
 
43
85
  **Required** The EC2 [SSH key id][key_id_docs] to use.
44
86
 
45
- The default is unset, or `nil`.
87
+ The default will be read from the `AWS_SSH_KEY_ID` environment variable if set,
88
+ or `nil` otherwise.
46
89
 
47
90
  ### <a name="config-flavor-id"></a> flavor\_id
48
91
 
@@ -61,7 +104,9 @@ The default is `["default"]`.
61
104
 
62
105
  **Required** The EC2 [AMI id][ami_docs] to use.
63
106
 
64
- The default is unset, or `nil`.
107
+ The default will be determined by the `aws_region` chosen and the Platform
108
+ name, if a default exists (see [amis.json][ami_json]). If a default cannot be
109
+ computed, then the default is `nil`.
65
110
 
66
111
  ### <a name="config-port"></a> port
67
112
 
@@ -120,7 +165,9 @@ The default is `{ "created-by" => "test-kitchen" }`.
120
165
 
121
166
  The SSH username that will be used to communicate with the instance.
122
167
 
123
- The default is `"root"`.
168
+ The default will be determined by the Platform name, if a default exists (see
169
+ [amis.json][amis_json]). If a default cannot be computed, then the default is
170
+ `"root"`.
124
171
 
125
172
  ## <a name="example"></a> Example
126
173
 
@@ -214,6 +261,7 @@ Apache 2.0 (see [LICENSE][license])
214
261
  [driver_usage]: http://docs.kitchen-ci.org/drivers/usage
215
262
  [chef_omnibus_dl]: http://www.opscode.com/chef/install/
216
263
 
264
+ [amis_json]: https://github.com/opscode/kitchen-ec2/blob/master/data/amis.json
217
265
  [ami_docs]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ComponentsAMIs.html
218
266
  [aws_site]: http://aws.amazon.com/
219
267
  [credentials_docs]: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/SettingUp_CommandLine.html#using-credentials-access-key
data/data/amis.json ADDED
@@ -0,0 +1,81 @@
1
+ {
2
+ "regions": {
3
+ "ap-northeast-1": {
4
+ "ubuntu-10.04": "ami-8326b382",
5
+ "ubuntu-12.04": "ami-bb9a08ba",
6
+ "ubuntu-12.10": "ami-4556c544",
7
+ "ubuntu-13.04": "ami-97099a96",
8
+ "centos-6.4": "ami-9ffa709e",
9
+ "debian-7.1.0": "ami-f1f064f0"
10
+ },
11
+ "ap-southeast-1": {
12
+ "ubuntu-10.04": "ami-34713866",
13
+ "ubuntu-12.04": "ami-881c57da",
14
+ "ubuntu-12.10": "ami-3ce0a86e",
15
+ "ubuntu-13.04": "ami-4af5bd18",
16
+ "centos-6.4": "ami-46f5bb14",
17
+ "debian-7.1.0": "ami-fe8ac3ac"
18
+ },
19
+ "ap-southeast-2": {
20
+ "ubuntu-10.04": "ami-2f009315",
21
+ "ubuntu-12.04": "ami-cb26b4f1",
22
+ "ubuntu-12.10": "ami-1703912d",
23
+ "ubuntu-13.04": "ami-8f32a0b5",
24
+ "centos-6.4": "ami-9352c1a9",
25
+ "debian-7.1.0": "ami-4e099a74"
26
+ },
27
+ "eu-west-1": {
28
+ "ubuntu-10.04": "ami-bbadb0cf",
29
+ "ubuntu-12.04": "ami-d3b5aea7",
30
+ "ubuntu-12.10": "ami-6b62791f",
31
+ "ubuntu-13.04": "ami-6fd4cf1b",
32
+ "centos-6.4": "ami-75190b01",
33
+ "debian-7.1.0": "ami-954559e1"
34
+ },
35
+ "sa-east-1": {
36
+ "ubuntu-10.04": "ami-962c898b",
37
+ "ubuntu-12.04": "ami-c905a1d4",
38
+ "ubuntu-12.10": "ami-e759fdfa",
39
+ "ubuntu-13.04": "ami-4b2b8f56",
40
+ "centos-6.4": "ami-a665c0bb",
41
+ "debian-7.1.0": "ami-b03590ad"
42
+ },
43
+ "us-east-1": {
44
+ "ubuntu-10.04": "ami-1ab3ce73",
45
+ "ubuntu-12.04": "ami-2f115c46",
46
+ "ubuntu-12.10": "ami-4d5b1824",
47
+ "ubuntu-13.04": "ami-a73371ce",
48
+ "centos-6.4": "ami-bf5021d6",
49
+ "debian-7.1.0": "ami-50d9a439"
50
+ },
51
+ "us-west-1": {
52
+ "ubuntu-10.04": "ami-848ba2c1",
53
+ "ubuntu-12.04": "ami-eaf0daaf",
54
+ "ubuntu-12.10": "ami-02220847",
55
+ "ubuntu-13.04": "ami-fe052fbb",
56
+ "centos-6.4": "ami-5d456c18",
57
+ "debian-7.1.0": "ami-1a9bb25f"
58
+ },
59
+ "us-west-2": {
60
+ "ubuntu-10.04": "ami-f19407c1",
61
+ "ubuntu-12.04": "ami-e6f36fd6",
62
+ "ubuntu-12.10": "ami-0c069b3c",
63
+ "ubuntu-13.04": "ami-4ade427a",
64
+ "centos-6.4": "ami-b3bf2f83",
65
+ "debian-7.1.0": "ami-158a1925"
66
+ }
67
+ },
68
+ "usernames": {
69
+ "ubuntu-10.04": "ubuntu",
70
+ "ubuntu-12.04": "ubuntu",
71
+ "ubuntu-12.10": "ubuntu",
72
+ "ubuntu-13.04": "ubuntu",
73
+ "centos-6.4": "root",
74
+ "debian-7.1.0": "admin"
75
+ },
76
+ "references": {
77
+ "ubuntu": "http://uec-images.ubuntu.com/query/",
78
+ "debian": "https://wiki.debian.org/Cloud/AmazonEC2Image",
79
+ "centos": "http://wiki.centos.org/Cloud/AWS"
80
+ }
81
+ }
data/kitchen-ec2.gemspec CHANGED
@@ -6,6 +6,7 @@ require 'kitchen/driver/ec2_version.rb'
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = "kitchen-ec2"
8
8
  gem.version = Kitchen::Driver::EC2_VERSION
9
+ gem.license = 'Apache 2.0'
9
10
  gem.authors = ["Fletcher Nichol"]
10
11
  gem.email = ["fnichol@nichol.ca"]
11
12
  gem.description = "Kitchen::Driver::Ec2 - A Test Kitchen Driver for Ec2"
@@ -17,7 +18,7 @@ Gem::Specification.new do |gem|
17
18
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
19
  gem.require_paths = ["lib"]
19
20
 
20
- gem.add_dependency 'test-kitchen', '~> 1.0.0.beta.1'
21
+ gem.add_dependency 'test-kitchen', '~> 1.0.0.beta.3'
21
22
  gem.add_dependency 'fog'
22
23
 
23
24
  gem.add_development_dependency 'cane'
@@ -17,6 +17,7 @@
17
17
  # limitations under the License.
18
18
 
19
19
  require 'benchmark'
20
+ require 'json'
20
21
  require 'fog'
21
22
 
22
23
  require 'kitchen'
@@ -35,7 +36,21 @@ module Kitchen
35
36
  default_config :flavor_id, 'm1.small'
36
37
  default_config :groups, ['default']
37
38
  default_config :tags, { 'created-by' => 'test-kitchen' }
38
- default_config :username, 'root'
39
+ default_config :aws_access_key_id do |driver|
40
+ ENV['AWS_ACCESS_KEY']
41
+ end
42
+ default_config :aws_secret_access_key do |driver|
43
+ ENV['AWS_SECRET_KEY']
44
+ end
45
+ default_config :aws_ssh_key_id do |driver|
46
+ ENV['AWS_SSH_KEY_ID']
47
+ end
48
+ default_config :image_id do |driver|
49
+ driver.default_ami
50
+ end
51
+ default_config :username do |driver|
52
+ driver.default_username
53
+ end
39
54
 
40
55
  required_config :aws_access_key_id
41
56
  required_config :aws_secret_access_key
@@ -49,7 +64,7 @@ module Kitchen
49
64
  info("EC2 instance <#{state[:server_id]}> created.")
50
65
  server.wait_for { print "."; ready? } ; print "(server ready)"
51
66
  state[:hostname] = server.public_ip_address || server.private_ip_address
52
- wait_for_sshd(state[:hostname]) ; print "(ssh ready)\n"
67
+ wait_for_sshd(state[:hostname], config[:username]) ; print "(ssh ready)\n"
53
68
  debug("ec2:create '#{state[:hostname]}'")
54
69
  rescue Fog::Errors::Error, Excon::Errors::Error => ex
55
70
  raise ActionFailed, ex.message
@@ -65,6 +80,15 @@ module Kitchen
65
80
  state.delete(:hostname)
66
81
  end
67
82
 
83
+ def default_ami
84
+ region = amis["regions"][config[:region]]
85
+ region && region[instance.platform.name]
86
+ end
87
+
88
+ def default_username
89
+ amis["usernames"][instance.platform.name] || "root"
90
+ end
91
+
68
92
  private
69
93
 
70
94
  def connection
@@ -100,6 +124,14 @@ module Kitchen
100
124
  debug("ec2:key_name '#{config[:aws_ssh_key_id]}'")
101
125
  debug("ec2:subnet_id '#{config[:subnet_id]}'")
102
126
  end
127
+
128
+ def amis
129
+ @amis ||= begin
130
+ json_file = File.join(File.dirname(__FILE__),
131
+ %w{.. .. .. data amis.json})
132
+ JSON.load(IO.read(json_file))
133
+ end
134
+ end
103
135
  end
104
136
  end
105
137
  end
@@ -21,6 +21,6 @@ module Kitchen
21
21
  module Driver
22
22
 
23
23
  # Version string for EC2 Test Kitchen driver
24
- EC2_VERSION = "0.6.0"
24
+ EC2_VERSION = "0.7.0"
25
25
  end
26
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-ec2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fletcher Nichol
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-23 00:00:00.000000000 Z
11
+ date: 2013-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.0.beta.1
19
+ version: 1.0.0.beta.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: 1.0.0.beta.1
26
+ version: 1.0.0.beta.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: fog
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -96,11 +96,13 @@ files:
96
96
  - LICENSE
97
97
  - README.md
98
98
  - Rakefile
99
+ - data/amis.json
99
100
  - kitchen-ec2.gemspec
100
101
  - lib/kitchen/driver/ec2.rb
101
102
  - lib/kitchen/driver/ec2_version.rb
102
103
  homepage: https://github.com/opscode/kitchen-ec2/
103
- licenses: []
104
+ licenses:
105
+ - Apache 2.0
104
106
  metadata: {}
105
107
  post_install_message:
106
108
  rdoc_options: []