knife-google 4.2.6 → 5.0.2

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: ffac7bed4b5402a8122a5b406e745e8f224af07bde6d5d2081d99227971f39e2
4
- data.tar.gz: dfd93920997548e4c3412d8608479ea6f7d165cd503b5172130950cc274ed0c1
3
+ metadata.gz: f84e87e7003515b486193242d5518df11a8af14e1c087b5385917a2612fa571c
4
+ data.tar.gz: 2e0275e7f3fd9897aa60028dc8f9ba0235a3ce55e4a41446c0ed5be5b077f9b3
5
5
  SHA512:
6
- metadata.gz: 475f550113eea3fee7f3b1c6b210ede9153198737b4ace8e25f71b4453db770dd52d9edf443b187ae9f14b43e41b03d7eafbb8655fbdae996008c00c843660f4
7
- data.tar.gz: 3d5ea65b18dee8c16838ce0832e5db87e72b3b4dbee94e7642a2b72302f029e5fd1ca6993f0b032f2e745d355c295d855a7c28ffa745431f9d57ee18b0c3f072
6
+ metadata.gz: 5b93f9bdb33276374d0ab611520dffb8cc95cb0b53e21c35e18b6c18eb9047f92e62f774c1d95f53b607fe5d4c0af507c210ba99baf4c3068b4d04509c72be1d
7
+ data.tar.gz: 122e48ff1592b4ac750df5296fad2eba886804970dce7ceb15541885a4851627def159e0b393c0110d802b3b2dd891b30e4c1086201a1c29c064540750762b61
@@ -74,6 +74,10 @@ class Chef::Knife::Cloud
74
74
  "ubuntu-15-10" => { project: "ubuntu-os-cloud", prefix: "ubuntu-1510-wily" },
75
75
  "ubuntu-16-04" => { project: "ubuntu-os-cloud", prefix: "ubuntu-1604-xenial" },
76
76
  "ubuntu-1604-lts" => { project: "ubuntu-os-cloud", prefix: "ubuntu-1604-xenial" },
77
+ "ubuntu-1804-lts" => { project: "ubuntu-os-cloud", prefix: "ubuntu-1804-bionic" },
78
+ "ubuntu-2004-lts" => { project: "ubuntu-os-cloud", prefix: "ubuntu-2004-focal" },
79
+ "ubuntu-minimal-1604-lts" => { project: "ubuntu-os-cloud", prefix: "ubuntu-minimal-1604-xenial" },
80
+ "ubuntu-minimal-1804-lts" => { project: "ubuntu-os-cloud", prefix: "ubuntu-minimal-1804-bionic" },
77
81
  "windows-2008-r2" => { project: "windows-cloud", prefix: "windows-server-2008-r2" },
78
82
  "windows-2012-r2" => { project: "windows-cloud", prefix: "windows-server-2012-r2" },
79
83
  }.freeze
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
3
  # Author:: Chef Partner Engineering (<partnereng@chef.io>)
4
- # Copyright:: Copyright (c) 2016 Chef Software, Inc.
4
+ # Copyright:: Copyright (c) Chef Software Inc.
5
5
  # License:: Apache License, Version 2.0
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,19 +23,19 @@ class Chef::Knife::Cloud
23
23
 
24
24
  def create_service_instance
25
25
  Chef::Knife::Cloud::GoogleService.new(
26
- project: locate_config_value(:gce_project),
27
- zone: locate_config_value(:gce_zone),
28
- wait_time: locate_config_value(:request_timeout),
29
- refresh_rate: locate_config_value(:request_refresh_rate),
30
- max_pages: locate_config_value(:gce_max_pages),
31
- max_page_size: locate_config_value(:gce_max_page_size)
26
+ project: config[:gce_project],
27
+ zone: config[:gce_zone],
28
+ wait_time: config[:request_timeout],
29
+ refresh_rate: config[:request_refresh_rate],
30
+ max_pages: config[:gce_max_pages],
31
+ max_page_size: config[:gce_max_page_size]
32
32
  )
