gogetit 0.10.0 → 0.11.0

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
  SHA1:
3
- metadata.gz: 90850298a6e02e953b7f0ebb6ed8e7cd7a4d47bd
4
- data.tar.gz: 2f5fca754895bcf3f5342b952c08b81a7819d64f
3
+ metadata.gz: 74c7dc23671b41961916855a8ccb7129d67ca051
4
+ data.tar.gz: 366f2f5e0dfee9692e40e9ea96401ce69b627a9d
5
5
  SHA512:
6
- metadata.gz: ee71a4680053f4b696bdebeceb9e366a97484f0ba1a2f2ea1a64aa3d121e24e9364a2536fb6c9848990ab5c097d29af5edb451b9677391669b57221dcd01ec14
7
- data.tar.gz: 83b2a138facc3e1b9616a737f7277baf204a6b763ff329a91f9aa23f7372657f1fcddd3923250968e49cce66cec8f3a13a59cbdecc50d4d4f13d0f55b8f6ded4
6
+ metadata.gz: d73e3e77111979f7770c8337dfded6e948d3a949f1891e2548bfef6c3c2d5c6166e07bc779422d1557a66a02be4347e1346b8398573d95e933585ae6e793dc82
7
+ data.tar.gz: b3b508fe66965b6a3e21abc16ae22ef324a19d84fa7ec716a70c9ea98f78e6ee1af8c06a1bed74d0d51e6c7f08d9eb7b2ea3b576e46adbd83964fc07822add32
@@ -1,5 +1,6 @@
1
1
  require 'mkmf'
2
2
  require 'net/ssh'
3
+ require 'net/http'
3
4
  require 'active_support/core_ext/hash'
4
5
  require 'json'
5
6
 
@@ -10,6 +11,19 @@ module Gogetit
10
11
  system(cmd)
11
12
  end
12
13
 
14
+ def get_http_content(url)
15
+ logger.info("Calling <#{__method__.to_s}> to get #{url}")
16
+ uri = URI.parse(url)
17
+ http = Net::HTTP.new(uri.host, uri.port)
18
+ res = http.request_post(uri.path, nil)
19
+ if res.code == "200"
20
+ res.body
21
+ else
22
+ logger.info("Unable to reach #{url}.")
23
+ nil
24
+ end
25
+ end
26
+
13
27
  def knife_bootstrap(name, provider, config, logger)
14
28
  logger.info("Calling <#{__method__.to_s}>")
15
29
  config[:chef][:target_environment] ||= '_default'
@@ -1,3 +1,3 @@
1
1
  module Gogetit
2
- VERSION = "0.10.0"
2
+ VERSION = "0.11.0"
3
3
  end
@@ -32,6 +32,7 @@ module Gogetit
32
32
  end
33
33
 
34
34
  def get_state(name)
35
+ logger.info("Calling <#{__method__.to_s}>")
35
36
  conn.container(name)[:status]
36
37
  end
37
38
 
@@ -74,6 +75,22 @@ module Gogetit
74
75
  # To disable to update apt database on first boot
75
76
  # so chef client can keep doing its job.
76
77
  args[:config][:'user.user-data']['package_update'] = false
78
+ args[:config][:'user.user-data']['package_upgrade'] = false
79
+
80
+ # To add truested root CA certificates
81
+ if config[:'cloud-config'] && config[:'cloud-config'][:'ca-certs']
82
+ args[:config][:'user.user-data']['ca-certs'] = {}
83
+ certs = []
84
+
85
+ config[:'cloud-config'][:'ca-certs'][:trusted].each do |ca|
86
+ content = get_http_content(ca)
87
+ certs.push(
88
+ /^-----BEGIN CERTIFICATE-----.*-/m.match(content).to_s
89
+ ) if content
90
+ end
91
+
92
+ args[:config][:'user.user-data']['ca-certs'] = { 'trusted' => certs }
93
+ end
77
94
 
78
95
  args[:config][:"user.user-data"] = \
79
96
  "#cloud-config\n" + YAML.dump(args[:config][:"user.user-data"])[4..-1]
@@ -173,6 +190,7 @@ module Gogetit
173
190
 
174
191
  # To configure devices
175
192
  def generate_devices(args, options)
193
+ logger.info("Calling <#{__method__.to_s}>")
176
194
  args[:devices] = {}
177
195
 
178
196
  if options['no-maas']
@@ -244,6 +262,7 @@ module Gogetit
244
262
  end
245
263
 
246
264
  def reserve_ips(name, options, container)
265
+ logger.info("Calling <#{__method__.to_s}>")
247
266
  # Generate params to reserve IPs
248
267
  options[:ifaces].each_with_index do |iface,index|
249
268
  if index == 0
@@ -2,6 +2,15 @@ default:
2
2
  user: ubuntu
3
3
  root_bridge: $root_bridge
4
4
 
5
+ #cloud-init
6
+ cloud-config:
7
+ write_files:
8
+ - ca_public_key_url: http://pki.example.com/site/ssh_ca.pub
9
+ path: /etc/ssh/ca.pub
10
+ ca-certs:
11
+ trusted:
12
+ - http://pki.example.com/site/root_ca.crt
13
+
5
14
  maas:
6
15
  key: K:E:Y
7
16
  url: http://maas.example.com/MAAS/api/2.0
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.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Don Draper
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-15 00:00:00.000000000 Z
11
+ date: 2018-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler