kitchen-openstack 3.2.0 → 3.3.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: e830463daf8d4d150001659002c7ff5fa7c4c4de
4
- data.tar.gz: c13997f2c1b6ace249a892d02f34e5f9072a1b2e
3
+ metadata.gz: d66ce0ff71e2179911c7fa1b6537621df9807ac0
4
+ data.tar.gz: d1c8922782d6c668225bb025bbbadb49db017c89
5
5
  SHA512:
6
- metadata.gz: 4f4e9a1af44350c69f720ab08c04141a38460a4ade5d0515a3376e18271e3f8ca010dcd8a68afbf281ee89913a8f5654759c5e2c264624b04ad44055f1fae3a0
7
- data.tar.gz: 7c17dc8168d7ca657373d9ee09da2a25aea19be14caa1b456b92154059c609a57e9c3b209ba46e4bffe0fd44e550b380bea5f95f2aff2a90cd8cf25eec0919e1
6
+ metadata.gz: 4938e5b6b9ee42907c96afdb8440699c85dc61d8572d92371d40a1497a8bbe333502277bb9836e3b5b11a59ea0ea130b4ebc8230d0442d475abbb2bd3293e5af
7
+ data.tar.gz: 6dcd850d52c56601b4b77426cd45fdb7afc23992f0cd0a049cfd4886f2a648df5ae35aa420c0ddcdedc291bf380f81fd5cd0778ce8139022257c11ed3b7d3708
@@ -1,11 +1,19 @@
1
1
  # Change Log
2
2
 
3
- ## [v3.2.0](https://github.com/test-kitchen/kitchen-openstack/tree/v3.2.0)
3
+ ## [v3.3.0](https://github.com/test-kitchen/kitchen-openstack/tree/v3.3.0)
4
4
 
