gogetit 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/gogetit/cli.rb +12 -10
- data/lib/gogetit/util.rb +8 -4
- data/lib/gogetit/version.rb +1 -1
- data/lib/sample_conf/{lxd_profile.yaml → lxd_profile.yml} +0 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50839ba142f697a535889fdeb14730b24b257a57
|
4
|
+
data.tar.gz: be5d2bb3ed08a08174858af92a4914994f380b31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07293a16bcc9666c3953122344de58ffd930dc9358f3bb4edcba474b3d5e075d8c5568c8ba8f99ef0c17cd04e5603f30f5beddfc72ce07909778d286ff61549f
|
7
|
+
data.tar.gz: 014c4ebd0557c194db8cc6368f727c3009554e750843125ffa1c7a39bec56ae79f4bab3191cde2b490fe51ec19bad9aa10675705c487c4800e7d4fc1d77da0ee
|
data/README.md
CHANGED
@@ -60,7 +60,9 @@ gogetit create kvm01 -p libvirt -i 192.168.10.10 10.0.0.2
|
|
60
60
|
# gogetit create kvm01 -p bare
|
61
61
|
|
62
62
|
gogetit destroy lxd01
|
63
|
-
|
63
|
+
|
64
|
+
# This feature is broken and might be deprecated in the future.
|
65
|
+
# gogetit rebuild kvm01
|
64
66
|
|
65
67
|
# to create a container bootstrapping as a chef node
|
66
68
|
gogetit create chef01 --chef
|
data/lib/gogetit/cli.rb
CHANGED
@@ -16,7 +16,7 @@ module Gogetit
|
|
16
16
|
system("virsh -c #{Gogetit.config[:libvirt][:url]} list --all")
|
17
17
|
end
|
18
18
|
|
19
|
-
desc 'create
|
19
|
+
desc 'create NAME', 'Create either a container or KVM domain.'
|
20
20
|
method_option :provider, :aliases => '-p', :type => :string, \
|
21
21
|
:default => 'lxd', :desc => 'A provider such as lxd and libvirt'
|
22
22
|
method_option :chef, :aliases => '-c', :type => :boolean, \
|
@@ -41,7 +41,7 @@ module Gogetit
|
|
41
41
|
|
42
42
|
# post-tasks
|
43
43
|
if options[:chef]
|
44
|
-
knife_bootstrap(name,
|
44
|
+
knife_bootstrap(name, options[:provider], Gogetit.config, Gogetit.logger)
|
45
45
|
update_vault(Gogetit.config, Gogetit.logger)
|
46
46
|
end
|
47
47
|
Gogetit.config[:default][:user] ||= ENV['USER']
|
@@ -51,9 +51,10 @@ module Gogetit
|
|
51
51
|
desc 'destroy NAME', 'Destroy either a container or KVM domain.'
|
52
52
|
method_option :chef, :type => :boolean, :desc => "Enable chef awareness."
|
53
53
|
def destroy(name)
|
54
|
-
|
55
|
-
|
56
|
-
|
54
|
+
# Let Gogetit recognize the provider.
|
55
|
+
provider = Gogetit.get_provider_of(name)
|
56
|
+
if provider
|
57
|
+
case provider
|
57
58
|
when 'lxd'
|
58
59
|
Gogetit.lxd.destroy(name)
|
59
60
|
when 'libvirt'
|
@@ -69,10 +70,11 @@ module Gogetit
|
|
69
70
|
end
|
70
71
|
end
|
71
72
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
73
|
+
# This feature is broken and might be deprecated in the future.
|
74
|
+
# desc 'rebuild NAME', 'Destroy and create either a container or KVM domain again.'
|
75
|
+
# def rebuild(type=nil, name)
|
76
|
+
# invoke :destroy, [name]
|
77
|
+
# invoke :create, [type, name]
|
78
|
+
# end
|
77
79
|
end
|
78
80
|
end
|
data/lib/gogetit/util.rb
CHANGED
@@ -4,12 +4,12 @@ require 'active_support/core_ext/hash'
|
|
4
4
|
|
5
5
|
module Gogetit
|
6
6
|
module Util
|
7
|
-
def knife_bootstrap(name,
|
7
|
+
def knife_bootstrap(name, provider, config, logger)
|
8
8
|
logger.info("Calling <#{__method__.to_s}>")
|
9
9
|
if find_executable 'knife'
|
10
10
|
if system('knife ssl check')
|
11
11
|
install_cmd = "curl \
|
12
|
-
-l #{config[:chef][:bootstrap][:install_script][
|
12
|
+
-l #{config[:chef][:bootstrap][:install_script][provider.to_sym]} \
|
13
13
|
| sudo bash -s --"
|
14
14
|
knife_cmd = "knife bootstrap -y #{name} \
|
15
15
|
--node-name #{name} \
|
@@ -26,12 +26,16 @@ module Gogetit
|
|
26
26
|
def update_vault(config, logger)
|
27
27
|
logger.info("Calling <#{__method__.to_s}>")
|
28
28
|
# It assumes the data_bags directory is under the root directory of Chef Repo
|
29
|
+
vaults = `knife vault list`.split
|
29
30
|
data_bags_dir = "#{config[:chef][:chef_repo_root]}/data_bags"
|
30
31
|
(Dir.entries("#{data_bags_dir}") - ['.', '..']).each do |bag|
|
31
|
-
(
|
32
|
-
|
32
|
+
(
|
33
|
+
(Dir.entries("#{data_bags_dir}/#{bag}") - ['.', '..']).select do |f|
|
34
|
+
# it will only take the bags created by vault command.
|
35
|
+
/^.*_keys.json/.match(f)
|
33
36
|
end
|
34
37
|
).each do |item|
|
38
|
+
item.slice! '_keys'
|
35
39
|
puts 'Refreshing vaults..'
|
36
40
|
refresh_cmd = "knife vault refresh #{bag} #{item.gsub('.json', '')} --clean-unknown-clients"
|
37
41
|
puts refresh_cmd
|
data/lib/gogetit/version.rb
CHANGED
File without changes
|
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.5.
|
4
|
+
version: 0.5.1
|
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-09-
|
11
|
+
date: 2017-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -216,7 +216,7 @@ files:
|
|
216
216
|
- lib/providers/libvirt.rb
|
217
217
|
- lib/providers/lxd.rb
|
218
218
|
- lib/sample_conf/gogetit.yml
|
219
|
-
- lib/sample_conf/lxd_profile.
|
219
|
+
- lib/sample_conf/lxd_profile.yml
|
220
220
|
- lib/template/disk.xml
|
221
221
|
- lib/template/domain.xml
|
222
222
|
- lib/template/nic.xml
|