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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 56768c5597c785d376b338f377fc5e4ed1e80513ada5c78bd1a2b8d766ebeaa6
4
- data.tar.gz: 961f3621c7b86aa4f3f7f057994c61f4d3952038215395b489ba7fe57483f06b
3
+ metadata.gz: 3a6930d64b643d6e2dbc4e49957a6a89f6667abbbecf2b80519ceb2572ca334c
4
+ data.tar.gz: 99506b2526e06fd65dc9009719cb88855bb97ba07e796bc5e37309ff385dd6ee
5
5
  SHA512:
6
- metadata.gz: f703dce8b2d9f0cb5ee54a6fec244aa32988e5c6e84ef1b5af86ceb9af09793c06e9e78aa149ed1c56749641b51d7db7b7ecdebe785af8a80c6c8dc199ad7292
7
- data.tar.gz: c37784f2ff981c7a1c50008ddffb17bd3bb15d9d36312070aff9b93c4c1e37675b6ac75d6750b65fd4545b537fbd3ba79694e1fc4531358570a259ed141fc65a
6
+ metadata.gz: e18c2ffdcbc08b80164241af0f89844d758db902865d95a2418913ce2afc781fae0b09e1669ed1462e577c7ecc498b688b288dd1c6b7e53f7c9d746fd44ec867
7
+ data.tar.gz: c2b7b70114758503dc93a034f6f0803570e6e56dd721f4aeac6ff27e3e40e3833b8685492fb722cf8486eb0f7900fa2984ec99e658a28764bd2f519049a99d84
@@ -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][:ssh_ca_public_key]
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][:ssh_ca_public_key][:key_url])
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][: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]
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][:ssh_ca_public_key][:revocation_url]
314
- content = get_http_content(config[:cloud_init_helper][:ssh_ca_public_key][:revocation_url])
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][:ssh_ca_public_key][:revocation_path]} \
319
- #{config[:cloud_init_helper][:ssh_ca_public_key][:revocation_url]}"
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][:ssh_ca_public_key][:revocation_path]}\" \
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
@@ -1,3 +1,3 @@
1
1
  module Gogetit
2
- VERSION = "0.22.7"
2
+ VERSION = "0.22.10"
3
3
  end
@@ -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
- wait_until_available(fqdn, distro_name)
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, distro_name, commands)
297
+ run_through_ssh(fqdn, default_user, commands)
290
298
  end
291
299
 
292
300
  logger.info("#{name} has been created.")
293
- puts "ssh #{distro_name}@#{name}"
301
+ puts "ssh #{default_user}@#{name}"
294
302
 
295
303
  info = {}
296
- info[:distro] = distro
297
- info[:default_user] = distro_name
304
+ info[:distro] = distro_name
305
+ info[:default_user] = default_user
298
306
 
299
307
  { result: true, info: info }
300
308
  end
@@ -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
- options[:ifaces] = check_ip_available(options[:ipaddresses], maas)
121
+ config[:ifaces] = check_ip_available(options[:ipaddresses], maas)
122
122
  abort("There is no dns server specified for the gateway network.") \
123
- unless options[:ifaces][0]['dns_servers'][0]
123
+ unless config[:ifaces][0]['dns_servers'][0]
124
124
  abort("There is no gateway specified for the gateway network.") \
125
- unless options[:ifaces][0]['gateway_ip']
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' => options[:ifaces][0]['dns_servers'][0]
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
- options[:ifaces].each_with_index do |iface,index|
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 options[:ifaces][0]['vlan']['name'] != 'untagged'
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 options[:ifaces][0]['vlan']['name'] == 'untagged'
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
- options[:ifaces].each_with_index do |iface,index|
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 options[:ifaces][0]['vlan']['name'] == 'untagged' and index > 0,
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 options[:ifaces][0]['vlan']['name'] != 'untagged'
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
- options[:ifaces].each_with_index do |iface,index|
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 options[:ifaces][0]['vlan']['name'] == 'untagged'
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 options[:ifaces][0]['vlan']['name'] != 'untagged'
315
+ elsif config[:ifaces][0]['vlan']['name'] != 'untagged'
315
316
  params = {
316
317
  'subnet' => iface['cidr'],
317
318
  'ip' => iface['ip'],
@@ -75,11 +75,11 @@ cloud_init:
75
75
 
76
76
  cloud_init_helper:
77
77
  ca_certs:
78
- - http://pki.example.com/site/root_ca.crt
79
- ssh_ca_public_key:
80
- key_url: http://pki.example.com/site/ssh_ca.pub
81
- key_path: /etc/ssh/ca.pub
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/ca.pub
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.7
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-02 00:00:00.000000000 Z
11
+ date: 2018-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler