kitchen-openstack 5.0.1 → 6.2.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
  SHA256:
3
- metadata.gz: ed10521f2bd0acc22db46ff87e0279f2d919fbd66ed6a6088e4825d8a75c5d84
4
- data.tar.gz: a0875746a6229f500b4c4e68e68f875527b1b5c90e0ab2616d79dc4035c2147f
3
+ metadata.gz: a54b200667def52dee3afc0ac1be2f58dbe082396fa6ee17833ac5d0a91d6bfd
4
+ data.tar.gz: 397fbc6af66ed869b827ac30014c42f6c41a90a386a4a77fcd76a660e921e06b
5
5
  SHA512:
6
- metadata.gz: d46edbaac847718f7e3a9559c6003f91703bc5fd67c5d4609eab25dc6a0e0e54b495da0293a0f97746862fc0f04ccec675bdc118c2d89973910925b43ad1d81d
7
- data.tar.gz: c4702f11e45567513496170e0283802929c5b7802186e6d3c14b80819130b1579231a59b263b4c3bfd3197cc5c5c6716c3dde032494d5e764626c05a279f6296
6
+ metadata.gz: 10b1f6ee9220f1c0724e0182392d00bd28806e80863d939f565921e5646da09ed681cba71a342da22c25f2bec8023699c9dab39c29a22cef8286eceb83bf645a
7
+ data.tar.gz: e05e7903c57e1c0b776fe4b751fed1bd596335b0ddf4ba0f0cee4f8ee1174a69c3e1b9f9b92ea8cd1f70adb877eee75d5943c39f6f022f1387e2144690705b5f
data/README.md CHANGED
@@ -1,9 +1,7 @@
1
1
  # <a name="title"></a> Kitchen::OpenStack: A Test Kitchen Driver for OpenStack
2
2
 
