gogetit 0.15.1 → 0.15.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
- SHA1:
3
- metadata.gz: 464e5d5917a8099932499111b3540bc4583e3aea
4
- data.tar.gz: 48e2244bc27a2a78050ff2008112193a555db036
2
+ SHA256:
3
+ metadata.gz: 8df3851228231fb78944cfc6bd359085e06b543a8e8aa2635d805200b3431af0
4
+ data.tar.gz: 405754156d02512f66b46f29816a318c7fd408b4d82a323c7c1173142470d85b
5
5
  SHA512:
6
- metadata.gz: 34786d8600ecec360d2bb942ee9fcb9bcf4272745bf55760296146f02e0f789331a128503e318649c59859b9904955f2976f8ff27201956978f337502fdd2aaf
7
- data.tar.gz: bc38cea16984bf6215b62fe1ddbcbe28c82ad1c4601fbc79363053e8f50be8eb13e68be44318837498005f1960f35a01dbb706dfacfed53d925dc9d7170683ae
6
+ metadata.gz: e899cfdce09867e0ee0c6f18cce4462b048638aa89d22f91f69f317c14ac65919224a08d4487a8e79fd6f9c0533508864d2f7d387aae9ef7f6f33dc7f2aa3942
7
+ data.tar.gz: 47b1ca4e2f0d0452de15f5b9308c3ef099289d482a00b519343a42c268e6832f2f45e99362f49785acae589d56b2571c0d6c8726f2a2eb67020cc176805133c4
@@ -167,19 +167,20 @@ module Gogetit
167
167
  item_file = data_bags_dir+'/'+bag+'/'+item
168
168
  item = item.gsub('.json', '')
169
169
  if JSON.parse(File.read(item_file))['vault']
170
+ # We assumes you have configured 'mode' and 'admins' on your knife.rb
170
171
  if items_as_is.include? item
171
172
  run_command(
172
173
  "knife vault update #{bag} #{item} --json #{item_file}"\
173
- " --search '*:*' -M client"
174
+ " --search '*:*'"
174
175
  )
175
176
  else
176
177
  run_command(
177
178
  "knife vault create #{bag} #{item} --json #{item_file}"\
178
- " --search '*:*' -M client"
179
+ " --search '*:*'"
179
180
  )
180
181
  end
181
182
  run_command(
182
- "knife vault refresh #{bag} #{item} --clean-unknown-clients -M client"
183
+ "knife vault refresh #{bag} #{item} --clean-unknown-clients"
183
184
  )
184
185
  else
185
186
  run_command("knife data bag from file #{bag} #{item_file}")
@@ -1,3 +1,3 @@
1
1
  module Gogetit
2
- VERSION = "0.15.1"
2
+ VERSION = "0.15.2"
3
3
  end
@@ -52,8 +52,7 @@ module Gogetit
52
52
  args[:config] = {}
53
53
 
54
54
  if options['no-maas']
55
- args[:config][:'user.user-data'] = \
56
- YAML.load_file(options['file'])[:config]['user.user-data']
55
+ args[:config][:"user.user-data"] = {}
57
56
  else
58
57
  sshkeys = maas.get_sshkeys
59
58
  pkg_repos = maas.get_package_repos
@@ -163,13 +162,18 @@ echo \"RevokedKeys #{config[:cloud_init][:ssh_ca_public_key][:revocation_path]}\
163
162
 
164
163
  def generate_network_config(args, options)
165
164
  logger.info("Calling <#{__method__.to_s}>")
165
+
166
166
  if options['no-maas']
167
167
  args[:config][:'user.network-config'] = \
168
- YAML.load_file(options['file'])[:config][:'user.network-config']
168
+ YAML.load_file(options['file'])['network']
169
+
170
+ # physical device will be the gate device
171
+ args[:config][:"user.network-config"]['config'].each do |iface|
172
+ if iface['type'] == "physical"
173
+ options['ip_to_access'] = iface['subnets'][0]['address'].split('/')[0]
174
+ end
175
+ end
169
176
 