5
+ [Full Changelog](https://github.com/test-kitchen/kitchen-openstack/compare/v3.2.0...v3.3.0)
6
+
7
+ **Merged pull requests:**
8
+
9
+ - Uuids [\#159](https://github.com/test-kitchen/kitchen-openstack/pull/159) ([boc-tothefuture](https://github.com/boc-tothefuture))
10
+
11
+ ## [v3.2.0](https://github.com/test-kitchen/kitchen-openstack/tree/v3.2.0) (2017-03-02)
5
12
  [Full Changelog](https://github.com/test-kitchen/kitchen-openstack/compare/v3.1.0...v3.2.0)
6
13
 
7
14
  **Closed issues:**
8
15
 
16
+ - Expose excon timeouts to kitchen [\#157](https://github.com/test-kitchen/kitchen-openstack/issues/157)
9
17
  - Enhancement: generate openstack keypair on create [\#150](https://github.com/test-kitchen/kitchen-openstack/issues/150)
10
18
  - kitchen-openstack should use SSH Agent [\#149](https://github.com/test-kitchen/kitchen-openstack/issues/149)
11
19
  - Permission Denied on kitchen runs after first [\#146](https://github.com/test-kitchen/kitchen-openstack/issues/146)
@@ -14,6 +22,7 @@
14
22
 
15
23
  **Merged pull requests:**
16
24
 
25
+ - Prep for v3.2.0 [\#158](https://github.com/test-kitchen/kitchen-openstack/pull/158) ([jjasghar](https://github.com/jjasghar))
17
26
  - Expose excon timeout configuration [\#156](https://github.com/test-kitchen/kitchen-openstack/pull/156) ([MariusCC](https://github.com/MariusCC))
18
27
  - Dynamically allocate Floating IP for the test server. [\#155](https://github.com/test-kitchen/kitchen-openstack/pull/155) ([dannytrigo](https://github.com/dannytrigo))
19
28
  - Defer ssh key handling to transport. [\#154](https://github.com/test-kitchen/kitchen-openstack/pull/154) ([cliles](https://github.com/cliles))
data/README.md CHANGED
@@ -87,11 +87,23 @@ All of Fog's `openstack` options (`openstack_domain_name`, `openstack_project_na
87
87
 
88
88
  ### image\_ref
89
89
 
90
- **Required** Server Image ID.
90
+ **image_ref or image_id required** Server Image Name or ID.
91
+
92
+ ### image\_id
93
+
94
+ **image_ref or image_id required** Server Image ID. Specifying the ID instead of reference results in a faster create time.
95
+
96
+ **Note** If the image UUID changes this value will need to be updated.
91
97
 
92
98
  ### flavor\_ref
93
99
 
94
- **Required** Server Flavor ID.
100
+ **flavor_ref or flavor_id required** Server Flavor Name or ID.
101
+
102
+ ### flavor\_ref
103
+
104
+ **flavor_ref or flavor_id required** Server Flavor ID. Specifying the ID instead of reference results in a faster create time.
105
+
106
+ **Note** If the flavor UUID changes this value will need to be updated.
95
107
 
96
108
  ### server\_name
97
109
 
@@ -190,12 +202,24 @@ If your vms require config drive.
190
202
 
191
203
  ### network\_ref
192
204
 
193
- **Deprecated** A list of network names or ids to create instances with.
205
+ **Deprecated** A list of network names to create instances with.
206
+
207
+ ```yaml
208
+ network_ref:
209
+ - [OPENSTACK NETWORK NAMES]
210
+ - [CREATE INSTANCE WITH]
211
+ ```
212
+
213
+ ### network\_id
214
+
215
+ A list of network ids to create instances with. Specifying the id instead of reference results in a faster create time.
216
+
217
+ **Note** If the network UUID changes this value will need to be updated.
194
218
 
195
219
  ```yaml
196
220
  network_ref:
197
- - [OPENSTACK NETWORK NAMES OR...]
198
- - [...ID TO CREATE INSTANCE WITH]
221
+ - [OPENSTACK NETWORK UUIDs]
222
+ - [TO CREATE INSTANCE WITH]
199
223
  ```
200
224
 
201
225
  ### no\_ssh\_tcp\_check
@@ -51,6 +51,7 @@ module Kitchen
51
51
  default_config :availability_zone, nil
52
52
  default_config :security_groups, nil
53
53
  default_config :network_ref, nil
54
+ default_config :network_id, nil
54
55
  default_config :no_ssh_tcp_check, false
55
56
  default_config :no_ssh_tcp_check_sleep, 120
56
57
  default_config :glance_cache_wait_timeout, 600
@@ -166,7 +167,13 @@ module Kitchen
166
167
 
167
168
  def create_server
168
169
  server_def = init_configuration
169
- if config[:network_ref]
170
+ fail(ActionFailed, 'Cannot specify both network_ref and network_id') if config[:network_id] && config[:network_ref] # rubocop:disable Metrics/LineLength, SignalException
171
+ if config[:network_id]
172
+ networks = [].concat([config[:network_id]])
173
+ server_def[:nics] = networks.flatten.map do |net_id|
174
+ { 'net_id' => net_id }
175
+ end
176
+ elsif config[:network_ref]
170
177
  networks = [].concat([config[:network_ref]])
171
178
  server_def[:nics] = networks.flatten.map do |net|
172
179
  { 'net_id' => find_network(net).id }
@@ -193,10 +200,12 @@ module Kitchen
193
200
  end
194
201
 
195
202
  def init_configuration
203
+ fail(ActionFailed, 'Cannot specify both image_ref and image_id') if config[:image_id] && config[:image_ref] # rubocop:disable Metrics/LineLength, SignalException
204
+ fail(ActionFailed, 'Cannot specify both flavor_ref and flavor_id') if config[:flavor_id] && config[:flavor_ref] # rubocop:disable Metrics/LineLength, SignalException
196
205
  {
197
206
  name: config[:server_name],
198
- image_ref: find_image(config[:image_ref]).id,
199
- flavor_ref: find_flavor(config[:flavor_ref]).id,
207
+ image_ref: config[:image_id] || find_image(config[:image_ref]).id,
208
+ flavor_ref: config[:flavor_id] || find_flavor(config[:flavor_ref]).id,
200
209
  availability_zone: config[:availability_zone]
201
210
  }
202
211
  end
@@ -315,6 +324,7 @@ module Kitchen
315
324
  [pub, priv]
316
325
  end
317
326
 
327
+ # rubocop:disable AbcSize
318
328
  def get_ip(server)
319
329
  if config[:floating_ip]
320
330
  debug "Using floating ip: #{config[:floating_ip]}"
@@ -22,6 +22,6 @@ module Kitchen
22
22
  #
23
23
  # @author Jonathan Hartman <j@p4nt5.com>
24
24
  module Driver
25
- OPENSTACK_VERSION = '3.2.0'.freeze
25
+ OPENSTACK_VERSION = '3.3.0'.freeze
26
26
  end
27
27
  end
@@ -9,7 +9,6 @@ require 'rspec'
9
9
  require 'kitchen'
10
10
  require 'ohai'
11
11
 
12
- # rubocop: disable Metrics/BlockLength
13
12
  describe Kitchen::Driver::Openstack::Volume do
14
13
  let(:os) do
15
14
  {
@@ -15,7 +15,6 @@ require 'ohai'
15
15
  require 'excon'
16
16
  require 'fog'
17
17
 
18
- # rubocop: disable Metrics/BlockLength
19
18
  describe Kitchen::Driver::Openstack do
20
19
  let(:logged_output) { StringIO.new }
21
20
  let(:logger) { Logger.new(logged_output) }
@@ -92,7 +91,9 @@ describe Kitchen::Driver::Openstack do
92
91
  let(:config) do
93
92
  {
94
93
  image_ref: '22',
94
+ image_id: '4391b03e-f7fb-46fd-a356-fa5e42f6d728',
95
95
  flavor_ref: '33',
96
+ flavor_id: '19a2281e-591e-4b47-be06-631c3c7704e8',
96
97
  public_key_path: '/tmp',
97
98
  username: 'admin',
98
99
  port: '2222',
@@ -104,6 +105,7 @@ describe Kitchen::Driver::Openstack do
104
105
  floating_ip_pool: 'swimmers',
105
106
  floating_ip: '11111',
106
107
  network_ref: '0xCAFFE',
108
+ network_id: '57d6e41a-f369-4c92-9ebe-1fbf198bc783',
107
109
  use_ssh_agent: true,
108
110
  connect_timeout: 123,
109
111
  read_timeout: 234,
@@ -520,6 +522,78 @@ describe Kitchen::Driver::Openstack do
520
522
  end
521
523
  end
522
524
 
525
+ context 'image_id specified' do
526
+ let(:config) do
527
+ {
528
+ server_name: 'hello',
529
+ image_id: '1e1f4346-e3ea-48ba-9d1b-0002bfcb8981',
530
+ flavor_ref: '1'
531
+ }
532
+ end
533
+
534
+ it 'exact id match' do
535
+ expect(servers).to receive(:create).with(
536
+ name: 'hello',
537
+ image_ref: '1e1f4346-e3ea-48ba-9d1b-0002bfcb8981',
538
+ flavor_ref: '1',
539
+ availability_zone: nil
540
+ )
541
+ driver.send(:create_server)
542
+ end
543
+ end
544
+
545
+ context 'image_id and image_ref specified' do
546
+ let(:config) do
547
+ {
548
+ server_name: 'hello',
549
+ image_id: '1e1f4346-e3ea-48ba-9d1b-0002bfcb8981',
550
+ image_ref: '111',
551
+ flavor_ref: '1'
552
+ }
553
+ end
554
+
555
+ it 'raises an exception' do
556
+ expect { driver.send(:create_server) }.to \
557
+ raise_error(Kitchen::ActionFailed)
558
+ end
559
+ end
560
+
561
+ context 'flavor_id specified' do
562
+ let(:config) do
563
+ {
564
+ server_name: 'hello',
565
+ flavor_id: '1e1f4346-e3ea-48ba-9d1b-0002bfcb8981',
566
+ image_ref: '111'
567
+ }
568
+ end
569
+
570
+ it 'exact id match' do
571
+ expect(servers).to receive(:create).with(
572
+ name: 'hello',
573
+ flavor_ref: '1e1f4346-e3ea-48ba-9d1b-0002bfcb8981',
574
+ image_ref: '111',
575
+ availability_zone: nil
576
+ )
577
+ driver.send(:create_server)
578
+ end
579
+ end
580
+
581
+ context 'flavor_id and flavor_ref specified' do
582
+ let(:config) do
583
+ {
584
+ server_name: 'hello',
585
+ image_id: '1e1f4346-e3ea-48ba-9d1b-0002bfcb8981',
586
+ flavor_id: '1e1f4346-e3ea-48ba-9d1b-0002bfcb8981',
587
+ flavor_ref: '1'
588
+ }
589
+ end
590
+
591
+ it 'raises an exception' do
592
+ expect { driver.send(:create_server) }.to \
593
+ raise_error(Kitchen::ActionFailed)
594
+ end
595
+ end
596
+
523
597
  context 'image/flavor specifies id' do
524
598
  let(:config) do
525
599
  {
@@ -575,6 +649,46 @@ describe Kitchen::Driver::Openstack do
575
649
  end
576
650
  end
577
651
 
652
+ context 'network specifies network_id' do
653
+ let(:config) do
654
+ {
655
+ server_name: 'hello',
656
+ image_ref: '111',
657
+ flavor_ref: '1',
658
+ network_id: '0922b7aa-0a2f-4e68-8ff7-2886c4fc472d'
659
+ }
660
+ end
661
+
662
+ it 'exact id match' do
663
+ networks = [
664
+ { 'net_id' => '0922b7aa-0a2f-4e68-8ff7-2886c4fc472d' }
665
+ ]
666
+ expect(servers).to receive(:create).with(name: 'hello',
667
+ image_ref: '111',
668
+ flavor_ref: '1',
669
+ availability_zone: nil,
670
+ nics: networks)
671
+ driver.send(:create_server)
672
+ end
673
+ end
674
+
675
+ context 'network_id and network_ref specified' do
676
+ let(:config) do
677
+ {
678
+ server_name: 'hello',
679
+ image_id: '1e1f4346-e3ea-48ba-9d1b-0002bfcb8981',
680
+ flavor_id: '1e1f4346-e3ea-48ba-9d1b-0002bfcb8981',
681
+ network_id: '0922b7aa-0a2f-4e68-8ff7-2886c4fc472d',
682
+ network_ref: '1'
683
+ }
684
+ end
685
+
686
+ it 'raises an exception' do
687
+ expect { driver.send(:create_server) }.to \
688
+ raise_error(Kitchen::ActionFailed)
689
+ end
690
+ end
691
+
578
692
  context 'network specifies id' do
579
693
  let(:config) do
580
694
  {
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: 3.2.0
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Hartman
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-03-02 00:00:00.000000000 Z
12
+ date: 2017-03-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: test-kitchen