gogetit 0.22.7 → 0.22.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gogetit/util.rb +10 -10
- data/lib/gogetit/version.rb +1 -1
- data/lib/providers/libvirt.rb +13 -5
- data/lib/providers/lxd.rb +14 -13
- data/lib/sample_conf/gogetit.yml +5 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a6930d64b643d6e2dbc4e49957a6a89f6667abbbecf2b80519ceb2572ca334c
|
4
|
+
data.tar.gz: 99506b2526e06fd65dc9009719cb88855bb97ba07e796bc5e37309ff385dd6ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e18c2ffdcbc08b80164241af0f89844d758db902865d95a2418913ce2afc781fae0b09e1669ed1462e577c7ecc498b688b288dd1c6b7e53f7c9d746fd44ec867
|
7
|
+
data.tar.gz: c2b7b70114758503dc93a034f6f0803570e6e56dd721f4aeac6ff27e3e40e3833b8685492fb722cf8486eb0f7900fa2984ec99e658a28764bd2f519049a99d84
|
data/lib/gogetit/util.rb
CHANGED
@@ -292,15 +292,15 @@ module Gogetit
|
|
292
292
|
# To get CA public key to be used for SSH authentication
|
293
293
|
# https://cloudinit.readthedocs.io/en/latest/topics/examples.html
|
294
294
|
# #writing-out-arbitrary-files
|
295
|
-
if config[:cloud_init_helper] && config[:cloud_init_helper][:
|
295
|
+
if config[:cloud_init_helper] && config[:cloud_init_helper][:ssh_with_ca_signed_keys]
|
296
296
|
user_data['write_files'] = []
|
297
|
-
content = get_http_content(config[:cloud_init_helper][:
|
297
|
+
content = get_http_content(config[:cloud_init_helper][:ssh_with_ca_signed_keys][:ca_public_key_url])
|
298
298
|
if content
|
299
299
|
file = {
|
300
300
|
'content' => content.chop!,
|
301
|
-
'path' => config[:cloud_init_helper][:
|
302
|
-
'owner' => config[:cloud_init_helper][:
|
303
|
-
'permissions' => config[:cloud_init_helper][:
|
301
|
+
'path' => config[:cloud_init_helper][:ssh_with_ca_signed_keys][:ca_public_key_path],
|
302
|
+
'owner' => config[:cloud_init_helper][:ssh_with_ca_signed_keys][:owner],
|
303
|
+
'permissions' => config[:cloud_init_helper][:ssh_with_ca_signed_keys][:permissions]
|
304
304
|
}
|
305
305
|
user_data['write_files'].push(file)
|
306
306
|
user_data['bootcmd'] = []
|
@@ -310,17 +310,17 @@ echo \"TrustedUserCAKeys #{file['path']}\" >> /etc/ssh/sshd_config"
|
|
310
310
|
)
|
311
311
|
end
|
312
312
|
|
313
|
-
if config[:cloud_init_helper][:
|
314
|
-
content = get_http_content(config[:cloud_init_helper][:
|
313
|
+
if config[:cloud_init_helper][:ssh_with_ca_signed_keys][:revocation_url]
|
314
|
+
content = get_http_content(config[:cloud_init_helper][:ssh_with_ca_signed_keys][:revocation_url])
|
315
315
|
if content
|
316
316
|
user_data['bootcmd'].push(
|
317
317
|
"cloud-init-per once download-key-revocation-list \
|
318
|
-
curl -o #{config[:cloud_init_helper][:
|
319
|
-
#{config[:cloud_init_helper][:
|
318
|
+
curl -o #{config[:cloud_init_helper][:ssh_with_ca_signed_keys][:revocation_path]} \
|
319
|
+
#{config[:cloud_init_helper][:ssh_with_ca_signed_keys][:revocation_url]}"
|
320
320
|
)
|
321
321
|
user_data['bootcmd'].push(
|
322
322
|
"cloud-init-per once ssh-user-key-revocation-list \
|
323
|
-
echo \"RevokedKeys #{config[:cloud_init_helper][:
|
323
|
+
echo \"RevokedKeys #{config[:cloud_init_helper][:ssh_with_ca_signed_keys][:revocation_path]}\" \
|
324
324
|
>> /etc/ssh/sshd_config"
|
325
325
|
)
|
326
326
|
end
|
data/lib/gogetit/version.rb
CHANGED
data/lib/providers/libvirt.rb
CHANGED
@@ -277,8 +277,16 @@ module Gogetit
|
|
277
277
|
maas.wait_until_state(system_id, 'Deployed')
|
278
278
|
|
279
279
|
fqdn = name + '.' + maas.get_domain
|
280
|
+
|
280
281
|
distro_name = maas.get_distro_name(system_id)
|
281
|
-
|
282
|
+
|
283
|
+
if config[:default][:user] == config[:cloud_init][:users][0]['name']
|
284
|
+
default_user = config[:default][:user]
|
285
|
+
else
|
286
|
+
default_user = distro_name
|
287
|
+
end
|
288
|
+
|
289
|
+
wait_until_available(fqdn, default_user)
|
282
290
|
|
283
291
|
# To enable serial console to use 'virsh console'
|
284
292
|
if distro_name == 'ubuntu'
|
@@ -286,15 +294,15 @@ module Gogetit
|
|
286
294
|
'sudo systemctl enable serial-getty@ttyS0.service',
|
287
295
|
'sudo systemctl start serial-getty@ttyS0.service'
|
288
296
|
]
|
289
|
-
run_through_ssh(fqdn,
|
297
|
+
run_through_ssh(fqdn, default_user, commands)
|
290
298
|
end
|
291
299
|
|
292
300
|
logger.info("#{name} has been created.")
|
293
|
-
puts "ssh #{
|
301
|
+
puts "ssh #{default_user}@#{name}"
|
294
302
|
|
295
303
|
info = {}
|
296
|
-
info[:distro] =
|
297
|
-
info[:default_user] =
|
304
|
+
info[:distro] = distro_name
|
305
|
+
info[:default_user] = default_user
|
298
306
|
|
299
307
|
{ result: true, info: info }
|
300
308
|
end
|
data/lib/providers/lxd.rb
CHANGED
@@ -118,24 +118,25 @@ module Gogetit
|
|
118
118
|
YAML.dump(lxd_params[:config][:"user.network-config"])[4..-1]
|
119
119
|
|
120
120
|
elsif options[:ipaddresses]
|
121
|
-
|
121
|
+
config[:ifaces] = check_ip_available(options[:ipaddresses], maas)
|
122
122
|
abort("There is no dns server specified for the gateway network.") \
|
123
|
-
unless
|
123
|
+
unless config[:ifaces][0]['dns_servers'][0]
|
124
124
|
abort("There is no gateway specified for the gateway network.") \
|
125
|
-
unless
|
125
|
+
unless config[:ifaces][0]['gateway_ip']
|
126
126
|
|
127
127
|
lxd_params[:config][:'user.network-config'] = {
|
128
128
|
'version' => 1,
|
129
129
|
'config' => [
|
130
130
|
{
|
131
131
|
'type' => 'nameserver',
|
132
|
-
'address' =>
|
132
|
+
'address' => config[:ifaces][0]['dns_servers'][0],
|
133
|
+
'search' => maas.get_domain,
|
133
134
|
}
|
134
135
|
]
|
135
136
|
}
|
136
137
|
|
137
138
|
# to generate configuration for [:config][:'user.network-config']['config']
|
138
|
-
|
139
|
+
config[:ifaces].each_with_index do |iface,index|
|
139
140
|
if index == 0
|
140
141
|
iface_conf = {
|
141
142
|
'type' => 'physical',
|
@@ -152,7 +153,7 @@ module Gogetit
|
|
152
153
|
]
|
153
154
|
}
|
154
155
|
elsif index > 0
|
155
|
-
if
|
156
|
+
if config[:ifaces][0]['vlan']['name'] != 'untagged'
|
156
157
|
iface_conf = {
|
157
158
|
'type' => 'physical',
|
158
159
|
'name' => "eth#{index}",
|
@@ -166,7 +167,7 @@ module Gogetit
|
|
166
167
|
}
|
167
168
|
]
|
168
169
|
}
|
169
|
-
elsif
|
170
|
+
elsif config[:ifaces][0]['vlan']['name'] == 'untagged'
|
170
171
|
iface_conf = {
|
171
172
|
'type' => 'vlan',
|
172
173
|
'name' => "eth0.#{iface['vlan']['vid'].to_s}",
|
@@ -215,7 +216,7 @@ module Gogetit
|
|
215
216
|
lxd_params[:devices] = (Hashie.symbolize_keys lxd_params[:devices])
|
216
217
|
|
217
218
|
elsif options[:ipaddresses]
|
218
|
-
|
219
|
+
config[:ifaces].each_with_index do |iface,index|
|
219
220
|
if index == 0
|
220
221
|
if iface['vlan']['name'] == 'untagged' # or vid == 0
|
221
222
|
lxd_params[:devices][:"eth#{index}"] = {
|
@@ -234,10 +235,10 @@ module Gogetit
|
|
234
235
|
type: 'nic'
|
235
236
|
}
|
236
237
|
end
|
237
|
-
# When
|
238
|
+
# When config[:ifaces][0]['vlan']['name'] == 'untagged' and index > 0,
|
238
239
|
# it does not need to generate more devices
|
239
240
|
# since it will configure the IPs with tagged VLANs.
|
240
|
-
elsif
|
241
|
+
elsif config[:ifaces][0]['vlan']['name'] != 'untagged'
|
241
242
|
lxd_params[:devices][:"eth#{index}"] = {
|
242
243
|
mtu: iface['vlan']['mtu'].to_s, #This must be string
|
243
244
|
name: "eth#{index}",
|
@@ -291,7 +292,7 @@ module Gogetit
|
|
291
292
|
def reserve_ips(name, options, container)
|
292
293
|
logger.info("Calling <#{__method__.to_s}>")
|
293
294
|
# Generate params to reserve IPs
|
294
|
-
|
295
|
+
config[:ifaces].each_with_index do |iface,index|
|
295
296
|
if index == 0
|
296
297
|
params = {
|
297
298
|
'subnet' => iface['cidr'],
|
@@ -304,14 +305,14 @@ module Gogetit
|
|
304
305
|
# it fails ocuring '404 not found'.
|
305
306
|
# if under score, '_', is used as a conjunction instead of '-',
|
306
307
|
# it breaks MAAS DNS somehow..
|
307
|
-
if
|
308
|
+
if config[:ifaces][0]['vlan']['name'] == 'untagged'
|
308
309
|
params = {
|
309
310
|
'subnet' => iface['cidr'],
|
310
311
|
'ip' => iface['ip'],
|
311
312
|
'hostname' => 'eth0' + '-' + iface['vlan']['vid'].to_s + '-' + name,
|
312
313
|
'mac' => container[:expanded_config][:"volatile.eth0.hwaddr"]
|
313
314
|
}
|
314
|
-
elsif
|
315
|
+
elsif config[:ifaces][0]['vlan']['name'] != 'untagged'
|
315
316
|
params = {
|
316
317
|
'subnet' => iface['cidr'],
|
317
318
|
'ip' => iface['ip'],
|
data/lib/sample_conf/gogetit.yml
CHANGED
@@ -75,11 +75,11 @@ cloud_init:
|
|
75
75
|
|
76
76
|
cloud_init_helper:
|
77
77
|
ca_certs:
|
78
|
-
- http://pki.example.com/site/
|
79
|
-
|
80
|
-
|
81
|
-
|
78
|
+
- http://pki.example.com/site/ca-bundle.crt
|
79
|
+
ssh_with_ca_signed_keys:
|
80
|
+
ca_public_key_url: http://pki.example.com/site/ssh_ca.pub
|
81
|
+
ca_public_key_path: /etc/ssh/ssh_ca.pub
|
82
82
|
revocation_url: http://pki.example.com/site/ssh-revoked-keys
|
83
|
-
revocation_path: /etc/ssh/
|
83
|
+
revocation_path: /etc/ssh/ssh-revoked-keys
|
84
84
|
owner: root:root
|
85
85
|
permissions: '0640'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gogetit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.22.
|
4
|
+
version: 0.22.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Don Draper
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|