33
33
  end
34
34
 
35
35
  def check_for_missing_config_values!(*keys)
36
36
  keys_to_check = REQUIRED_KEYS + keys
37
37
 
38
- missing = keys_to_check.select { |x| locate_config_value(x).nil? }
38
+ missing = keys_to_check.select { |x| config[x].nil? }
39
39
 
40
40
  unless missing.empty?
41
41
  message = "The following required parameters are missing: #{missing.join(", ")}"
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # Author:: Paul Rossman (<paulrossman@google.com>)
4
4
  # Author:: Chef Partner Engineering (<partnereng@chef.io>)
5
- # Copyright:: Copyright 2015-2016 Google Inc., Chef Software, Inc.
5
+ # Copyright:: Copyright (c) Chef Software Inc.
6
6
  # License:: Apache License, Version 2.0
7
7
  #
8
8
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,13 +23,14 @@ require_relative "cloud/google_service_options"
23
23
 
24
24
  class Chef::Knife::Cloud
25
25
  class GoogleDiskCreate < Command
26
- include GoogleServiceHelpers
27
26
  include GoogleServiceOptions
28
27
 
29
28
  banner "knife google disk create NAME --gce-disk-size N (options)"
30
29
 
31
30
  deps do
32
31
  require_relative "cloud/google_service"
32
+ require_relative "cloud/google_service_helpers"
33
+ include GoogleServiceHelpers
33
34
  end
34
35
 
35
36
  option :disk_size,
@@ -51,16 +52,16 @@ class Chef::Knife::Cloud
51
52
  def validate_params!
52
53
  check_for_missing_config_values!(:gce_zone, :disk_size, :disk_type)
53
54
  raise "Please specify a disk name." unless @name_args.first
54
- raise "Disk size must be between 10 and 10,000" unless valid_disk_size?(locate_config_value(:disk_size))
55
+ raise "Disk size must be between 10 and 10,000" unless valid_disk_size?(config[:disk_size])
55
56
 
56
57
  super
57
58
  end
58
59
 
59
60
  def execute_command
60
61
  name = @name_args.first
61
- size = locate_config_value(:disk_size)
62
- type = locate_config_value(:disk_type)
63
- src = locate_config_value(:disk_source)
62
+ size = config[:disk_size]
63
+ type = config[:disk_type]
64
+ src = config[:disk_source]
64
65
 
65
66
  service.create_disk(name, size, type, src)
66
67
  end
@@ -23,13 +23,14 @@ require_relative "cloud/google_service_options"
23
23
 
24
24
  class Chef::Knife::Cloud
25
25
  class GoogleDiskDelete < Command
26
- include GoogleServiceHelpers
27
26
  include GoogleServiceOptions
28
27
 
29
28
  banner "knife google disk delete NAME [NAME] (options)"
30
29
 
31
30
  deps do
32
31
  require_relative "cloud/google_service"
32
+ require_relative "cloud/google_service_helpers"
33
+ include GoogleServiceHelpers
33
34
  end
34
35
 
35
36
  def validate_params!
@@ -23,13 +23,14 @@ require_relative "cloud/google_service_options"
23
23
 
24
24
  class Chef::Knife::Cloud
25
25
  class GoogleDiskList < ResourceListCommand
26
- include GoogleServiceHelpers
27
26
  include GoogleServiceOptions
28
27
 
29
28
  banner "knife google disk list"
30
29
 
31
30
  deps do
32
31
  require_relative "cloud/google_service"
32
+ require_relative "cloud/google_service_helpers"
33
+ include GoogleServiceHelpers
33
34
  end
34
35
 
35
36
  def validate_params!
@@ -22,13 +22,14 @@ require_relative "cloud/google_service_options"
22
22
 
23
23
  class Chef::Knife::Cloud
24
24
  class GoogleImageList < ResourceListCommand
