gogetit 0.22.1 → 0.22.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/gogetit/util.rb +13 -28
- data/lib/gogetit/version.rb +1 -1
- data/lib/providers/lxd.rb +13 -9
- data/lib/sample_conf/gogetit.yml +11 -0
- 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: 5a4ad33d9e3ba2abd56517e7b492c6783ff9ffd3b5c31cacae0d9a4f08aca465
|
|
4
|
+
data.tar.gz: d0fd8947a53283a51888d5cbf348647c29d889fd8998b94d7692bd6f56e8e0d9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 53fd56efeb9ec487cecc93736a502a8989c1c9c72b85144e712fc6b6313ab5b30eabfa0ee9d22bc69317a1e7cde4421041ce1cc6ad04f1ccf8bdaa7a94a97eb1
|
|
7
|
+
data.tar.gz: cbced91db630cee9cb53eebaba6e644392b44f8a33958b54a085f894c58709f50514eebac82a3470af425bfaecaf182275268e97d8abee1ea2d6b32b02dfe7e9
|
data/lib/gogetit/util.rb
CHANGED
|
@@ -265,11 +265,6 @@ module Gogetit
|
|
|
265
265
|
def generate_cloud_init_config(options, config, user_data = {})
|
|
266
266
|
logger.info("Calling <#{__method__.to_s}>")
|
|
267
267
|
|
|
268
|
-
# apt
|
|
269
|
-
user_data['apt'] = {}
|
|
270
|
-
# preserve source list for a while
|
|
271
|
-
user_data['apt']['preserve_sources_list'] = true
|
|
272
|
-
|
|
273
268
|
if options[:'no-maas']
|
|
274
269
|
# When there is no MAAS, containers should be able to resolve
|
|
275
270
|
# their name with hosts file.
|
|
@@ -280,11 +275,11 @@ module Gogetit
|
|
|
280
275
|
# https://cloudinit.readthedocs.io/en/latest/topics/examples.html
|
|
281
276
|
# #configure-an-instances-trusted-ca-certificates
|
|
282
277
|
#
|
|
283
|
-
if config[:
|
|
278
|
+
if config[:cloud_init_helper] && config[:cloud_init_helper][:ca_certs]
|
|
284
279
|
user_data['ca-certs'] = {}
|
|
285
280
|
certs = []
|
|
286
281
|
|
|
287
|
-
config[:
|
|
282
|
+
config[:cloud_init_helper][:ca_certs].each do |ca|
|
|
288
283
|
content = get_http_content(ca)
|
|
289
284
|
certs.push(
|
|
290
285
|
/^-----BEGIN CERTIFICATE-----.*-/m.match(content).to_s
|
|
@@ -297,15 +292,15 @@ module Gogetit
|
|
|
297
292
|
# To get CA public key to be used for SSH authentication
|
|
298
293
|
# https://cloudinit.readthedocs.io/en/latest/topics/examples.html
|
|
299
294
|
# #writing-out-arbitrary-files
|
|
300
|
-
if config[:
|
|
295
|
+
if config[:cloud_init_helper] && config[:cloud_init_helper][:ssh_ca_public_key]
|
|
301
296
|
user_data['write_files'] = []
|
|
302
|
-
content = get_http_content(config[:
|
|
297
|
+
content = get_http_content(config[:cloud_init_helper][:ssh_ca_public_key][:key_url])
|
|
303
298
|
if content
|
|
304
299
|
file = {
|
|
305
300
|
'content' => content.chop!,
|
|
306
|
-
'path' => config[:
|
|
307
|
-
'owner' => config[:
|
|
308
|
-
'permissions' => config[:
|
|
301
|
+
'path' => config[:cloud_init_helper][:ssh_ca_public_key][:key_path],
|
|
302
|
+
'owner' => config[:cloud_init_helper][:ssh_ca_public_key][:owner],
|
|
303
|
+
'permissions' => config[:cloud_init_helper][:ssh_ca_public_key][:permissions]
|
|
309
304
|
}
|
|
310
305
|
user_data['write_files'].push(file)
|
|
311
306
|
user_data['bootcmd'] = []
|
|
@@ -315,34 +310,24 @@ echo \"TrustedUserCAKeys #{file['path']}\" >> /etc/ssh/sshd_config"
|
|
|
315
310
|
)
|
|
316
311
|
end
|
|
317
312
|
|
|
318
|
-
if config[:
|
|
319
|
-
content = get_http_content(config[:
|
|
313
|
+
if config[:cloud_init_helper][:ssh_ca_public_key][:revocation_url]
|
|
314
|
+
content = get_http_content(config[:cloud_init_helper][:ssh_ca_public_key][:revocation_url])
|
|
320
315
|
if content
|
|
321
316
|
user_data['bootcmd'].push(
|
|
322
317
|
"cloud-init-per once download-key-revocation-list \
|
|
323
|
-
curl -o #{config[:
|
|
324
|
-
#{config[:
|
|
318
|
+
curl -o #{config[:cloud_init_helper][:ssh_ca_public_key][:revocation_path]} \
|
|
319
|
+
#{config[:cloud_init_helper][:ssh_ca_public_key][:revocation_url]}"
|
|
325
320
|
)
|
|
326
321
|
user_data['bootcmd'].push(
|
|
327
322
|
"cloud-init-per once ssh-user-key-revocation-list \
|
|
328
|
-
echo \"RevokedKeys #{config[:
|
|
323
|
+
echo \"RevokedKeys #{config[:cloud_init_helper][:ssh_ca_public_key][:revocation_path]}\" \
|
|
329
324
|
>> /etc/ssh/sshd_config"
|
|
330
325
|
)
|
|
331
326
|
end
|
|
332
327
|
end
|
|
333
328
|
end
|
|
334
329
|
|
|
335
|
-
|
|
336
|
-
# https://cloudinit.readthedocs.io/en/latest/topics/examples.html
|
|
337
|
-
# #including-users-and-groups
|
|
338
|
-
if config[:cloud_init] && config[:cloud_init][:users]
|
|
339
|
-
user_data['users'] = []
|
|
340
|
-
user_data['users'].push('default')
|
|
341
|
-
|
|
342
|
-
config[:cloud_init][:users].each do |user|
|
|
343
|
-
user_data['users'].push(Hashie.stringify_keys user)
|
|
344
|
-
end
|
|
345
|
-
end
|
|
330
|
+
user_data.merge! (Hashie.stringify_keys config[:cloud_init])
|
|
346
331
|
|
|
347
332
|
return user_data
|
|
348
333
|
end
|
data/lib/gogetit/version.rb
CHANGED
data/lib/providers/lxd.rb
CHANGED
|
@@ -109,8 +109,8 @@ module Gogetit
|
|
|
109
109
|
|
|
110
110
|
# physical device will be the gate device
|
|
111
111
|
lxd_params[:config][:"user.network-config"]['config'].each do |iface|
|
|
112
|
-
if iface['type'] ==
|
|
113
|
-
|
|
112
|
+
if iface['type'] == 'physical'
|
|
113
|
+
config[:ip_to_access] = iface['subnets'][0]['address'].split('/')[0]
|
|
114
114
|
end
|
|
115
115
|
end
|
|
116
116
|
|
|
@@ -374,17 +374,21 @@ lxc.cgroup.devices.allow = b 7:* rwm"
|
|
|
374
374
|
conn.start_container(name, :sync=>"true")
|
|
375
375
|
|
|
376
376
|
if options[:'no-maas']
|
|
377
|
-
ip_or_fqdn =
|
|
377
|
+
ip_or_fqdn = config[:ip_to_access]
|
|
378
378
|
else
|
|
379
379
|
ip_or_fqdn = name + '.' + maas.get_domain
|
|
380
380
|
end
|
|
381
381
|
|
|
382
|
-
if
|
|
383
|
-
|
|
384
|
-
elsif conn.execute_command(name, "ls /etc/redhat-release")[:metadata][:return] == 0
|
|
385
|
-
default_user = 'centos'
|
|
382
|
+
if config[:default][:user] == config[:cloud_init][:users][0]['name']
|
|
383
|
+
default_user = config[:default][:user]
|
|
386
384
|
else
|
|
387
|
-
|
|
385
|
+
if conn.execute_command(name, "ls /etc/lsb-release")[:metadata][:return] == 0
|
|
386
|
+
default_user = 'ubuntu'
|
|
387
|
+
elsif conn.execute_command(name, "ls /etc/redhat-release")[:metadata][:return] == 0
|
|
388
|
+
default_user = 'centos'
|
|
389
|
+
else
|
|
390
|
+
default_user = config[:default][:user]
|
|
391
|
+
end
|
|
388
392
|
end
|
|
389
393
|
|
|
390
394
|
lxd_params[:default_user] = default_user
|
|
@@ -393,7 +397,7 @@ lxc.cgroup.devices.allow = b 7:* rwm"
|
|
|
393
397
|
logger.info("#{name} has been created.")
|
|
394
398
|
|
|
395
399
|
if options[:'no-maas']
|
|
396
|
-
puts "ssh #{default_user}@#{
|
|
400
|
+
puts "ssh #{default_user}@#{config[:ip_to_access]}"
|
|
397
401
|
else
|
|
398
402
|
puts "ssh #{default_user}@#{name}"
|
|
399
403
|
end
|
data/lib/sample_conf/gogetit.yml
CHANGED
|
@@ -56,6 +56,13 @@ chef:
|
|
|
56
56
|
lxd: http://chef.example.com/install_chef_script_for_lxd.sh
|
|
57
57
|
|
|
58
58
|
cloud_init:
|
|
59
|
+
apt:
|
|
60
|
+
primary:
|
|
61
|
+
- arches: [default]
|
|
62
|
+
uri: http://archive.ubuntu.com/ubuntu/
|
|
63
|
+
security:
|
|
64
|
+
- arches: [default]
|
|
65
|
+
uri: http://archive.ubuntu.com/ubuntu/
|
|
59
66
|
users:
|
|
60
67
|
- name: usera
|
|
61
68
|
gecos: usera
|
|
@@ -63,6 +70,10 @@ cloud_init:
|
|
|
63
70
|
groups: users, admin
|
|
64
71
|
shell: /bin/bash
|
|
65
72
|
lock_passwd: true
|
|
73
|
+
ssh_authorized_keys:
|
|
74
|
+
- ssh-rsa blahblahblah usera@desktop
|
|
75
|
+
|
|
76
|
+
cloud_init_helper:
|
|
66
77
|
ca_certs:
|
|
67
78
|
- http://pki.example.com/site/root_ca.crt
|
|
68
79
|
ssh_ca_public_key:
|
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.6
|
|
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-07-
|
|
11
|
+
date: 2018-07-31 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|