170
- options['ip_to_access'] = \
171
- args[:config][:"user.network-config"]['config'][1]['subnets'][0]['address']
172
- .split('/')[0]
173
177
  args[:config][:"user.network-config"] = \
174
178
  YAML.dump(args[:config][:"user.network-config"])[4..-1]
175
179
 
@@ -258,7 +262,15 @@ echo \"RevokedKeys #{config[:cloud_init][:ssh_ca_public_key][:revocation_path]}\
258
262
 
259
263
  if options['no-maas']
260
264
  args[:devices] = \
261
- YAML.load_file(options['file'])[:devices]
265
+ (Hashie.symbolize_keys YAML.load_file(options['file'])['devices'])
266
+ # Now, LXD API can handle integer as a value of a map
267
+ args[:devices].each do |k, v|
268
+ v.each do |kk, vv|
269
+ if vv.is_a? Integer
270
+ v[kk] = vv.to_s
271
+ end
272
+ end
273
+ end
262
274
 
263
275
  elsif options['ipaddresses']
264
276
  options[:ifaces].each_with_index do |iface,index|
@@ -387,6 +399,9 @@ echo \"RevokedKeys #{config[:cloud_init][:ssh_ca_public_key][:revocation_path]}\
387
399
  container = conn.container(name)
388
400
 
389
401
  container.devices = args[:devices].merge!(container.devices.to_hash)
402
+
403
+ require 'pry'; binding.pry
404
+
390
405
  conn.update_container(name, container)
391
406
  # Fetch container object again
392
407
  container = conn.container(name)
@@ -12,7 +12,6 @@
12
12
  ipv4: true
13
13
  address: 192.168.112.10/24
14
14
  gateway: 192.168.112.1
15
- mtu: 8954
16
15
  control: auto
17
16
  - type: physical
18
17
  name: eth1
@@ -20,7 +19,6 @@
20
19
  - type: static
21
20
  ipv4: true
22
21
  address: 192.168.113.10/24
23
- mtu: 8954
24
22
  control: auto
25
23
  - type: physical
26
24
  name: eth2
@@ -28,7 +26,6 @@
28
26
  - type: static
29
27
  ipv4: true
30
28
  address: 192.168.114.10/24
31
- mtu: 8954
32
29
  control: auto
33
30
  user.user-data:
34
31
  ssh_authorized_keys:
@@ -12,7 +12,6 @@
12
12
  ipv4: true
13
13
  address: 192.168.111.10/24
14
14
  gateway: 192.168.111.1
15
- mtu: 8954
16
15
  control: auto
17
16
  - type: vlan
18
17
  name: eth0.112
@@ -22,7 +21,6 @@
22
21
  - type: static
23
22
  ipv4: true
24
23
  address: 192.168.112.10/24
25
- mtu: 8954
26
24
  control: auto
27
25
  - type: vlan
28
26
  name: eth0.113
@@ -32,7 +30,6 @@
32
30
  - type: static
33
31
  ipv4: true
34
32
  address: 192.168.113.10/24
35
- mtu: 8954
36
33
  control: auto
37
34
  user.user-data:
38
35
  ssh_authorized_keys:
@@ -41,7 +38,7 @@
41
38
  apt_mirror: http://kr.archive.ubuntu.com/ubuntu
42
39
  :devices:
43
40
  :eth0:
44
- :mtu: '8954'
41
+ :mtu: "8954"
45
42
  :name: eth0
46
43
  :nictype: bridged
47
44
  :parent: $root_bridge
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.15.1
4
+ version: 0.15.2
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-02-14 00:00:00.000000000 Z
11
+ date: 2018-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -270,7 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
270
270
  version: '0'
271
271
  requirements: []
272
272
  rubyforge_project:
273
- rubygems_version: 2.6.14
273
+ rubygems_version: 2.7.6
274
274
  signing_key:
275
275
  specification_version: 4
276
276
  summary: Libraries with a CLI tool for dealing with things like MAAS, LXD and Libvirt.