gogetit 0.10.0 → 0.11.0
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 +14 -0
- data/lib/gogetit/version.rb +1 -1
- data/lib/providers/lxd.rb +19 -0
- data/lib/sample_conf/gogetit.yml +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74c7dc23671b41961916855a8ccb7129d67ca051
|
4
|
+
data.tar.gz: 366f2f5e0dfee9692e40e9ea96401ce69b627a9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d73e3e77111979f7770c8337dfded6e948d3a949f1891e2548bfef6c3c2d5c6166e07bc779422d1557a66a02be4347e1346b8398573d95e933585ae6e793dc82
|
7
|
+
data.tar.gz: b3b508fe66965b6a3e21abc16ae22ef324a19d84fa7ec716a70c9ea98f78e6ee1af8c06a1bed74d0d51e6c7f08d9eb7b2ea3b576e46adbd83964fc07822add32
|
data/lib/gogetit/util.rb
CHANGED
@@ -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'
|
data/lib/gogetit/version.rb
CHANGED
data/lib/providers/lxd.rb
CHANGED
@@ -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
|
data/lib/sample_conf/gogetit.yml
CHANGED
@@ -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.
|
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:
|
11
|
+
date: 2018-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|