knife-google 4.2.7 → 5.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chef/knife/cloud/google_service.rb +16 -0
- data/lib/chef/knife/cloud/google_service_helpers.rb +8 -8
- data/lib/chef/knife/google_disk_create.rb +7 -5
- data/lib/chef/knife/google_disk_delete.rb +2 -0
- data/lib/chef/knife/google_disk_list.rb +2 -0
- data/lib/chef/knife/google_image_list.rb +2 -0
- data/lib/chef/knife/google_project_quotas.rb +2 -0
- data/lib/chef/knife/google_region_list.rb +2 -0
- data/lib/chef/knife/google_region_quotas.rb +2 -0
- data/lib/chef/knife/google_server_create.rb +38 -39
- data/lib/chef/knife/google_server_delete.rb +2 -0
- data/lib/chef/knife/google_server_list.rb +2 -0
- data/lib/chef/knife/google_server_show.rb +2 -0
- data/lib/chef/knife/google_zone_list.rb +2 -0
- data/lib/knife-google/version.rb +1 -1
- metadata +21 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf254c682d3e6161611588361369f2f5fedff8593c723d1b10a0299f3d5b3dbc
|
4
|
+
data.tar.gz: 5d0ee0a9f6a6874e051ade1956121f4ced1932aea85f311b894984812300f79b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6868b3e078b1cf3e0b6c7f034e0dc1fdfbd8aa1a88f33317ffb30d081a411013215f04e046126ada09dc9afbea09206ce1e59f30a57f880d8cad19221a1b55ab
|
7
|
+
data.tar.gz: fa8fbd6d9a1d74376bba4c45b28f123a48bfce3e1014af76eb27e463f0abb4677890dca4211dcdf00602c31ad4787ee195e7e846fbb409ce0443675e992ba801
|
@@ -56,16 +56,21 @@ class Chef::Knife::Cloud
|
|
56
56
|
IMAGE_ALIAS_MAP = {
|
57
57
|
"centos-6" => { project: "centos-cloud", prefix: "centos-6" },
|
58
58
|
"centos-7" => { project: "centos-cloud", prefix: "centos-7" },
|
59
|
+
"centos-8" => { project: "centos-cloud", prefix: "centos-8" },
|
59
60
|
"container-vm" => { project: "google-containers", prefix: "container-vm" },
|
60
61
|
"coreos" => { project: "coreos-cloud", prefix: "coreos-stable" },
|
61
62
|
"debian-7" => { project: "debian-cloud", prefix: "debian-7-wheezy" },
|
62
63
|
"debian-7-backports" => { project: "debian-cloud", prefix: "backports-debian-7-wheezy" },
|
63
64
|
"debian-8" => { project: "debian-cloud", prefix: "debian-8-jessie" },
|
65
|
+
"debian-9" => { project: "debian-cloud", prefix: "debian-9" },
|
66
|
+
"debian-10" => { project: "debian-cloud", prefix: "debian-10" },
|
64
67
|
"opensuse-13" => { project: "opensuse-cloud", prefix: "opensuse-13" },
|
65
68
|
"rhel-6" => { project: "rhel-cloud", prefix: "rhel-6" },
|
66
69
|
"rhel-7" => { project: "rhel-cloud", prefix: "rhel-7" },
|
70
|
+
"rhel-8" => { project: "rhel-cloud", prefix: "rhel-8" },
|
67
71
|
"sles-11" => { project: "suse-cloud", prefix: "sles-11" },
|
68
72
|
"sles-12" => { project: "suse-cloud", prefix: "sles-12" },
|
73
|
+
"sles-15" => { project: "suse-cloud", prefix: "sles-15" },
|
69
74
|
"ubuntu-12-04" => { project: "ubuntu-os-cloud", prefix: "ubuntu-1204-precise" },
|
70
75
|
"ubuntu-1204-lts" => { project: "ubuntu-os-cloud", prefix: "ubuntu-1204-precise" },
|
71
76
|
"ubuntu-14-04" => { project: "ubuntu-os-cloud", prefix: "ubuntu-1404-trusty" },
|
@@ -74,8 +79,19 @@ class Chef::Knife::Cloud
|
|
74
79
|
"ubuntu-15-10" => { project: "ubuntu-os-cloud", prefix: "ubuntu-1510-wily" },
|
75
80
|
"ubuntu-16-04" => { project: "ubuntu-os-cloud", prefix: "ubuntu-1604-xenial" },
|
76
81
|
"ubuntu-1604-lts" => { project: "ubuntu-os-cloud", prefix: "ubuntu-1604-xenial" },
|
82
|
+
"ubuntu-1804-lts" => { project: "ubuntu-os-cloud", prefix: "ubuntu-1804-bionic" },
|
83
|
+
"ubuntu-2004-lts" => { project: "ubuntu-os-cloud", prefix: "ubuntu-2004-focal" },
|
84
|
+
"ubuntu-minimal-1604-lts" => { project: "ubuntu-os-cloud", prefix: "ubuntu-minimal-1604-xenial" },
|
85
|
+
"ubuntu-minimal-1804-lts" => { project: "ubuntu-os-cloud", prefix: "ubuntu-minimal-1804-bionic" },
|
77
86
|
"windows-2008-r2" => { project: "windows-cloud", prefix: "windows-server-2008-r2" },
|
78
87
|
"windows-2012-r2" => { project: "windows-cloud", prefix: "windows-server-2012-r2" },
|
88
|
+
"windows-2012-r2-core" => { project: "windows-cloud", prefix: "windows-server-2012-r2-dc-core" },
|
89
|
+
"windows-2016-core" => { project: "windows-cloud", prefix: "windows-server-2016-dc-core" },
|
90
|
+
"windows-2016" => { project: "windows-cloud", prefix: "windows-server-2016-dc" },
|
91
|
+
"windows-2019-core-for-containers" => { project: "windows-cloud", prefix: "windows-server-2019-dc-core-for-containers" },
|
92
|
+
"windows-2019-core" => { project: "windows-cloud", prefix: "windows-server-2019-dc-core" },
|
93
|
+
"windows-2019-for-containers" => { project: "windows-cloud", prefix: "windows-server-2019-dc-for-containers" },
|
94
|
+
"windows-2019" => { project: "windows-cloud", prefix: "windows-server-2019-dc" },
|
79
95
|
}.freeze
|
80
96
|
|
81
97
|
PUBLIC_PROJECTS = %w{
|
@@ -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)
|
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:
|
27
|
-
zone:
|
28
|
-
wait_time:
|
29
|
-
refresh_rate:
|
30
|
-
max_pages:
|
31
|
-
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|
|
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
|
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");
|
@@ -29,6 +29,8 @@ class Chef::Knife::Cloud
|
|
29
29
|
|
30
30
|
deps do
|
31
31
|
require_relative "cloud/google_service"
|
32
|
+
require_relative "cloud/google_service_helpers"
|
33
|
+
include GoogleServiceHelpers
|
32
34
|
end
|
33
35
|
|
34
36
|
option :disk_size,
|
@@ -50,16 +52,16 @@ class Chef::Knife::Cloud
|
|
50
52
|
def validate_params!
|
51
53
|
check_for_missing_config_values!(:gce_zone, :disk_size, :disk_type)
|
52
54
|
raise "Please specify a disk name." unless @name_args.first
|
53
|
-
raise "Disk size must be between 10 and 10,000" unless valid_disk_size?(
|
55
|
+
raise "Disk size must be between 10 and 10,000" unless valid_disk_size?(config[:disk_size])
|
54
56
|
|
55
57
|
super
|
56
58
|
end
|
57
59
|
|
58
60
|
def execute_command
|
59
61
|
name = @name_args.first
|
60
|
-
size =
|
61
|
-
type =
|
62
|
-
src =
|
62
|
+
size = config[:disk_size]
|
63
|
+
type = config[:disk_type]
|
64
|
+
src = config[:disk_source]
|
63
65
|
|
64
66
|
service.create_disk(name, size, type, src)
|
65
67
|
end
|
@@ -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
|
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");
|
@@ -30,7 +30,10 @@ class Chef::Knife::Cloud
|
|
30
30
|
banner "knife google server create NAME -m MACHINE_TYPE -I IMAGE (options)"
|
31
31
|
|
32
32
|
deps do
|
33
|
+
require "gcewinpass"
|
33
34
|
require_relative "cloud/google_service"
|
35
|
+
require_relative "cloud/google_service_helpers"
|
36
|
+
include GoogleServiceHelpers
|
34
37
|
end
|
35
38
|
|
36
39
|
option :machine_type,
|
@@ -164,37 +167,33 @@ class Chef::Knife::Cloud
|
|
164
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.",
|
165
168
|
default: "1"
|
166
169
|
|
167
|
-
deps do
|
168
|
-
require "gcewinpass"
|
169
|
-
end
|
170
|
-
|
171
170
|
def before_exec_command
|
172
171
|
super
|
173
172
|
|
174
173
|
@create_options = {
|
175
174
|
name: instance_name,
|
176
|
-
image:
|
177
|
-
image_project:
|
178
|
-
network:
|
179
|
-
subnet:
|
180
|
-
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],
|
181
180
|
auto_migrate: auto_migrate?,
|
182
181
|
auto_restart: auto_restart?,
|
183
182
|
preemptible: preemptible?,
|
184
|
-
boot_disk_autodelete:
|
185
|
-
boot_disk_name:
|
183
|
+
boot_disk_autodelete: config[:boot_disk_autodelete],
|
184
|
+
boot_disk_name: config[:boot_disk_name],
|
186
185
|
boot_disk_size: boot_disk_size,
|
187
|
-
boot_disk_ssd:
|
188
|
-
additional_disks:
|
189
|
-
local_ssd:
|
190
|
-
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],
|
191
190
|
number_of_local_ssd: number_of_local_ssd,
|
192
|
-
can_ip_forward:
|
193
|
-
machine_type:
|
194
|
-
service_account_scopes:
|
195
|
-
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],
|
196
195
|
metadata: metadata,
|
197
|
-
tags:
|
196
|
+
tags: config[:tags],
|
198
197
|
}
|
199
198
|
end
|
200
199
|
|
@@ -209,16 +208,16 @@ class Chef::Knife::Cloud
|
|
209
208
|
raise "You must supply an instance name." if @name_args.first.nil?
|
210
209
|
raise "Boot disk size must be between 10 and 10,000" unless valid_disk_size?(boot_disk_size)
|
211
210
|
|
212
|
-
if
|
211
|
+
if config[:connection_protocol] == "winrm" && config[:gce_email].nil?
|
213
212
|
raise "Please provide your Google Cloud console email address via --gce-email. " \
|
214
213
|
"It is required when resetting passwords on Windows hosts."
|
215
214
|
end
|
216
215
|
|
217
|
-
raise "Please provide connection port via --connection-port." unless
|
218
|
-
raise "Please provide image os type via --image-os-type." unless
|
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]
|
219
218
|
|
220
|
-
ui.warn("Auto-migrate disabled for preemptible instance") if preemptible? &&
|
221
|
-
ui.warn("Auto-restart disabled for preemptible instance") if preemptible? &&
|
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]
|
222
221
|
|
223
222
|
super
|
224
223
|
end
|
@@ -226,10 +225,10 @@ class Chef::Knife::Cloud
|
|
226
225
|
def before_bootstrap
|
227
226
|
super
|
228
227
|
|
229
|
-
config[:chef_node_name] =
|
228
|
+
config[:chef_node_name] = config[:chef_node_name] ? config[:chef_node_name] : instance_name
|
230
229
|
config[:bootstrap_ip_address] = ip_address_for_bootstrap
|
231
230
|
|
232
|
-
if
|
231
|
+
if config[:image_os_type] == "windows"
|
233
232
|
ui.msg("Resetting the Windows login password so the bootstrap can continue...")
|
234
233
|
config[:connection_password] = reset_windows_password
|
235
234
|
end
|
@@ -246,31 +245,31 @@ class Chef::Knife::Cloud
|
|
246
245
|
end
|
247
246
|
|
248
247
|
def project
|
249
|
-
|
248
|
+
config[:gce_project]
|
250
249
|
end
|
251
250
|
|
252
251
|
def zone
|
253
|
-
|
252
|
+
config[:gce_zone]
|
254
253
|
end
|
255
254
|
|
256
255
|
def email
|
257
|
-
|
256
|
+
config[:gce_email]
|
258
257
|
end
|
259
258
|
|
260
259
|
def preemptible?
|
261
|
-
|
260
|
+
config[:preemptible]
|
262
261
|
end
|
263
262
|
|
264
263
|
def auto_migrate?
|
265
|
-
preemptible? ? false :
|
264
|
+
preemptible? ? false : config[:auto_migrate]
|
266
265
|
end
|
267
266
|
|
268
267
|
def auto_restart?
|
269
|
-
preemptible? ? false :
|
268
|
+
preemptible? ? false : config[:auto_restart]
|
270
269
|
end
|
271
270
|
|
272
271
|
def ip_address_for_bootstrap
|
273
|
-
ip =
|
272
|
+
ip = config[:use_private_ip] ? private_ip_for(server) : public_ip_for(server)
|
274
273
|
|
275
274
|
raise "Unable to determine instance IP address for bootstrapping" if ip == "unknown"
|
276
275
|
|
@@ -282,18 +281,18 @@ class Chef::Knife::Cloud
|
|
282
281
|
end
|
283
282
|
|
284
283
|
def metadata
|
285
|
-
|
284
|
+
config[:metadata].each_with_object({}) do |item, memo|
|
286
285
|
key, value = item.split("=")
|
287
286
|
memo[key] = value
|
288
287
|
end
|
289
288
|
end
|
290
289
|
|
291
290
|
def boot_disk_size
|
292
|
-
|
291
|
+
config[:boot_disk_size].to_i
|
293
292
|
end
|
294
293
|
|
295
294
|
def number_of_local_ssd
|
296
|
-
|
295
|
+
config[:number_of_local_ssd].to_i
|
297
296
|
end
|
298
297
|
|
299
298
|
def reset_windows_password
|
@@ -302,7 +301,7 @@ class Chef::Knife::Cloud
|
|
302
301
|
zone: zone,
|
303
302
|
instance_name: instance_name,
|
304
303
|
email: email,
|
305
|
-
username:
|
304
|
+
username: config[:connection_user],
|
306
305
|
debug: gcewinpass_debug_mode
|
307
306
|
).new_password
|
308
307
|
end
|
data/lib/knife-google/version.rb
CHANGED
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
|
+
version: 5.0.3
|
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-
|
16
|
+
date: 2020-07-13 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:
|
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:
|
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.
|
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.
|
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.
|
117
|
+
version: '2.6'
|
104
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
119
|
requirements:
|
106
120
|
- - ">="
|