gogetit 0.12.4 → 0.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/gogetit.gemspec +1 -0
- data/lib/gogetit/cli.rb +17 -3
- data/lib/gogetit/version.rb +1 -1
- data/lib/providers/lxd.rb +36 -1
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbfc744d5a525b73c6e5e8678f2759ed2d89c897
|
4
|
+
data.tar.gz: 64f3822d9769c1b8cad49398cdad55d2e76d27b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79f413b370f4dc96cc15e95b18ec1e454f02a41516961b97f4d7bf528abecbf1971329b622ba11d31da9da113cb8caeff149dea264b7c6d98254abf53c5d0662
|
7
|
+
data.tar.gz: a9d76a466ac176a8769283d54fcb2cb38c2d2f338450373244301cef070c4c9926329ffedb86ff9b186702f3f3feaf441e2af2a7ccfa072ec7d2f5ea1a973f95
|
data/gogetit.gemspec
CHANGED
data/lib/gogetit/cli.rb
CHANGED
@@ -28,10 +28,24 @@ module Gogetit
|
|
28
28
|
end
|
29
29
|
|
30
30
|
desc 'list', 'List containers and instances, running currently.'
|
31
|
+
method_option :out, :aliases => '-o', :type => :string, \
|
32
|
+
:default => '', :desc => 'to list from all remotes'
|
31
33
|
def list
|
32
|
-
|
33
|
-
|
34
|
-
|
34
|
+
case options[:out]
|
35
|
+
when 'custom'
|
36
|
+
lxd.list_all_containers
|
37
|
+
when 'all'
|
38
|
+
config[:lxd][:nodes].each do |node|
|
39
|
+
puts "Listing LXD containers on #{node[:url]}.."
|
40
|
+
system("lxc list #{node[:name]}:")
|
41
|
+
end
|
42
|
+
when ''
|
43
|
+
puts "Listing LXD containers on #{config[:lxd][:nodes][0][:url]}.."
|
44
|
+
system("lxc list #{config[:lxd][:nodes][0][:name]}:")
|
45
|
+
puts ''
|
46
|
+
else
|
47
|
+
puts "Invalid option or command"
|
48
|
+
end
|
35
49
|
puts "Listing KVM domains on #{config[:libvirt][:nodes][0][:url]}.."
|
36
50
|
system("virsh -c #{config[:libvirt][:nodes][0][:url]} list --all")
|
37
51
|
end
|
data/lib/gogetit/version.rb
CHANGED
data/lib/providers/lxd.rb
CHANGED
@@ -2,6 +2,7 @@ require 'hyperkit'
|
|
2
2
|
require 'gogetit/util'
|
3
3
|
require 'yaml'
|
4
4
|
require 'hashie'
|
5
|
+
require 'table_print'
|
5
6
|
|
6
7
|
module Gogetit
|
7
8
|
class GogetLXD
|
@@ -14,11 +15,43 @@ module Gogetit
|
|
14
15
|
@conn = Hyperkit::Client.new(
|
15
16
|
api_endpoint: config[:lxd][:nodes][0][:url],
|
16
17
|
verify_ssl: false
|
17
|
-
|
18
|
+
)
|
18
19
|
@maas = maas
|
19
20
|
@logger = logger
|
20
21
|
end
|
21
22
|
|
23
|
+
def list_all_containers
|
24
|
+
logger.debug("Calling <#{__method__.to_s}>")
|
25
|
+
|
26
|
+
config[:lxd][:nodes].each do |node|
|
27
|
+
puts "Listing LXC containers on #{node[:url]}..."
|
28
|
+
conn = Hyperkit::Client.new(
|
29
|
+
api_endpoint: node[:url],
|
30
|
+
verify_ssl: false
|
31
|
+
)
|
32
|
+
|
33
|
+
nodes = []
|
34
|
+
conn.containers.each do |con|
|
35
|
+
row = {}
|
36
|
+
row[:name] = conn.container(con).to_hash[:name]
|
37
|
+
row[:status] = conn.container_state(con).to_hash[:status].upcase
|
38
|
+
if conn.container_state(con).to_hash[:network] && \
|
39
|
+
conn.container_state(con).to_hash[:network][:eth0] && \
|
40
|
+
conn.container_state(con).to_hash[:network][:eth0][:addresses] && \
|
41
|
+
conn.container_state(con).to_hash[:network][:eth0][:addresses][0] && \
|
42
|
+
conn.container_state(con).to_hash[:network][:eth0][:addresses][0][:address]
|
43
|
+
row[:ipv4] = \
|
44
|
+
conn.container_state(con).to_hash[:network][:eth0][:addresses][0][:address]
|
45
|
+
else
|
46
|
+
row[:ipv4] = "NA"
|
47
|
+
end
|
48
|
+
nodes << row
|
49
|
+
end
|
50
|
+
tp nodes, :name, :status, :ipv4
|
51
|
+
puts
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
22
55
|
def list
|
23
56
|
logger.info("Calling <#{__method__.to_s}>")
|
24
57
|
conn.containers
|
@@ -50,6 +83,8 @@ module Gogetit
|
|
50
83
|
|
51
84
|
args[:config] = {}
|
52
85
|
|
86
|
+
args[:config][:"user.user-data"]['maas'] = true
|
87
|
+
|
53
88
|
if options['no-maas']
|
54
89
|
args[:config][:'user.user-data'] = \
|
55
90
|
YAML.load_file(options['file'])[:config]['user.user-data']
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gogetit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Don Draper
|
@@ -192,6 +192,20 @@ dependencies:
|
|
192
192
|
- - "~>"
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: 3.5.5
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: table_print
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - "~>"
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: 1.5.6
|
202
|
+
type: :runtime
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - "~>"
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: 1.5.6
|
195
209
|
description: |2
|
196
210
|
This provides the ways that deal with mutiple virtualized and containerized solutions such as Libvirt(KVM) and LXD.
|
197
211
|
This uses MAAS for bare-metal provision(KVM machine using Libvirt), DHCP and DNS.
|