25
- include GoogleServiceHelpers
26
25
  include GoogleServiceOptions
27
26
 
28
27
  banner "knife google image list"
29
28
 
30
29
  deps do
31
30
  require_relative "cloud/google_service"
31
+ require_relative "cloud/google_service_helpers"
32
+ include GoogleServiceHelpers
32
33
  end
33
34
 
34
35
  def validate_params!
@@ -23,13 +23,14 @@ require_relative "cloud/google_service_options"
23
23
 
24
24
  class Chef::Knife::Cloud
25
25
  class GoogleProjectQuotas < ResourceListCommand
26
- include GoogleServiceHelpers
27
26
  include GoogleServiceOptions
28
27
 
29
28
  banner "knife google project quotas"
30
29
 
31
30
  deps do
32
31
  require_relative "cloud/google_service"
32
+ require_relative "cloud/google_service_helpers"
33
+ include GoogleServiceHelpers
33
34
  end
34
35
 
35
36
  def validate_params!
@@ -23,13 +23,14 @@ require_relative "cloud/google_service_options"
23
23
 
24
24
  class Chef::Knife::Cloud
25
25
  class GoogleRegionList < ResourceListCommand
26
- include GoogleServiceHelpers
27
26
  include GoogleServiceOptions
28
27
 
29
28
  banner "knife google region list"
30
29
 
31
30
  deps do
32
31
  require_relative "cloud/google_service"
32
+ require_relative "cloud/google_service_helpers"
33
+ include GoogleServiceHelpers
33
34
  end
34
35
 
35
36
  def validate_params!
@@ -23,13 +23,14 @@ require_relative "cloud/google_service_options"
23
23
 
24
24
  class Chef::Knife::Cloud
25
25
  class GoogleRegionQuotas < Command
26
- include GoogleServiceHelpers
27
26
  include GoogleServiceOptions
28
27
 
29
28
  banner "knife google region quotas"
30
29
 
31
30
  deps do
32
31
  require_relative "cloud/google_service"
32
+ require_relative "cloud/google_service_helpers"
33
+ include GoogleServiceHelpers
33
34
  end
34
35
 
35
36
  def validate_params!
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # Author:: Paul Rossman (<paulrossman@google.com>)
4
4
  # Author:: Chef Partner Engineering (<partnereng@chef.io>)
5
- # Copyright:: Copyright 2015-2016 Google Inc., Chef Software, Inc.
5
+ # Copyright:: Copyright (c) Chef Software Inc.
6
6
  # License:: Apache License, Version 2.0
7
7
  #
8
8
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -25,13 +25,15 @@ require_relative "cloud/google_service_options"
25
25
  class Chef::Knife::Cloud
26
26
  class GoogleServerCreate < ServerCreateCommand
27
27
  include GoogleServiceOptions
28
- include GoogleServiceHelpers
29
28
  include ServerCreateOptions
30
29
 
31
30
  banner "knife google server create NAME -m MACHINE_TYPE -I IMAGE (options)"
32
31
 
33
32
  deps do
33
+ require "gcewinpass"
34
34
  require_relative "cloud/google_service"
35
+ require_relative "cloud/google_service_helpers"
36
+ include GoogleServiceHelpers
35
37
  end
36
38
 
37
39
  option :machine_type,
@@ -165,37 +167,33 @@ class Chef::Knife::Cloud
165
167
  description: "Specifies the number of local SSDs to be created per node. Each local SSD is 375 GB in size, but you can attach up to eight local SSD devices for 3 TB of total local SSD storage space per instance.",
166
168
  default: "1"
167
169
 
168
- deps do
169
- require "gcewinpass"
170
- end
171
-
172
170
  def before_exec_command
173
171
  super
174
172
 
