gogetit 0.13.3 → 0.13.4

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: 72cd54a0ad132c717ee9f41ab1ed95780b0bf187
4
- data.tar.gz: 491088b0f57ee7d3255fdd70a571bfd69e47705b
3
+ metadata.gz: 0d0d6634916c43d284c3c64d56a19402bd52ec28
4
+ data.tar.gz: 20182e6ab4f093c106e4ab0c8e7d065f1d10f042
5
5
  SHA512:
6
- metadata.gz: 146863085cd397b6a1171902538748a5e5362b6c1eea302f205d664a2a52f9510d432d8f0dd46122f55e38a104bf6f58d3cd00b6d0052f11e3076bacaf33feb6
7
- data.tar.gz: 0a92a22944a6fe6eeadb9172b1005547ba28ea928831d4dc9142fff280c0f899230a06a600721f92a0def9f0235093db7c76a9ff3f228b7bee1ee6dbb8e3a66b
6
+ metadata.gz: bccceea8bedc6dd9a48e87ad5ff38b5614c9c72d16a9e187ce2f2cc86b3f94b33bb09d8bf5afe9b973c34563d143f1497f2462efaa68d015cc4d958958faca06
7
+ data.tar.gz: e6ada0bc22654ab719de5929e249644dc02e54baa12ad615403d68caa98b7925a1621346c0ab79e154cae759d20aa2a29d89bac0555018277eccd268154c49b5
@@ -59,8 +59,57 @@ module Gogetit
59
59
  dst = Dir.new(user_gogetit_home)
60
60
  logger.info('Copying GoGetIt default configuration..')
61
61
  FileUtils.cp(src, dst)
62
- abort('Please define default configuration for GoGetIt at ~/.gogetit/gogetit.yml.')
62
+ abort(
63
+ 'Please define default configuration for GoGetIt at ~/.gogetit/gogetit.yml.'
64
+ )
63
65
  end
64
66
  config.merge!(Hashie.symbolize_keys YAML.load_file(conf_file))
67
+
68
+ # to check if lxd is well deployed and configured.
69
+ if Dir.exist?("/home/ubuntu/.config/lxc")
70
+
71
+ if Dir.exist?("/home/ubuntu/.config/lxc/servercerts")
72
+
73
+ certificates = (
74
+ Dir.entries("/home/ubuntu/.config/lxc/servercerts") - ['.', '..']
75
+ )
76
+
77
+ if not certificates.empty?
78
+
79
+ config[:lxd][:nodes].each do |node|
80
+ if not certificates.include? "#{node[:name]}.crt"
81
+ puts "Unable to find the certificate for node, #{node[:name]}."
82
+ puts "You might need to run following command to accept the certificate"
83
+ puts "lxc remote add --accept-certificate #{node[:name]}"\
84
+ " #{node[:url]}"
85
+ end
86
+ end
87
+
88
+ end
89
+
90
+ else
91
+ abort(
92
+ 'Please check if remotes are properly registered with their certificates.'
93
+ )
94
+ end
95
+
96
+ else
97
+ abort('Please check if LXD is installed.')
98
+ end
99
+
100
+ config[:libvirt][:nodes].each do |node|
101
+ if node[:url].split('//')[0].include? "ssh"
102
+ if not ssh_available?(
103
+ node[:url].split('//')[1].split('/')[0].split('@')[1],
104
+ node[:url].split('//')[1].split('/')[0].split('@')[0]
105
+ )
106
+ puts "Please check the URL or SSH private key."
107
+ puts "OR SCP the previous .ssh folder if you are rebuilding"\
108
+ " your workstation."
109
+ puts "scp -r ~/.ssh ubuntu@#{`hostname -f`.chop!}:~/"
110
+ abort("Unable to make connection with #{node[:url]}.")
111
+ end
112
+ end
113
+ end
65
114
  end
66
115
  end
@@ -21,7 +21,7 @@ module Gogetit
21
21
  end
22
22
 
23
23
  def machine_exists?(name)
24
- logger.info("Calling <#{__method__.to_s}>")
24
+ logger.info("Calling <#{__method__.to_s}> for #{name}")
25
25
  conn.request(:get, ['machines']).each do |m|
26
26
  return true if m['hostname'] == name
27
27
  end
@@ -37,7 +37,7 @@ module Gogetit
37
37
  end
38
38
 
39
39
  def dnsresource_exists?(name)
40
- logger.info("Calling <#{__method__.to_s}>")
40
+ logger.info("Calling <#{__method__.to_s}> for #{name}")
41
41
  conn.request(:get, ['dnsresources']).each do |item|
42
42
  return true if item['fqdn'] == name + '.' + get_domain
43
43
  end
@@ -45,7 +45,7 @@ module Gogetit
45
45
  end
46
46
 
47
47
  def domain_name_exists?(name)
48
- logger.info("Calling <#{__method__.to_s}>")
48
+ logger.info("Calling <#{__method__.to_s}> for #{name}")
49
49
  return true if dnsresource_exists?(name) or machine_exists?(name)
50
50
  end
51
51
 
@@ -169,7 +169,7 @@ module Gogetit
169
169
  end
170
170
 
171
171
  def wait_until_available(ip_or_fqdn, distro_name)
172
- logger.info("Calling <#{__method__.to_s}>")
172
+ logger.info("Calling <#{__method__.to_s}> for network connection..")
173
173
  until ping_available?(ip_or_fqdn)
174
174
  logger.info("Calling <#{__method__.to_s}> for ping to be ready..")
175
175
  sleep 3
@@ -191,12 +191,14 @@ module Gogetit
191
191
  end
192
192
 
193
193
  def ssh_available?(ip_or_fqdn, user)
194
- logger.info("Calling <#{__method__.to_s}>")
194
+ logger.info("Calling <#{__method__.to_s}> for #{user}@#{ip_or_fqdn}")
195
195
  begin
196
- Net::SSH.start(ip_or_fqdn, user).class
196
+ Net::SSH.start(ip_or_fqdn, user)
197
197
  rescue Exception => e
198
198
  puts e
199
+ false
199
200
  end
201
+ true
200
202
  end
201
203
 
202
204
  def check_ip_available(addresses, maas)
@@ -1,3 +1,3 @@
1
1
  module Gogetit
2
- VERSION = "0.13.3"
2
+ VERSION = "0.13.4"
3
3
  end
@@ -62,7 +62,7 @@ module Gogetit
62
62
  end
63
63
 
64
64
  def container_exists?(name)
65
- logger.info("Calling <#{__method__.to_s}>")
65
+ logger.info("Calling <#{__method__.to_s}> for #{name}")
66
66
  list.each do |c|
67
67
  return true if c == name
68
68
  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.13.3
4
+ version: 0.13.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Don Draper
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-31 00:00:00.000000000 Z
11
+ date: 2018-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler