vagrant-vsphere-ddns 0.0.2 → 0.0.3
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/lib/vagrant-vsphere-ddns/action.rb +1 -1
- data/lib/vagrant-vsphere-ddns/action/get_ssh_info.rb +8 -2
- data/lib/vagrant-vsphere-ddns/action/wait_for_ip_address.rb +7 -6
- data/lib/vagrant-vsphere-ddns/config.rb +4 -3
- data/lib/vagrant-vsphere-ddns/errors.rb +1 -1
- data/lib/vagrant-vsphere-ddns/version.rb +1 -1
- data/locales/en.yml +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7e4f80120a9cdcb7906e07110c9d92904f87659
|
4
|
+
data.tar.gz: 30345f6af937a8b3a932dea8455498f034478124
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15e6361b1b6aec9e0bcf9ace4245e1db91bc97b75d0e0f356628adcb5a6f093658c677bae40b6cf9ccc976c4d21c0a11efb6cef9b945729ab95784b2428e9b63
|
7
|
+
data.tar.gz: 2a2f140d642bf195cb2b878396b8526a04b6bd0541bae8045a6a650e328a3c93b0c26d22bc5efc7a231f4dfef98f4f701e033a30f01783dc226433f29e1e59ca
|
@@ -16,7 +16,7 @@ module VagrantPlugins
|
|
16
16
|
# autoload
|
17
17
|
action_root = Pathname.new(File.expand_path('../action', __FILE__))
|
18
18
|
autoload :GetSshInfo, action_root.join('get_ssh_info')
|
19
|
-
autoload :WaitForIPAddress, action_root.join(
|
19
|
+
autoload :WaitForIPAddress, action_root.join('wait_for_ip_address')
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -15,7 +15,9 @@ module VagrantPlugins
|
|
15
15
|
def call(env)
|
16
16
|
env[:machine_ssh_info] = get_ssh_info(env[:vSphere_connection], env[:machine])
|
17
17
|
if !env[:machine_ssh_info].nil?
|
18
|
-
@logger.
|
18
|
+
@logger.debug("SSH info: #{env[:machine_ssh_info]}")
|
19
|
+
else
|
20
|
+
@logger.debug("SSH info is nil")
|
19
21
|
end
|
20
22
|
@app.call env
|
21
23
|
end
|
@@ -23,9 +25,12 @@ module VagrantPlugins
|
|
23
25
|
private
|
24
26
|
|
25
27
|
def get_ssh_info(connection, machine)
|
28
|
+
@logger.debug("machine.config.ddns.host is nil, plugin disabled") if machine.config.ddns.host.nil?
|
26
29
|
return nil if machine.config.ddns.host.nil?
|
27
|
-
|
30
|
+
@logger.warn("machine.id is nil") if machine.id.nil?
|
31
|
+
return nil if machine.id.nil?
|
28
32
|
vm = get_vm_by_uuid connection, machine
|
33
|
+
@logger.warn("get_vm_by_uuid is nil") if vm.nil?
|
29
34
|
return nil if vm.nil?
|
30
35
|
|
31
36
|
format_data = {}
|
@@ -33,6 +38,7 @@ module VagrantPlugins
|
|
33
38
|
break if card.nil?
|
34
39
|
format_data["mac#{id}".to_sym] = (card.macAddress.scan /[a-f0-9]/).join
|
35
40
|
end
|
41
|
+
@logger.debug("format_data: #{format_data}")
|
36
42
|
|
37
43
|
{
|
38
44
|
host: machine.config.ddns.host % format_data,
|
@@ -14,8 +14,9 @@ module VagrantPlugins
|
|
14
14
|
def call(env)
|
15
15
|
return if env[:machine_ssh_info].nil?
|
16
16
|
|
17
|
-
|
18
|
-
|
17
|
+
host = env[:machine_ssh_info][:host]
|
18
|
+
timeout = env[:machine].config.ddns.ssh_timeout
|
19
|
+
@logger.info("Trying to resolve #{host} (timeout #{timeout} seconds)")
|
19
20
|
|
20
21
|
Timeout.timeout(timeout) do
|
21
22
|
while true
|
@@ -23,11 +24,11 @@ module VagrantPlugins
|
|
23
24
|
return if env[:interrupted]
|
24
25
|
|
25
26
|
begin
|
26
|
-
ip_address = Resolv.getaddress(
|
27
|
-
@logger.info("Host #{
|
27
|
+
ip_address = Resolv.getaddress(host)
|
28
|
+
@logger.info("Host #{host} resolved to #{ip_address}")
|
28
29
|
break
|
29
30
|
rescue Resolv::ResolvError
|
30
|
-
@logger.warn("Could not resolve: #{
|
31
|
+
@logger.warn("Could not resolve: #{host}")
|
31
32
|
end
|
32
33
|
sleep 1
|
33
34
|
end
|
@@ -36,7 +37,7 @@ module VagrantPlugins
|
|
36
37
|
@app.call(env)
|
37
38
|
|
38
39
|
rescue Timeout::Error
|
39
|
-
raise Errors::IPAddrTimeout
|
40
|
+
raise Errors::IPAddrTimeout, host: host, timeout: timeout
|
40
41
|
end
|
41
42
|
|
42
43
|
end
|
@@ -7,12 +7,13 @@ module VagrantPlugins
|
|
7
7
|
attr_accessor :ssh_timeout
|
8
8
|
|
9
9
|
def initialize
|
10
|
-
@host =
|
11
|
-
@ssh_timeout =
|
10
|
+
@host = UNSET_VALUE
|
11
|
+
@ssh_timeout = UNSET_VALUE
|
12
12
|
end
|
13
13
|
|
14
14
|
def finalize!
|
15
|
-
@
|
15
|
+
@host = nil if @host == UNSET_VALUE
|
16
|
+
@ssh_timeout = 120 if @ssh_timeout == UNSET_VALUE
|
16
17
|
end
|
17
18
|
|
18
19
|
def validate(machine)
|
data/locales/en.yml
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-vsphere-ddns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: vagrant-vsphere
|