175
173
  @create_options = {
176
174
  name: instance_name,
177
- image: locate_config_value(:image),
178
- image_project: locate_config_value(:image_project),
179
- network: locate_config_value(:network),
180
- subnet: locate_config_value(:subnet),
181
- public_ip: locate_config_value(:public_ip),
175
+ image: config[:image],
176
+ image_project: config[:image_project],
177
+ network: config[:network],
178
+ subnet: config[:subnet],
179
+ public_ip: config[:public_ip],
182
180
  auto_migrate: auto_migrate?,
183
181
  auto_restart: auto_restart?,
184
182
  preemptible: preemptible?,
185
- boot_disk_autodelete: locate_config_value(:boot_disk_autodelete),
186
- boot_disk_name: locate_config_value(:boot_disk_name),
183
+ boot_disk_autodelete: config[:boot_disk_autodelete],
184
+ boot_disk_name: config[:boot_disk_name],
187
185
  boot_disk_size: boot_disk_size,
188
- boot_disk_ssd: locate_config_value(:boot_disk_ssd),
189
- additional_disks: locate_config_value(:additional_disks),
190
- local_ssd: locate_config_value(:local_ssd),
191
- interface: locate_config_value(:interface),
186
+ boot_disk_ssd: config[:boot_disk_ssd],
187
+ additional_disks: config[:additional_disks],
188
+ local_ssd: config[:local_ssd],
189
+ interface: config[:interface],
192
190
  number_of_local_ssd: number_of_local_ssd,
193
- can_ip_forward: locate_config_value(:can_ip_forward),
194
- machine_type: locate_config_value(:machine_type),
195
- service_account_scopes: locate_config_value(:service_account_scopes),
196
- service_account_name: locate_config_value(:service_account_name),
191
+ can_ip_forward: config[:can_ip_forward],
192
+ machine_type: config[:machine_type],
193
+ service_account_scopes: config[:service_account_scopes],
194
+ service_account_name: config[:service_account_name],
197
195
  metadata: metadata,
198
- tags: locate_config_value(:tags),
196
+ tags: config[:tags],
199
197
  }
200
198
  end
201
199
 
@@ -210,16 +208,16 @@ class Chef::Knife::Cloud
210
208
  raise "You must supply an instance name." if @name_args.first.nil?
211
209
  raise "Boot disk size must be between 10 and 10,000" unless valid_disk_size?(boot_disk_size)
212
210
 
213
- if locate_config_value(:connection_protocol) == "winrm" && locate_config_value(:gce_email).nil?
211
+ if config[:connection_protocol] == "winrm" && config[:gce_email].nil?
214
212
  raise "Please provide your Google Cloud console email address via --gce-email. " \
215
213
  "It is required when resetting passwords on Windows hosts."
216
214
  end
217
215
 
218
- raise "Please provide connection port via --connection-port." unless locate_config_value(:connection_port)
219
- raise "Please provide image os type via --image-os-type." unless locate_config_value(:image_os_type)
216
+ raise "Please provide connection port via --connection-port." unless config[:connection_port]
217
+ raise "Please provide image os type via --image-os-type." unless config[:image_os_type]
220
218
 
221
- ui.warn("Auto-migrate disabled for preemptible instance") if preemptible? && locate_config_value(:auto_migrate)
222
- ui.warn("Auto-restart disabled for preemptible instance") if preemptible? && locate_config_value(:auto_restart)
219
+ ui.warn("Auto-migrate disabled for preemptible instance") if preemptible? && config[:auto_migrate]
220
+ ui.warn("Auto-restart disabled for preemptible instance") if preemptible? && config[:auto_restart]
223
221
 
224
222
  super
225
223
  end
@@ -227,10 +225,10 @@ class Chef::Knife::Cloud
227
225
  def before_bootstrap
228
226
  super
229
227
 
230
- config[:chef_node_name] = locate_config_value(:chef_node_name) ? locate_config_value(:chef_node_name) : instance_name
228
+ config[:chef_node_name] = config[:chef_node_name] ? config[:chef_node_name] : instance_name
231
229
  config[:bootstrap_ip_address] = ip_address_for_bootstrap
