kitchen-openstack 1.8.0 → 1.8.1

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: 140b00aba886334a4da296bc6d3e6fb8777f002c
4
- data.tar.gz: 1220ac0c3fa7569c320a732923bbe37704227517
3
+ metadata.gz: cb6b914b94611866e422dabc3cf49b12b27a669e
4
+ data.tar.gz: 8afa9715342e7030ef1ff79502f52ee903093380
5
5
  SHA512:
6
- metadata.gz: e4c827d8f26500ac3cf9650d56db7202c5616e4da400ef0ce5d78943bab7bfa305422a46e8cb0683c86421d1baa7d6f144a25690d11a8b032e0cb3fb0f0b9a13
7
- data.tar.gz: 8e780867cc2b7b8163fb3fbb6b144fae3329028cfc07aaa2a505f00ee0aa833300083d06a1980575db46d15239df1843509387c51ae4487aacbe179333061105
6
+ metadata.gz: 50a5e198899b658931381439aace29a5f745c64e76ffe9e9db64a227aac60157fe1fd3836b956f09eda16f471b4b8f72662e93b27ad64f9db642896bc8c981a9
7
+ data.tar.gz: 31181fa626deffd2467bcf84ebb5e49b1545d70169feebd9687f99000494457268af995964116e5bfac1921b559010136a6ec3364b4a52d04e4a2d02516d4a9d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # 1.8.1 / 2015-07-22
2
+
3
+ ### Bug Fixes
4
+
5
+ * PR [#88][] - Fail immediately and with a more understandable message if
6
+ required SSH configs can't be found
7
+
1
8
  # 1.8.0 / 2015-04-08
2
9
 
3
10
  ### New Features
@@ -144,6 +151,7 @@ certain specified NICs; via [@monsterzz][]
144
151
 
145
152
  * Initial release! Woo!
146
153
 
154
+ [#88]: https://github.com/test-kitchen/kitchen-openstack/pull/88
147
155
  [#74]: https://github.com/test-kitchen/kitchen-openstack/pull/74
148
156
  [#70]: https://github.com/test-kitchen/kitchen-openstack/pull/70
149
157
  [#66]: https://github.com/test-kitchen/kitchen-openstack/pull/66
data/README.md CHANGED
@@ -1,8 +1,14 @@
1
- [![Gem Version](https://badge.fury.io/rb/kitchen-openstack.png)](http://badge.fury.io/rb/kitchen-openstack)
2
- [![Build Status](https://travis-ci.org/test-kitchen/kitchen-openstack.png?branch=master)](https://travis-ci.org/test-kitchen/kitchen-openstack)
3
- [![Code Climate](https://codeclimate.com/github/test-kitchen/kitchen-openstack.png)](https://codeclimate.com/github/test-kitchen/kitchen-openstack)
4
- [![Coverage Status](https://coveralls.io/repos/test-kitchen/kitchen-openstack/badge.png)](https://coveralls.io/r/test-kitchen/kitchen-openstack)
5
- [![Dependency Status](https://gemnasium.com/test-kitchen/kitchen-openstack.png)](https://gemnasium.com/test-kitchen/kitchen-openstack)
1
+ [![Gem Version](https://img.shields.io/gem/v/kitchen-openstack.svg)][gem]
2
+ [![Build Status](https://img.shields.io/travis/test-kitchen/kitchen-openstack.svg)][travis]
3
+ [![Code Climate](https://img.shields.io/codeclimate/github/test-kitchen/kitchen-openstack.svg)][codeclimate]
4
+ [![Coverage Status](https://img.shields.io/coveralls/test-kitchen/kitchen-openstack.svg)][coveralls]
5
+ [![Dependency Status](https://img.shields.io/gemnasium/test-kitchen/kitchen-openstack.svg)][gemnasium]
6
+
7
+ [gem]: https://rubygems.org/gems/kitchen-openstack
8
+ [travis]: https://travis-ci.org/test-kitchen/kitchen-openstack
9
+ [codeclimate]: https://codeclimate.com/github/test-kitchen/kitchen-openstack
10
+ [coveralls]: https://coveralls.io/r/test-kitchen/kitchen-openstack
11
+ [gemnasium]: https://gemnasium.com/test-kitchen/kitchen-openstack
6
12
 
7
13
  # Kitchen::OpenStack
8
14
 
@@ -25,6 +31,10 @@ Or install it yourself as:
25
31
 
26
32
  $ gem install kitchen-openstack
27
33
 
34
+ Or if using [chefdk](https://downloads.chef.io/chef-dk) install with:
35
+
36
+ $ chef gem install kitchen-openstack
37
+
28
38
  ## Usage
29
39
 
30
40
  Provide, at a minimum, the required driver options in your `.kitchen.yml` file:
@@ -32,7 +42,7 @@ Provide, at a minimum, the required driver options in your `.kitchen.yml` file:
32
42
  driver:
33
43
  name: openstack
34
44
  openstack_username: [YOUR OPENSTACK USERNAME]
35
- openstack_api_key: [YOUR OPENSTACK API KEY]
45
+ openstack_api_key: [YOUR OPENSTACK API KEY] # AKA your OPENSTACK PASSWORD
36
46
  openstack_auth_url: [YOUR OPENSTACK AUTH URL]
37
47
  require_chef_omnibus: [e.g. 'true' or a version number if you need Chef]
38
48
  image_ref: [SERVER IMAGE ID]
@@ -53,7 +63,7 @@ behavior can be overridden with additional options:
53
63
  password: [SSH PASSWORD]
54
64
  port: [SSH PORT]
55
65
  key_name: [SSH KEY NAME]
56
- openstack_tenant: [YOUR OPENSTACK TENANT ID]
66
+ openstack_tenant: [YOUR OPENSTACK TENANT NAME]
57
67
  openstack_region: [A VALID OPENSTACK REGION]
58
68
  availability_zone: [AN OPENSTACK AVAILABILITY ZONE]
59
69
  openstack_service_name: [YOUR OPENSTACK COMPUTE SERVICE NAME]
@@ -75,10 +85,10 @@ behavior can be overridden with additional options:
75
85
  availability_zone: [THE BLOCK STORAGE AVAILABILITY ZONE, DEFAULTS TO nova]
76
86
  volume_type: [THE VOLUME TYPE, THIS IS OPTIONAL]
77
87
  delete_on_termination: [WILL DELETE VOLUME ON INSTANCE DESTROY WHEN true, OTHERWISE SET TO false]
78
-
79
- If a `server_name_prefix` is specified then this prefix will be used when
88
+
89
+ If a `server_name_prefix` is specified then this prefix will be used when
80
90
  generating random names of the form `<NAME PREFIX>-<RANDOM STRING>` e.g.
81
- `myproject-asdfghjk`. If both `server_name_prefix` and `server_name` are
91
+ `myproject-asdfghjk`. If both `server_name_prefix` and `server_name` are
82
92
  specified then the `server_name` takes precedence.
83
93
 
84
94
  If a `key_name` is provided it will be used instead of any
@@ -38,12 +38,12 @@ module Kitchen
38
38
  default_config :key_name, nil
39
39
  default_config :private_key_path do
40
40
  %w(id_rsa id_dsa).map do |k|
41
- f = File.expand_path "~/.ssh/#{k}"
41
+ f = File.expand_path("~/.ssh/#{k}")
42
42
  f if File.exist?(f)
43
43
  end.compact.first
44
44
  end
45
45
  default_config :public_key_path do |driver|
46
- driver[:private_key_path] + '.pub'
46
+ driver[:private_key_path] + '.pub' if driver[:private_key_path]
47
47
  end
48
48
  default_config :username, 'root'
49
49
  default_config :password, nil
@@ -62,6 +62,14 @@ module Kitchen
62
62
  default_config :no_ssh_tcp_check_sleep, 120
63
63
  default_config :block_device_mapping, nil
64
64
 
65
+ required_config :private_key_path
66
+ required_config :public_key_path do |_, value, driver|
67
+ if value.nil? && driver[:key_name].nil?
68
+ fail(UserError,
69
+ 'Either a `:public_key_path` or `:key_name` is required')
70
+ end
71
+ end
72
+
65
73
  def create(state)
66
74
  unless config[:server_name]
67
75
  if config[:server_name_prefix]
@@ -274,7 +282,8 @@ module Kitchen
274
282
 
275
283
  def get_public_private_ips(server)
276
284
  begin
277
- pub, priv = server.public_ip_addresses, server.private_ip_addresses
285
+ pub = server.public_ip_addresses
286
+ priv = server.private_ip_addresses
278
287
  rescue Fog::Compute::OpenStack::NotFound, Excon::Errors::Forbidden
279
288
  # See Fog issue: https://github.com/fog/fog/issues/2160
280
289
  addrs = server.addresses
@@ -300,7 +309,8 @@ module Kitchen
300
309
  end
301
310
 
302
311
  def parse_ips(pub, priv)
303
- pub, priv = Array(pub), Array(priv)
312
+ pub = Array(pub)
313
+ priv = Array(priv)
304
314
  if config[:use_ipv6]
305
315
  [pub, priv].each { |n| n.select! { |i| IPAddr.new(i).ipv6? } }
306
316
  else
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # Author:: Jonathan Hartman (<j@p4nt5.com>)
4
4
  #
5
- # Copyright (C) 2013, Jonathan Hartman
5
+ # Copyright (C) 2013-2015, Jonathan Hartman
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License");
8
8
  # you may not use this file except in compliance with the License.
@@ -21,6 +21,6 @@ module Kitchen
21
21
  #
22
22
  # @author Jonathan Hartman <j@p4nt5.com>
23
23
  module Driver
24
- OPENSTACK_VERSION = '1.8.0'
24
+ OPENSTACK_VERSION = '1.8.1'
25
25
  end
26
26
  end
@@ -34,6 +34,29 @@ describe Kitchen::Driver::Openstack do
34
34
  allow(File).to receive(:exist?).with(rsa).and_return(true)
35
35
  end
36
36
 
37
+ describe '#finalize_config' do
38
+ before(:each) { allow(File).to receive(:exist?).and_return(false) }
39
+
40
+ context 'both private and public key info provided' do
41
+ let(:config) do
42
+ { private_key_path: '/tmp/key', public_key_path: '/tmp/key.pub' }
43
+ end
44
+
45
+ it 'raises no error' do
46
+ expect(driver.finalize_config!(instance)).to be
47
+ end
48
+ end
49
+
50
+ context 'no key information provided provided' do
51
+ let(:config) { {} }
52
+
53
+ it 'raises an error' do
54
+ expected = Kitchen::UserError
55
+ expect { driver.finalize_config!(instance) }.to raise_error(expected)
56
+ end
57
+ end
58
+ end
59
+
37
60
  describe '#initialize'do
38
61
  context 'default options' do
39
62
  it 'uses the normal SSH status check' do
@@ -802,7 +825,7 @@ describe Kitchen::Driver::Openstack do
802
825
 
803
826
  it 'raises an exception' do
804
827
  expect { driver.send(:attach_ip_from_pool, server, pool) }.to \
805
- raise_error
828
+ raise_error(Kitchen::ActionFailed)
806
829
  end
807
830
  end
808
831
  end
@@ -944,7 +967,8 @@ describe Kitchen::Driver::Openstack do
944
967
 
945
968
  context 'no IP addresses whatsoever' do
946
969
  it 'raises an exception' do
947
- expect { driver.send(:get_ip, server) }.to raise_error
970
+ expected = Kitchen::ActionFailed
971
+ expect { driver.send(:get_ip, server) }.to raise_error(expected)
948
972
  end
949
973
  end
950
974
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-openstack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Hartman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-09 00:00:00.000000000 Z
11
+ date: 2015-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen
@@ -235,7 +235,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
235
235
  version: '0'
236
236
  requirements: []
237
237
  rubyforge_project:
238
- rubygems_version: 2.4.5
238
+ rubygems_version: 2.4.8
239
239
  signing_key:
240
240
  specification_version: 4
241
241
  summary: A Test Kitchen OpenStack Nova driver