3
3
  [![Gem Version](https://img.shields.io/gem/v/kitchen-openstack.svg)][gem]
4
- [![Build Status](https://img.shields.io/travis/test-kitchen/kitchen-openstack.svg)][travis]
5
- [![Code Climate](https://img.shields.io/codeclimate/github/test-kitchen/kitchen-openstack.svg)][codeclimate]
6
- [![Coverage Status](https://img.shields.io/coveralls/test-kitchen/kitchen-openstack.svg)][coveralls]
4
+ ![CI](https://github.com/test-kitchen/kitchen-openstack/workflows/CI/badge.svg)
7
5
 
8
6
  A [Test Kitchen][kitchen_ci] Driver for [OpenStack][openstack_web].
9
7
 
@@ -21,6 +19,12 @@ There are **no** external system requirements for this driver. However you will
21
19
 
22
20
  ## Installation and Setup
23
21
 
22
+ This plugin ships out of the box with Chef Workstation, which is the easiest way to make sure you always have the latest testing dependencies in a single package.
23
+
24
+ [Download Chef Workstation](https://downloads.chef.io/tools/workstation) to get started
25
+
26
+ ### Manual Installation
27
+
24
28
  Add this line to your application's Gemfile:
25
29
 
26
30
  ```ruby
@@ -39,391 +43,9 @@ Or install it yourself as:
39
43
  $ gem install kitchen-openstack
40
44
  ```
41
45
 
42
- Or if using [chefdk][chefdk_dl] install with:
43
-
44
- ```bash
45
- $ chef gem install kitchen-openstack
46
- ```
47
-
48
- ## Minimum Configuration
49
-
50
- ```yaml
51
- driver:
52
- name: openstack
53
- openstack_username: [YOUR OPENSTACK USERNAME]
54
- openstack_api_key: [YOUR OPENSTACK API KEY] # AKA your OpenStack Password
55
- openstack_auth_url: [YOUR OPENSTACK AUTH URL] # if you are using v3, API_URL/v3/auth/tokens
56
- openstack_domain_id: [default is 'default'; otherwise YOUR OPENSTACK DOMAIN ID]
57
- require_chef_omnibus: [e.g. 'true' or a version number if you need Chef]
58
- image_ref: [SERVER IMAGE ID]
59
- flavor_ref: [SERVER FLAVOR ID]
60
- transport:
61
- username: ubuntu # For a Ubuntu Box
62
- ```
63
-
64
- The `image_ref` and `flavor_ref` options can be specified as an exact id,
65
- an exact name, or as a regular expression matching the name of the image or flavor.
66
-
67
- All of Fog's `openstack` options (`openstack_domain_name`, `openstack_project_name`,
68
- ...) are supported. This includes support for the OpenStack Identity v3 API.
69
-
70
- ## General Configuration
71
-
72
- ### name
73
-
74
- **Required** Tell test-kitchen what driver to use. ;)
75
-
76
- ### openstack\_username
77
-
78
- **Required** Your OpenStack username.
79
-
80
- ### openstack\_api\_key
81
-
82
- **Required** Your OpenStack API Key, aka your OpenStack password.
83
-
84
- ### openstack\_auth\_url
85
-
86
- **Required** Your OpenStack auth url. If you are using ID v3, you'll need to use `API_URL/v3/auth/tokens`.
87
-
88
- ### require\_chef_omnibus
89
-
90
- **Required** Set to `true` otherwise the specific version of Chef omnibus you want installed.
91
-
92
- ### image\_ref
93
-
94
- **image_ref or image_id required** Server Image Name or ID.
95
-
96
- ### image\_id
97
-
98
- **image_ref or image_id required** Server Image ID. Specifying the ID instead of reference results in a faster create time.
99
-
100
- **Note** If the image UUID changes this value will need to be updated.
101
-
102
- ### flavor\_ref
103
-
104
- **flavor_ref or flavor_id required** Server Flavor Name or ID.
105
-
106
- ### flavor\_ref
107
-
108
- **flavor_ref or flavor_id required** Server Flavor ID. Specifying the ID instead of reference results in a faster create time.
109
-
110
- **Note** If the flavor UUID changes this value will need to be updated.
111
-
112
- ### server\_name
113
-
114
- If a `server_name_prefix` is specified then this prefix will be used when
115
- generating random names of the form `<NAME PREFIX>-<RANDOM STRING>` e.g.
116
- `myproject-asdfghjk`. If both `server_name_prefix` and `server_name` are
117
- specified then the `server_name` takes precedence.
118
-
119
- ### server\_name\_prefix
120
-
121
- If you want to have a static prefix for a random server name.
122
-
123
- ### port
124
-
125
- Set the SSH port for the remote access.
126
-
127
- ### openstack\_tenant
128
-
129
- Your OpenStack tenant id.
130
-
131
- ### openstack\_region
132
-
133
- Your OpenStack region id.
134
-
135
- ### availability\_zone
136
-
137
- Your OpenStack availablity zone.
138
-
139
- ### openstack\_service\_name
140
-
141
- Your OpenStack compute service name.
142
-
143
- ### openstack\_network\_name
144
-
145
- Your OpenStack network name used to connect to, if you have only private network
146
- connections you want declare this.
147
-
148
- ### glance\_cache\_wait\_timeout
149
- When OpenStack downloads the image into cache, it takes extra time to provision. Timeout controls maximum amount of time to wait for machine to move from the Build/Spawn phase to Active.
150
-
151
- ### connect\_timeout
152
- Connect timeout controls maximum amount of time to wait for machine to respond to ssh login request.
153
-
154
- ### read\_timeout
155
- ### write\_timeout
156
- Expose read/write timeout parameters passed down to HTTP connection created via [excon](https://github.com/excon/excon). Default timeouts (from excon) are 60 seconds.
157
-
158
- ### server\_wait
159
-
160
- `server_wait` is a workaround to deal with how some VMs with `cloud-init`.
161
- Some clouds need this some, most OpenStack instances don't. This is a stop gap
162
- wait makes sure that the machine is in a good state to work with. Ideally the
163
- transport layer in Test-Kitchen will have a more intelligent way to deal with this.
164
- There will be a dot that appears every 10 seconds as the timer counts down.
165
- You may want to add this for **WinRM** instances due to the multiple restarts that
166
- happen on creation and boot. A good default is `300` seconds to make sure it's
167
- in a good state.
168
-
169
- The default is `0`.
170
-
171
- ### security\_groups
172
-
173
- A list of `security_groups` to join:
174
-
175
- ```yaml
176
- security_groups:
177
- - [A LIST OF...]
178
- - [...SECURITY GROUPS TO JOIN]
179
- ```
180
-
181
- ### user\_data
182
-
183
- If your vms have `cloud-init` enabled you can use the `user_data` in your
184
- kitchen.yml to inject commands at boot time.
185
-
186
- ```
187
- driver_config:
188
- user_data: userdata.txt
189
- ```
190
-
191
- Then create a `userdata.txt` in the same directory as your .kitchen.yml,
192
- for example:
193
-
194
- ```
195
- #!/bin/sh
196
- echo "do whatever you want to pre-configure your machine"
197
- ```
198
-
199
- ### config\_drive
200
-
201
- If your vms require config drive.
202
-
203
- ```
204
- config_drive: true
205
- ```
206
-
207
- ### network\_ref
208
-
209
- **Deprecated** A list of network names to create instances with.
210
-
211
- ```yaml
212
- network_ref:
213
- - [OPENSTACK NETWORK NAMES]
214
- - [CREATE INSTANCE WITH]
215
- ```
216
-
217
- ### network\_id
218
-
219
- A list of network ids to create instances with. Specifying the id instead of reference results in a faster create time.
220
-
221
- **Note** If the network UUID changes this value will need to be updated.
222
-
223
- ```yaml
224
- network_ref:
225
- - [OPENSTACK NETWORK UUIDs]
226
- - [TO CREATE INSTANCE WITH]
227
- ```
228
-
229
- ### no\_ssh\_tcp\_check
230
-
231
- **Deprecated** You should be using transport now. This will skip the ssh check to automatically connect.
232
-
233
- The default is `false`.
234
-
235
- ### no\_ssh\_tcp\_check\_sleep
236
-
237
- **Deprecated** You should be using transport now. This will sleep for so many seconds. `no_ssh_tcp_check` needs
238
- to be set to `true`.
239
-
240
- ### private\_key\_path
241
-
242
- **Deprecated** You should be using transport now. The guest image should use `cloud-init` or some other method to fetch key from meta-data service.
243
-
244
- ### public\_key\_path
245
-
246
- **Deprecated** You should be using transport now. The guest image should use `cloud-init` or some other method to fetch key from meta-data service.
247
-
248
- ## Disk Configuration
249
-
250
- ### <a name="config-block_device_mapping"></a> block\_device\_mapping
251
-
252
- #### make\_volume
253
-
254
- Makes a new volume when set to `true`.
255
-
256
- The default is `false`.
257
-
258
- #### snapshot\_id
259
-
260
- When set, will make a volume from that snapshot id.
261
-
262
- #### volume\_id
263
-
264
- When set, will attach the volume id.
265
-
266
- #### device\_name
267
-
268
- Set this to `vda` unless you really know what you are doing.
269
-
270
- #### availability\_zone
271
-
272
- The block storage availability zone.
273
-
274
- The default is `nova`.
275
-
276
- #### volume\_type
277
-
278
- The volume type, this is optional.
279
-
280
- #### delete\_on\_termination
281
-
282
- This will delete the volume on the instance when `destroy` happens, if set to true.
283
- Otherwise set this to `false`.
284
-
285
- #### creation\_timeout
286
- Timeout to wait for volume to become available. If a large volume is provisioned, it might take time to provision it on the backend. Maximum amount of time to wait for volume to be created and be available.
287
-
288
- #### attach\_timeout
289
- If using a customized version of Openstack such a VMWare Integrated OPenstack (VIO), it may mark a volume active even though it is still performing some actions which may cause test kitchen to attach the volume to early which results in errors. Specify in seconds the amount of time to delay attaching the volume after its been marked active. Default timeout is 0.
290
-
291
- #### Example
292
-
293
- ```yaml
294
- block_device_mapping:
295
- make_volume: true
296
- snapshot_id: 00000-111111-0000222-000
297
- device_name: vda
298
- availability_zone: nova
299
- delete_on_termination: false
300
- creation_timeout: 120
301
- attach_timeout: 240
302
- ```
303
-
304
- ## Network and Communication Configuration
305
-
306
- ### floating\_ip
307
-
308
- A specific `floating_ip` can be provided to bind a floating IP to the node.
309
- Any floating IP will be the IP used for Test Kitchen's Remote calls to the node.
310
-
311
- ### floating\_ip\_pool
312
-
313
- A `floating_ip_pool` can be provided to allocate a floating IP from
314
- the pool to the instance. If `allocate_floating_ip` is true, the IP will be allocated,
315
- otherwise the first free floating IP will be used. It will be the IP used for
316
- Test Kitchen's Remote calls to the node. If allocated, the floating IP will be
317
- released once the instance is destroyed.
318
-
319
- ### allocate\_floating\_ip
320
-
321
- If true, allocate a new IP from the specified `floating_ip_pool` and release is afterwards.
322
- Otherwise, if false (the default), an existing allocated IP.
323
-
324
- ### \[public\|private\]\_ip\_order
325
-
326
- In some complex network scenarios you can have several IP addresses designated
327
- as public or private. Use `public_ip_order` or `private_ip_order` to control
328
- which one to use for further SSH connection. Default is 0 (first one)
329
-
330
- For example if you have openstack istance that has network with several IPs assigned like
331
-
332
- ```
333
- +--------------------------------------+------------+--------+------------+-------------+----------------------------------+
334
- | ID | Name | Status | Task State | Power State | Networks |
335
- +--------------------------------------+------------+--------+------------+-------------+----------------------------------+
336
- | 31c98de4-026f-4d12-b03f-a8a35c6e730b | kitchen | ACTIVE | None | Running | test=10.0.0.1, 10.0.1.1 |
337
-
338
- ```
339
-
340
- to use second `10.0.1.1` IP address you need to specify
46
+ ## Usage
341
47
 
342
- ```yaml
343
- private_ip_order: 1
344
- ```
345
- assuming that test network is configured as private.
346
-
347
- ### use_ipv6
348
-
349
- If true use IPv6 addresses to for SSH connections. If false, the default, use
350
- IPv4 addresses for SSH connections.
351
-
352
- ### network\_ref
353
-
354
- The `network_ref` option can be specified as an exact id, an exact name,
355
- or as a regular expression matching the name of the network. You can pass one
356
-
357
- ```yaml
358
- network_ref: MYNET1
359
- ```
360
-
361
- or many networks
362
-
363
- ```yaml
364
- network_ref:
365
- - MYNET1
366
- - MYNET2
367
- ```
368
-
369
- The `openstack_network_name` is used to select IP address for SSH connection.
370
- It's recommended to specify this option in case of multiple networks used for
371
- instance to provide more control over network connectivity.
372
-
373
- Please note that `network_ref` relies on Network Services (`Fog::Network`) and
374
- it can be unavailable in your OpenStack installation.
375
-
376
-
377
- ### disable\_ssl\_validation
378
-
379
- ```yaml
380
- disable_ssl_validation: true
381
- ```
382
-
383
- Only disable SSL cert validation if you absolutely know what you are doing,
384
- but are stuck with an OpenStack deployment without valid SSL certs.
385
-
386
- ## Example
387
-
388
- The following could be used in a `.kitchen.yml` or in a `.kitchen.local.yml`
389
- to override default configuration.
390
-
391
- ```yaml
392
- ---
393
- driver:
394
- name: openstack
395
- openstack_username: [YOUR OPENSTACK USERNAME]
396
- openstack_api_key: [YOUR OPENSTACK API KEY] # AKA your OPENSTACK PASSWORD
397
- openstack_auth_url: [YOUR OPENSTACK AUTH URL]
398
- openstack_domain_id: [default is 'default'; otherwise YOUR OPENSTACK DOMAIN ID]
399
- require_chef_omnibus: [e.g. 'true' or a version number if you need Chef]
400
- image_ref: [SERVER IMAGE ID]
401
- flavor_ref: [SERVER FLAVOR ID]
402
- key_name: [KEY NAME]
403
- read_timeout: 180
404
- write_timeout: 180
405
- connect_timeout: 180
406
-
407
- transport:
408
- ssh_key: /path/to/id_rsa #Path to private key that matches the above openstack key_name
409
- connection_timeout: 10
410
- connection_retries: 5
411
- username: ubuntu
412
- password: mysecreatpassword
413
-
414
- platforms:
415
- - name: ubuntu-14.04
416
- - name: ubuntu-15.04
417
- - name: centos-7
418
- transport:
419
- username: centos
420
- - name: windows-2012r2
421
- transport:
422
- password: myadministratorpassword
423
-
424
- suites:
425
- # ...
426
- ```
48
+ See https://kitchen.ci/docs/drivers/openstack/ for documentation.
427
49
 
428
50
  ## <a name="development"></a> Development
429
51
 
@@ -452,10 +74,6 @@ Apache 2.0 (see [LICENSE][license])
452
74
 
453
75
 
454
76
  [gem]: https://rubygems.org/gems/kitchen-openstack
455
- [travis]: https://travis-ci.org/test-kitchen/kitchen-openstack
456
- [codeclimate]: https://codeclimate.com/github/test-kitchen/kitchen-openstack
457
- [coveralls]: https://coveralls.io/r/test-kitchen/kitchen-openstack
458
- [gemnasium]: https://gemnasium.com/test-kitchen/kitchen-openstack
459
77
 
460
78
  [author]: https://github.com/RoboticCheese
461
79
  [maintainer]: https://github.com/jjasghar
@@ -463,8 +81,7 @@ Apache 2.0 (see [LICENSE][license])
463
81
  [license]: https://github.com/test-kitchen/kitchen-openstack/blob/master/LICENSE.txt
464
82
  [repo]: https://github.com/test-kitchen/kitchen-openstack
465
83
  [driver_usage]: https://github.com/test-kitchen/kitchen-openstack
466
- [chef_omnibus_dl]: http://www.chef.io/chef/install/
467
- [chefdk_dl]: https://downloads.chef.io/chef-dk
84
+ [chef_omnibus_dl]: https://downloads.chef.io/tools/infra-client
468
85
  [kitchen_ci]: http://kitchen.ci
469
86
 
470
87
  [openstack_web]: http://www.openstack.org
@@ -1,4 +1,3 @@
1
- # Encoding: UTF-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  #
@@ -1,4 +1,3 @@
1
- # Encoding: UTF-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  #
@@ -22,7 +21,8 @@
22
21
 
23
22
  require "kitchen"
24
23
  require "fog/openstack"
25
- require "ohai"
24
+ require "ohai" unless defined?(Ohai::System)
25
+ require "yaml"
26
26
  require_relative "openstack_version"
27
27
  require_relative "openstack/volume"
28
28
 
@@ -82,14 +82,16 @@ module Kitchen
82
82
  disable_ssl_validation if config[:disable_ssl_validation]
83
83
  server = create_server
84
84
  state[:server_id] = server.id
85
- info "OpenStack instance with ID of <#{state[:server_id]}> is ready."
86
85
 
87
86
  # this is due to the glance_caching issues. Annoying yes, but necessary.
88
- debug "Waiting for VM to be in ACTIVE state for a max time of:#{config[:glance_cache_wait_timeout]} seconds"
87
+ debug "Waiting for a max time of:#{config[:glance_cache_wait_timeout]} seconds for OpenStack server to be in ACTIVE state"
89
88
  server.wait_for(config[:glance_cache_wait_timeout]) do
90
89
  sleep(1)
90
+ raise(Kitchen::InstanceFailure, "OpenStack server ID <#{state[:server_id]}> build failed to ERROR state") if failed?
91
+
91
92
  ready?
92
93
  end
94
+ info "OpenStack server ID <#{state[:server_id]}> created"
93
95
 
94
96
  if config[:floating_ip]
95
97
  attach_ip(server, config[:floating_ip])
@@ -201,6 +203,12 @@ module Kitchen
201
203
  server_def[c] = optional_config(c) if config[c]
202
204
  end
203
205
 
206
+ if config[:cloud_config]
207
+ raise(ActionFailed, "Cannot specify both cloud_config and user_data") if config[:user_data]
208
+
209
+ server_def[:user_data] = Kitchen::Util.stringified_hash(config[:cloud_config]).to_yaml.gsub(/^---\n/, "#cloud-config\n")
210
+ end
211
+
204
212
  # Can't use the Fog bootstrap and/or setup methods here; they require a
205
213
  # public IP address that can't be guaranteed to exist across all
206
214
  # OpenStack deployments (e.g. TryStack ARM only has private IPs).
@@ -412,7 +420,7 @@ module Kitchen
412
420
  end
413
421
 
414
422
  def disable_ssl_validation
415
- require "excon"
423
+ require "excon" unless defined?(Excon)
416
424
  Excon.defaults[:ssl_verify_peer] = false
417
425
  end
418
426
 
@@ -442,7 +450,7 @@ module Kitchen
442
450
  if name.start_with?("/") && name.end_with?("/")
443
451
  regex = Regexp.new(name[1...-1])
444
452
  # check for regex name match
445
- collection.each { |single| return single if regex =~ single.name }
453
+ collection.each { |single| return single if regex&.match?(single.name) }
446
454
  else
447
455
  # check for exact id match
448
456
  collection.each { |single| return single if single.id == name }
@@ -1,11 +1,10 @@
1
- # Encoding: UTF-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  #
5
4
  # Author:: Jonathan Hartman (<j@p4nt5.com>)
6
5
  #
7
6
  # Copyright (C) 2013-2015, Jonathan Hartman
8
- # Copyright (C) 2015-2020, Chef Software Inc
7
+ # Copyright (C) 2015-2021, Chef Software Inc
9
8
  #
10
9
  # Licensed under the Apache License, Version 2.0 (the "License");
11
10
  # you may not use this file except in compliance with the License.
@@ -24,6 +23,6 @@ module Kitchen
24
23
  #
25
24
  # @author Jonathan Hartman <j@p4nt5.com>
26
25
  module Driver
27
- OPENSTACK_VERSION = "5.0.1"
26
+ OPENSTACK_VERSION = "6.2.0"
28
27
  end
29
28
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-openstack
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.1
4
+ version: 6.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Hartman
8
8
  - JJ Asghar
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-04-09 00:00:00.000000000 Z
12
+ date: 2022-06-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: test-kitchen
@@ -20,7 +20,7 @@ dependencies:
20
20
  version: 1.4.1
21
21
  - - "<"
22
22
  - !ruby/object:Gem::Version
23
- version: '3'
23
+ version: '4'
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
@@ -30,7 +30,7 @@ dependencies:
30
30
  version: 1.4.1
31
31
  - - "<"
32
32
  - !ruby/object:Gem::Version
33
- version: '3'
33
+ version: '4'
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: fog-openstack
36
36
  requirement: !ruby/object:Gem::Requirement
@@ -159,7 +159,7 @@ homepage: https://github.com/test-kitchen/kitchen-openstack
159
159
  licenses:
160
160
  - Apache-2.0
161
161
  metadata: {}
162
- post_install_message:
162
+ post_install_message:
163
163
  rdoc_options: []
164
164
  require_paths:
165
165
  - lib
@@ -167,15 +167,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
167
167
  requirements:
168
168
  - - ">="
169
169
  - !ruby/object:Gem::Version
170
- version: 2.0.0
170
+ version: 2.6.0
171
171
  required_rubygems_version: !ruby/object:Gem::Requirement
172
172
  requirements:
173
173
  - - ">="
174
174
  - !ruby/object:Gem::Version
175
175
  version: '0'
176
176
  requirements: []
177
- rubygems_version: 3.1.2
178
- signing_key:
177
+ rubygems_version: 3.2.3
178
+ signing_key:
179
179
  specification_version: 4
180
180
  summary: A Test Kitchen OpenStack Nova driver
181
181
  test_files: []