kitchen-softlayer 0.0.4 → 0.0.5

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: ff2b5f39f21a280384e2ce4d34577167122ed69b
4
- data.tar.gz: 0f7bfc6d310e7f2157cbc871af048926009771c5
3
+ metadata.gz: b2970baee9c2a2f9df34f646297aaaea4098166a
4
+ data.tar.gz: 39be4922d63ed46addb9437c664c0f73ee3eb884
5
5
  SHA512:
6
- metadata.gz: b35ee4c32f8f5f864899e95bf4532372d17e8d76089d3b11c12b8cf5e61646659dcbe0bf17cbc6f058720226421e001defa18246303032cb16bc3b5d2f295334
7
- data.tar.gz: e54599699ea0a656ebcfb232b9c77fb4b62c8dd2bb4cdb0525f5d20ae0849a6a9793b881e643528054240e67f68c6818a532b7e2e9114105a4bb013b02103511
6
+ metadata.gz: fd8e31927b71615585a9502298454735d9e48dbeccef8545d9b9514d8123b8a5431c4104670620dd5986c88b22b89189fcd227585242c94cca1f63f4177e2d0b
7
+ data.tar.gz: 4465cc309e97b46ed3580d25df07791dcc6a1bde2c569e72716c181f4def63f5c4bc1cc69ad263a5d2af6aed34c13cc2a2e5be16264c4f7a6036a10799f63898
data/README.md CHANGED
@@ -111,7 +111,7 @@ disk | nil | disk size
111
111
  flavor_id | nil | type of server i.e. m1.tiny
112
112
  bare_metal | false | server to be created on bare metal (takes longer)
113
113
  os_code | nil | softlayer's operating System Reference Code
114
- image_id | nil | image id for server
114
+ image_id | nil | image name or internal id
115
115
  ephemeral_storage | nil | storage
116
116
  network_components | nil | network
117
117
  ssh_timeout | 300 | timeout to ssh when server starting
@@ -127,12 +127,10 @@ private_network_only | false | if only a private network
127
127
  use_private_ip_with_public_network | false | otherwise uses public ip
128
128
  user_data | nil | user data for server
129
129
  uid | nil | softlayer global id
130
- vlan | nil | numeric id of private_vlan for server
130
+ vlan | nil | numeric id of vlan for server
131
131
  private_vlan | nil | numeric id of private_vlan for server
132
132
  provision_script | nil | url of provision script to run
133
133
 
134
- NOTE: provision_script parameter needs pull request [#73](https://github.com/fog/fog-softlayer/pull/73)
135
-
136
134
  ## Contributing
137
135
 
138
136
  1. Fork it
@@ -167,6 +167,37 @@ module Kitchen
167
167
  s
168
168
  end
169
169
 
170
+ def find_image(image_name)
171
+ id = nil
172
+ images = compute.images.all
173
+ images.each do |image|
174
+ if image.name == image_name
175
+ id = image.id
176
+ debug "Found public image #{id} for name #{image_name}"
177
+ end
178
+ end
179
+ images = compute.images.private
180
+ images.each do |image|
181
+ if image.name == image_name
182
+ id = image.id
183
+ debug "Found private image #{id} for name #{image_name}"
184
+ end
185
+ end
186
+ fail "No image found with name #{image_name}" if id.nil?
187
+ id
188
+ end
189
+
190
+ def find_network(vlan)
191
+ debug "Looking for network for vlan number #{vlan}"
192
+ response = network.list_networks
193
+ response.body.each do |r|
194
+ next unless r['vlanNumber'] == vlan
195
+ debug "Found network id #{r['id']} for vlan number #{r['vlanNumber']}"
196
+ return r['id']
197
+ end
198
+ fail "No network found for vlan number #{r['vlanNumber']}"
199
+ end
200
+
170
201
  def create_server
171
202
  server_def = init_configuration
172
203
  # TODO: figure out network options
@@ -222,6 +253,13 @@ module Kitchen
222
253
  case c
223
254
  when :user_data
224
255
  File.open(config[c]).read if File.exist?(config[c])
256
+ when :vlan
257
+ find_network(config[c])
258
+ when :private_vlan
259
+ find_network(config[c])
260
+ when :image_id
261
+ return config[c] if config[c].match('^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}')
262
+ find_image(config[c])
225
263
  else
226
264
  config[c]
227
265
  end
@@ -15,6 +15,6 @@
15
15
  module Kitchen
16
16
  # Version string for Softlayer Kitchen driver
17
17
  module Driver
18
- SOFTLAYER_VERSION = '0.0.4'
18
+ SOFTLAYER_VERSION = '0.0.5'
19
19
  end
20
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-softlayer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neill Turner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-16 00:00:00.000000000 Z
11
+ date: 2015-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen