gogetit 0.1.17 → 0.1.18
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/Gemfile +2 -0
- data/bin/git_autoconfig.sh +4 -0
- data/lib/gogetit/cli.rb +12 -4
- data/lib/gogetit/version.rb +1 -1
- data/lib/sample_conf/gogetit.yml +5 -0
- data/lib/util.rb +28 -0
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 82fb5713fad52b472d154eab5830a5696a2ac5d3
|
|
4
|
+
data.tar.gz: 63bb2a42d787401965222e72c09eeac25b3aeabd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d2e43782f172ee97bdf3b8fe0d3c0bd65b2fe4fb1a93818a162698b950bb31b5a5b4f9ad8329651648e24b71c5c3541c4b8c8a546c666644ff26ee1034a09ce8
|
|
7
|
+
data.tar.gz: ff932ec49672bcb2a828a4337df3daf052be6aa5c274fa4849a6caba224c96f6027d31e27fa9540ee05ef895ae9571b4277a002825ef728ed65eb98354acb20e
|
data/Gemfile
CHANGED
data/lib/gogetit/cli.rb
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
require 'thor'
|
|
2
2
|
require 'gogetit'
|
|
3
|
+
require 'util'
|
|
3
4
|
|
|
4
5
|
module Gogetit
|
|
5
6
|
class CLI < Thor
|
|
7
|
+
include Gogetit::Util
|
|
6
8
|
package_name 'Gogetit'
|
|
7
9
|
|
|
8
10
|
desc 'list', 'List containers and instances, running currently.'
|
|
@@ -15,15 +17,17 @@ module Gogetit
|
|
|
15
17
|
end
|
|
16
18
|
|
|
17
19
|
desc 'create (TYPE) NAME', 'Create either a container or KVM domain.'
|
|
18
|
-
def create(type=
|
|
20
|
+
def create(type='lxd', name)
|
|
19
21
|
case type
|
|
20
|
-
when 'lxd'
|
|
22
|
+
when 'lxd'
|
|
21
23
|
Gogetit.lxd.create(name)
|
|
22
24
|
when 'libvirt'
|
|
23
25
|
Gogetit.libvirt.create(name)
|
|
24
26
|
else
|
|
25
|
-
|
|
27
|
+
abort('Invalid argument entered.')
|
|
26
28
|
end
|
|
29
|
+
# post-tasks
|
|
30
|
+
knife_bootstrap(name, type, Gogetit.config)
|
|
27
31
|
Gogetit.config[:default][:user] ||= ENV['USER']
|
|
28
32
|
puts "ssh #{Gogetit.config[:default][:user]}@#{name}"
|
|
29
33
|
end
|
|
@@ -33,12 +37,16 @@ module Gogetit
|
|
|
33
37
|
type = Gogetit.get_provider_of(name)
|
|
34
38
|
if type
|
|
35
39
|
case type
|
|
36
|
-
when 'lxd'
|
|
40
|
+
when 'lxd'
|
|
37
41
|
Gogetit.lxd.destroy(name)
|
|
38
42
|
when 'libvirt'
|
|
39
43
|
Gogetit.libvirt.destroy(name)
|
|
44
|
+
else
|
|
45
|
+
abort('Invalid argument entered.')
|
|
40
46
|
end
|
|
41
47
|
end
|
|
48
|
+
# post-tasks
|
|
49
|
+
knife_remove(name)
|
|
42
50
|
end
|
|
43
51
|
|
|
44
52
|
desc 'rebuild NAME', 'Destroy and create either a container or KVM domain again.'
|
data/lib/gogetit/version.rb
CHANGED
data/lib/sample_conf/gogetit.yml
CHANGED
|
@@ -13,6 +13,11 @@ lxd:
|
|
|
13
13
|
- my_favorite_bridge
|
|
14
14
|
libvirt:
|
|
15
15
|
url: qemu+ssh://WHOAMI@kvm.example.com/system
|
|
16
|
+
chef:
|
|
17
|
+
bootstrap:
|
|
18
|
+
install_script:
|
|
19
|
+
libvirt: http://chef.example.com/install_chef_script.sh
|
|
20
|
+
lxd: http://chef.example.com/install_chef_script_for_lxd.sh
|
|
16
21
|
|
|
17
22
|
# To configure LXD remote
|
|
18
23
|
# lxc remote add host_name host_fqdn --accept-certificate
|
data/lib/util.rb
CHANGED
|
@@ -1,8 +1,36 @@
|
|
|
1
|
+
require 'mkmf'
|
|
1
2
|
require 'net/ssh'
|
|
2
3
|
require 'active_support/core_ext/hash'
|
|
3
4
|
|
|
4
5
|
module Gogetit
|
|
5
6
|
module Util
|
|
7
|
+
def knife_bootstrap(name, type, config)
|
|
8
|
+
if find_executable 'knife'
|
|
9
|
+
if system('knife ssl check')
|
|
10
|
+
install_cmd = "curl \
|
|
11
|
+
-l #{config[:chef][:bootstrap][:install_script][type.to_sym]} \
|
|
12
|
+
| sudo bash -s --"
|
|
13
|
+
knife_cmd = "knife bootstrap -y #{name} \
|
|
14
|
+
--node-name #{name} \
|
|
15
|
+
--ssh-user ubuntu \
|
|
16
|
+
--sudo \
|
|
17
|
+
--bootstrap-install-command \"#{install_cmd}\""
|
|
18
|
+
system(knife_cmd)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def knife_remove(name)
|
|
24
|
+
if find_executable 'knife'
|
|
25
|
+
if system('knife ssl check')
|
|
26
|
+
puts "Deleting node #{name}.."
|
|
27
|
+
system("knife node delete -y #{name}")
|
|
28
|
+
puts "Deleting client #{name}.."
|
|
29
|
+
system("knife client delete -y #{name}")
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
6
34
|
def recognize_env
|
|
7
35
|
thedir = 'lib/env'
|
|
8
36
|
gateway = get_gateway(4)
|
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.1.
|
|
4
|
+
version: 0.1.18
|
|
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-07-
|
|
11
|
+
date: 2017-07-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -200,6 +200,7 @@ files:
|
|
|
200
200
|
- README.md
|
|
201
201
|
- Rakefile
|
|
202
202
|
- bin/console
|
|
203
|
+
- bin/git_autoconfig.sh
|
|
203
204
|
- bin/gogetit
|
|
204
205
|
- bin/setup
|
|
205
206
|
- gogetit.gemspec
|
|
@@ -240,7 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
240
241
|
version: '0'
|
|
241
242
|
requirements: []
|
|
242
243
|
rubyforge_project:
|
|
243
|
-
rubygems_version: 2.6.
|
|
244
|
+
rubygems_version: 2.6.11
|
|
244
245
|
signing_key:
|
|
245
246
|
specification_version: 4
|
|
246
247
|
summary: Libraries with a CLI tool for dealing with things like MAAS, LXD and Libvirt.
|