232
230
 
233
- if locate_config_value(:image_os_type) == "windows"
231
+ if config[:image_os_type] == "windows"
234
232
  ui.msg("Resetting the Windows login password so the bootstrap can continue...")
235
233
  config[:connection_password] = reset_windows_password
236
234
  end
@@ -247,31 +245,31 @@ class Chef::Knife::Cloud
247
245
  end
248
246
 
249
247
  def project
250
- locate_config_value(:gce_project)
248
+ config[:gce_project]
251
249
  end
252
250
 
253
251
  def zone
254
- locate_config_value(:gce_zone)
252
+ config[:gce_zone]
255
253
  end
256
254
 
257
255
  def email
258
- locate_config_value(:gce_email)
256
+ config[:gce_email]
259
257
  end
260
258
 
261
259
  def preemptible?
262
- locate_config_value(:preemptible)
260
+ config[:preemptible]
263
261
  end
264
262
 
265
263
  def auto_migrate?
266
- preemptible? ? false : locate_config_value(:auto_migrate)
264
+ preemptible? ? false : config[:auto_migrate]
267
265
  end
268
266
 
269
267
  def auto_restart?
270
- preemptible? ? false : locate_config_value(:auto_restart)
268
+ preemptible? ? false : config[:auto_restart]
271
269
  end
272
270
 
273
271
  def ip_address_for_bootstrap
274
- ip = locate_config_value(:use_private_ip) ? private_ip_for(server) : public_ip_for(server)
272
+ ip = config[:use_private_ip] ? private_ip_for(server) : public_ip_for(server)
275
273
 
276
274
  raise "Unable to determine instance IP address for bootstrapping" if ip == "unknown"
277
275
 
@@ -283,18 +281,18 @@ class Chef::Knife::Cloud
283
281
  end
284
282
 
285
283
  def metadata
286
- locate_config_value(:metadata).each_with_object({}) do |item, memo|
284
+ config[:metadata].each_with_object({}) do |item, memo|
287
285
  key, value = item.split("=")
288
286
  memo[key] = value
289
287
  end
290
288
  end
291
289
 
292
290
  def boot_disk_size
293
- locate_config_value(:boot_disk_size).to_i
291
+ config[:boot_disk_size].to_i
294
292
  end
295
293
 
296
294
  def number_of_local_ssd
297
- locate_config_value(:number_of_local_ssd).to_i
295
+ config[:number_of_local_ssd].to_i
298
296
  end
299
297
 
300
298
  def reset_windows_password
@@ -303,7 +301,7 @@ class Chef::Knife::Cloud
303
301
  zone: zone,
304
302
  instance_name: instance_name,
305
303
  email: email,
306
- username: locate_config_value(:connection_user),
304
+ username: config[:connection_user],
307
305
  debug: gcewinpass_debug_mode
308
306
  ).new_password
309
307
  end
@@ -27,13 +27,14 @@ class Chef
27
27
  class Cloud
28
28
  class GoogleServerDelete < ServerDeleteCommand
29
29
  include ServerDeleteOptions
30
- include GoogleServiceHelpers
31
30
  include GoogleServiceOptions
32
31
 
33
32
  banner "knife google server delete INSTANCE_NAME [INSTANCE_NAME] (options)"
34
33
 
35
34
  deps do
36
35
  require_relative "cloud/google_service"
36
+ require_relative "cloud/google_service_helpers"
37
+ include GoogleServiceHelpers
37
38
  end
38
39
 
39
40
  def validate_params!
@@ -24,11 +24,12 @@ require_relative "cloud/google_service_options"
24
24
 
25
25
  class Chef::Knife::Cloud
26
26
  class GoogleServerList < ServerListCommand
27
- include GoogleServiceHelpers
28
27
  include GoogleServiceOptions
29
28
 
30
29
  deps do
31
30
  require_relative "cloud/google_service"
