kitchen-openstack 0.2.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # 0.4.0 / 2013-06-06
2
+
3
+ ### New Features
4
+
5
+ * PR [#12][] - Support `openstack_network_name` option; via [@saketoba][]
6
+ * PR [#11][] - Support `ssh_key` option; via [@saketoba][]
7
+
1
8
  # 0.2.0 / 2013-05-11
2
9
 
3
10
  ### Bug Fixes
@@ -18,9 +25,12 @@
18
25
 
19
26
  * Initial release! Woo!
20
27
 
28
+ [#12]: https://github.com/RoboticCheese/kitchen-openstack/pull/12
29
+ [#11]: https://github.com/RoboticCheese/kitchen-openstack/pull/11
21
30
  [#10]: https://github.com/RoboticCheese/kitchen-openstack/pull/10
22
31
  [#9]: https://github.com/RoboticCheese/kitchen-openstack/pull/9
23
32
  [#7]: https://github.com/RoboticCheese/kitchen-openstack/pull/7
24
33
  [#2]: https://github.com/RoboticCheese/kitchen-openstack/pull/2
25
34
 
35
+ [@saketoba]: https://github.com/saketoba
26
36
  [@stevendanna]: https://github.com/stevendanna
data/README.md CHANGED
@@ -39,6 +39,7 @@ key will be used, though that behavior can be overridden with additional
39
39
  options:
40
40
 
41
41
  name: [A UNIQUE SERVER NAME]
42
+ ssh_key: [PATH TO YOUR PRIVATE SSH KEY]
42
43
  public_key_path: [PATH TO YOUR SSH PUBLIC KEY]
43
44
  username: [SSH USER]
44
45
  port: [SSH PORT]
@@ -46,6 +47,7 @@ options:
46
47
  openstack_tenant: [YOUR OPENSTACK TENANT ID]
47
48
  openstack_region: [A VALID OPENSTACK REGION]
48
49
  openstack_service_name: [YOUR OPENSTACK COMPUTE SERVICE NAME]
50
+ openstack_network_name: [YOUR OPENSTACK NETWORK NAME]
49
51
 
50
52
  If a key\_name is provided it will be used instead of any
51
53
  public\_key\_path that is specified.
@@ -35,6 +35,7 @@ module Kitchen
35
35
  default_config :openstack_tenant, nil
36
36
  default_config :openstack_region, nil
37
37
  default_config :openstack_service_name, nil
38
+ default_config :openstack_network_name, nil
38
39
 
39
40
  def create(state)
40
41
  config[:name] ||= generate_name(instance.name)
@@ -47,7 +48,9 @@ module Kitchen
47
48
  # As a consequence of IP weirdness, the OpenStack setup() method is
48
49
  # also borked
49
50
  wait_for_sshd(state[:hostname]) ; puts '(ssh ready)'
50
- config[:key_name] or do_ssh_setup(state, config, server)
51
+ unless config[:ssh_key] or config[:key_name]
52
+ do_ssh_setup(state, config, server)
53
+ end
51
54
  rescue Fog::Errors::Error, Excon::Errors::Error => ex
52
55
  raise ActionFailed, ex.message
53
56
  end
@@ -101,7 +104,9 @@ module Kitchen
101
104
  end
102
105
 
103
106
  def get_ip(server)
104
- if server.addresses['public'] and !server.addresses['public'].empty?
107
+ if config[:openstack_network_name]
108
+ return server.addresses[config[:openstack_network_name]].first['addr']
109
+ elsif server.addresses['public'] and !server.addresses['public'].empty?
105
110
  # server.public_ip_address stopped working in Fog 1.10.0
106
111
  return server.addresses['public'].first['addr']
107
112
  else
@@ -19,7 +19,7 @@
19
19
  module Kitchen
20
20
  module Driver
21
21
  # Version string for OpenStack Kitchen driver
22
- OPENSTACK_VERSION = '0.2.0'
22
+ OPENSTACK_VERSION = '0.4.0'
23
23
  end
24
24
  end
25
25
 
@@ -78,7 +78,8 @@ describe Kitchen::Driver::Openstack do
78
78
  :name => 'puppy',
79
79
  :openstack_tenant => 'that_one',
80
80
  :openstack_region => 'atlantis',
81
- :openstack_service_name => 'the_service'
81
+ :openstack_service_name => 'the_service',
82
+ :ssh_key => '/path/to/id_rsa'
82
83
  }
83
84
  end
84
85
 
@@ -88,6 +89,10 @@ describe Kitchen::Driver::Openstack do
88
89
  expect(drv[k]).to eq(v)
89
90
  end
90
91
  end
92
+
93
+ it 'SSH with user-specified private key' do
94
+ expect(driver[:ssh_key]).to eq('/path/to/id_rsa')
95
+ end
91
96
  end
92
97
  end
93
98
 
@@ -366,6 +371,21 @@ describe Kitchen::Driver::Openstack do
366
371
  expect(driver.send(:get_ip, server)).to eq('5.5.5.5')
367
372
  end
368
373
  end
374
+
375
+ context 'IPs in user-defined network group' do
376
+ let(:config) { { :openstack_network_name => 'mynetwork' } }
377
+ let(:addresses) do
378
+ {
379
+ 'mynetwork' => [
380
+ { 'addr' => '7.7.7.7' },
381
+ { 'addr' => '8.8.8.8' }
382
+ ]
383
+ }
384
+ end
385
+ it 'returns a IP in user-defined network group' do
386
+ expect(driver.send(:get_ip, server)).to eq('7.7.7.7')
387
+ end
388
+ end
369
389
  end
370
390
 
371
391
  describe '#do_ssh_setup' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-openstack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-11 00:00:00.000000000 Z
12
+ date: 2013-06-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: test-kitchen
@@ -186,3 +186,4 @@ summary: A Test Kitchen OpenStack Nova driver
186
186
  test_files:
187
187
  - spec/kitchen/driver/openstack_spec.rb
188
188
  - spec/spec_helper.rb
189
+ has_rdoc: