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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba25e354af7e871467815ee7ee211978b13fd2b1
4
- data.tar.gz: 1056a526be418a64b7f4f08ee42c6195e1b16372
3
+ metadata.gz: 50839ba142f697a535889fdeb14730b24b257a57
4
+ data.tar.gz: be5d2bb3ed08a08174858af92a4914994f380b31
5
5
  SHA512:
6
- metadata.gz: 6740ad1b301616c777da614f28c54da58b1c1f6885bc66c13cf79055c6fddaac80c15ea8e3583ba2524b68508b357a736380a2189af4c1f26652e06723cc0e4b
7
- data.tar.gz: af8648d442cf64042c3c358573a7ba5390a509a65bc1abe339abc7c783b5056958123e2df4c190456a09f277184c5c78673b8cc3a0c8e850d71d931227c11066
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
- gogetit rebuild kvm01
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 (TYPE) NAME', 'Create either a container or KVM domain.'
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, type, Gogetit.config, Gogetit.logger)
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
- type = Gogetit.get_provider_of(name)
55
- if type
56
- case type
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
- desc 'rebuild NAME', 'Destroy and create either a container or KVM domain again.'
73
- def rebuild(type=nil, name)
74
- invoke :destroy, [name]
75
- invoke :create, [type, name]
76
- end
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, type, config, logger)
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][type.to_sym]} \
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
- (Dir.entries("#{data_bags_dir}/#{bag}").select do |f|
32
- /^((?!keys).)*\.json/.match(f)
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
@@ -1,3 +1,3 @@
1
1
  module Gogetit
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
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.0
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-14 00:00:00.000000000 Z
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.yaml
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