kitchen-google 2.1.0 → 2.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: dfd4ade3df944044cc61c6c64f41c3b7f41493efd8a6024751c6bf52a5d468c8
4
- data.tar.gz: 45998c3ff751583c50ebe770cc9f1bd29ad4c190ecbdd90d6c4055131f4e8df9
3
+ metadata.gz: 684c38ac157c082d70153c97229db2b95dc29ff27e1ac52d5e150a4a014d02ff
4
+ data.tar.gz: ddc7a786e39fe48540c6f175c641fa3c49cf0a0705badb62fd5bd3632e7f11d9
5
5
  SHA512:
6
- metadata.gz: c1510d83ac112662bb2c0e6573df8e19e07e5b2f2afdd110e52f3addd02d3b6fe7e9452b703c5998249f1b310a13730b8fc661b8bdc3787c6e3986e8cb2ad7f1
7
- data.tar.gz: 9bab8a5f721cc7ca72f46ad69a0e274fed394ff7954ea0f1c1c88386108da2b81f396458449f68ee54d8bcf8dc405d4284e0750a854e829715b6421307e91b78
6
+ metadata.gz: f35f7af9b6c1b98aed559a8e2824a16ce78110d96584d7f06f93fbee96a04fbea3448689210ab13ae88d7cea607fd4ee57e2b3a445e418596b2948bf9be49f78
7
+ data.tar.gz: b97674af3911f920142dc1b6672a60686ede8c9cc310e522be391194409bf897e8dd7a03738917440143d2207029fc9efe800cb719375e128780f0c473a02a6b
@@ -334,8 +334,8 @@ module Kitchen
334
334
  disk_name.to_s.match(DISK_NAME_REGEX).to_s.length == disk_name.length
335
335
  end
336
336
 
337
- def image_exist?
338
- check_api_call { connection.get_image(image_project, image_name) }
337
+ def image_exist?(image = image_name)
338
+ check_api_call { connection.get_image(image_project, image) }
339
339
  end
340
340
 
341
341
  def server_exist?(server_name)
@@ -428,11 +428,7 @@ module Kitchen
428
428
  end
429
429
 
430
430
  def generate_server_name
431
- name = if config[:inst_name]
432
- config[:inst_name]
433
- else
434
- "tk-#{instance.name.downcase}-#{SecureRandom.hex(3)}"
435
- end
431
+ name = config[:inst_name] || "tk-#{instance.name.downcase}-#{SecureRandom.hex(3)}"
436
432
 
437
433
  if name.length > 63
438
434
  warn("The TK instance name (#{instance.name}) has been removed from the GCE instance name due to size limitations. Consider setting shorter platform or suite names.")
@@ -444,13 +440,12 @@ module Kitchen
444
440
 
445
441
  def create_disks(server_name)
446
442
  disks = []
447
-
448
443
  config[:disks].each do |disk_name, disk_config|
449
444
  unique_disk_name = "#{server_name}-#{disk_name}"
450
445
  if disk_config[:boot]
451
446
  disk = create_local_disk(unique_disk_name, disk_config)
452
447
  disks.unshift(disk)
453
- elsif disk_config[:disk_type] == "local-ssd"
448
+ elsif (disk_config[:disk_type] == "local-ssd") || disk_config[:custom_image]
454
449
  disk = create_local_disk(unique_disk_name, disk_config)
455
450
  disks.push(disk)
456
451
  else
@@ -473,10 +468,15 @@ module Kitchen
473
468
  if disk_config[:disk_type] == "local-ssd"
474
469
  info("Creating a 375 GB local ssd as scratch disk (https://cloud.google.com/compute/docs/disks/#localssds).")
475
470
  disk.type = "SCRATCH"
476
- else
477
- info("Creating a #{disk_config[:disk_size]} GB boot disk named #{unique_disk_name}...")
471
+ elsif disk.boot
472
+ info("Creating a #{disk_config[:disk_size]} GB boot disk named #{unique_disk_name} from image #{image_name}...")
478
473
  params.source_image = boot_disk_source_image unless disk_config[:disk_type] == "local-ssd"
479
474
  params.disk_name = unique_disk_name unless disk_config[:disk_type] == "local-ssd"
475
+ else
476
+ info("Creating a #{disk_config[:disk_size]} GB extra disk named #{unique_disk_name} from image #{disk_config[:custom_image]}...")
477
+ params.source_image = image_url(disk_config[:custom_image]) unless disk_config[:disk_type] == "local-ssd"
478
+ params.disk_name = unique_disk_name unless disk_config[:disk_type] == "local-ssd"
479
+
480
480
  end
481
481
  disk.initialize_params = params
482
482
  disk
@@ -524,8 +524,8 @@ module Kitchen
524
524
  @boot_disk_source ||= image_url
525
525
  end
526
526
 
527
- def image_url
528
- return "projects/#{image_project}/global/images/#{image_name}" if image_exist?
527
+ def image_url(image = image_name)
528
+ return "projects/#{image_project}/global/images/#{image}" if image_exist?(image)
529
529
  end
530
530
 
531
531
  def image_name_for_family(image_family)
@@ -18,6 +18,6 @@
18
18
 
19
19
  module Kitchen
20
20
  module Driver
21
- GCE_VERSION = "2.1.0".freeze
21
+ GCE_VERSION = "2.2.0".freeze
22
22
  end
23
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-google
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Leonard
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-11-20 00:00:00.000000000 Z
12
+ date: 2021-01-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gcewinpass
@@ -32,9 +32,9 @@ dependencies:
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: 0.23.9
35
- - - "<"
35
+ - - "<="
36
36
  - !ruby/object:Gem::Version
37
- version: 0.37.0
37
+ version: 0.52.0
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,9 +42,9 @@ dependencies:
42
42
  - - ">="
43
43
  - !ruby/object:Gem::Version
44
44
  version: 0.23.9
45
- - - "<"
45
+ - - "<="
46
46
  - !ruby/object:Gem::Version
47
- version: 0.37.0
47
+ version: 0.52.0
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: test-kitchen
50
50
  requirement: !ruby/object:Gem::Requirement
@@ -152,7 +152,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
152
152
  requirements:
153
153
  - - ">="
154
154
  - !ruby/object:Gem::Version
155
- version: '2.3'
155
+ version: '2.4'
156
156
  required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  requirements:
158
158
  - - ">="