31
+ require_relative "cloud/google_service_helpers"
32
+ include GoogleServiceHelpers
32
33
  end
33
34
 
34
35
  banner "knife google server list"
@@ -26,13 +26,14 @@ class Chef
26
26
  class Cloud
27
27
  class GoogleServerShow < ServerShowCommand
28
28
  include ServerShowOptions
29
- include GoogleServiceHelpers
30
29
  include GoogleServiceOptions
31
30
 
32
31
  banner "knife google server show INSTANCE_NAME (options)"
33
32
 
34
33
  deps do
35
34
  require_relative "cloud/google_service"
35
+ require_relative "cloud/google_service_helpers"
36
+ include GoogleServiceHelpers
36
37
  end
37
38
 
38
39
  def validate_params!
@@ -23,13 +23,14 @@ require_relative "cloud/google_service_options"
23
23
 
24
24
  class Chef::Knife::Cloud
25
25
  class GoogleZoneList < ResourceListCommand
26
- include GoogleServiceHelpers
27
26
  include GoogleServiceOptions
28
27
 
29
28
  banner "knife google zone list"
30
29
 
31
30
  deps do
32
31
  require_relative "cloud/google_service"
32
+ require_relative "cloud/google_service_helpers"
33
+ include GoogleServiceHelpers
33
34
  end
34
35
 
35
36
  def validate_params!
@@ -15,7 +15,7 @@
15
15
  #
16
16
  module Knife
17
17
  module Google
18
- VERSION = "4.2.6"
18
+ VERSION = "5.0.2"
19
19
  MAJOR, MINOR, TINY = VERSION.split(".")
20
20
  end
21
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-google
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.6
4
+ version: 5.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chiraq Jog
@@ -13,22 +13,36 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2020-01-29 00:00:00.000000000 Z
16
+ date: 2020-07-10 00:00:00.000000000 Z
17
17
  dependencies:
18
+ - !ruby/object:Gem::Dependency
19
+ name: chef
20
+ requirement: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: '15.11'
25
+ type: :runtime
26
+ prerelease: false
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: '15.11'
18
32
  - !ruby/object:Gem::Dependency
19
33
  name: knife-cloud
20
34
  requirement: !ruby/object:Gem::Requirement
21
35
  requirements:
22
36
  - - ">="
23
37
  - !ruby/object:Gem::Version
24
- version: 2.0.0
38
+ version: 4.0.0
25
39
  type: :runtime
26
40
  prerelease: false
27
41
  version_requirements: !ruby/object:Gem::Requirement
28
42
  requirements:
29
43
  - - ">="
30
44
  - !ruby/object:Gem::Version
31
- version: 2.0.0
45
+ version: 4.0.0
32
46
  - !ruby/object:Gem::Dependency
33
47
  name: google-api-client
34
48
  requirement: !ruby/object:Gem::Requirement
@@ -38,7 +52,7 @@ dependencies:
38
52
  version: 0.23.9
39
53
  - - "<"
40
54
  - !ruby/object:Gem::Version
41
- version: 0.37.0
55
+ version: 0.41.0
42
56
  type: :runtime
43
57
  prerelease: false
44
58
  version_requirements: !ruby/object:Gem::Requirement
@@ -48,7 +62,7 @@ dependencies:
48
62
  version: 0.23.9
49
63
  - - "<"
50
64
  - !ruby/object:Gem::Version
51
- version: 0.37.0
65
+ version: 0.41.0
52
66
  - !ruby/object:Gem::Dependency
53
67
  name: gcewinpass
54
68
  requirement: !ruby/object:Gem::Requirement
@@ -100,7 +114,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
100
114
  requirements:
101
115
  - - ">="
102
116
  - !ruby/object:Gem::Version
103
- version: '2.5'
117
+ version: '2.6'
104
118
  required_rubygems_version: !ruby/object:Gem::Requirement
105
119
  requirements:
106
120
  - - ">="