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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e97a91cc097dadbd37d312c351a9b0e45bd5b21b
4
- data.tar.gz: 66c19e1bd6a8c6fd95df74ebc444a0abef6027b6
3
+ metadata.gz: b7e4f80120a9cdcb7906e07110c9d92904f87659
4
+ data.tar.gz: 30345f6af937a8b3a932dea8455498f034478124
5
5
  SHA512:
6
- metadata.gz: 4db20af3d8ade721965180c4069f61111d3818513fbed0cb02a9df1c0eb54d151a193407a9ce7f21e7144b2c15d96068868926b7295489ae39742333d854aa9a
7
- data.tar.gz: c0f09e92715a71a185678975eedc22369780199928cfd6474f70ea4ec13d954aa3eae2b0f4cc6ab1a5d752cb0a85b836941459059223d7a52cd7353ee0a187a1
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("wait_for_ip_address")
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.info("SSH info: %s:%s" % [env[:machine_ssh_info][:host], env[:machine_ssh_info][:port]])
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
- return nil if machine.id.nil?
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
- timeout = env[:machine].config.ddns.ssh_timeout
18
- @logger.info("Trying to resolve #{env[:machine_ssh_info][:host]} (timeout #{timeout} seconds)")
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(env[:machine_ssh_info][:host])
27
- @logger.info("Host #{env[:machine_ssh_info][:host]} resolved to #{ip_address}")
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: #{env[:machine_ssh_info][:host]}")
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 = nil
11
- @ssh_timeout = nil
10
+ @host = UNSET_VALUE
11
+ @ssh_timeout = UNSET_VALUE
12
12
  end
13
13
 
14
14
  def finalize!
15
- @ssh_timeout = 120 if @ssh_timeout.nil?
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)
@@ -1,7 +1,7 @@
1
1
  require 'vagrant'
2
2
 
3
3
  module VagrantPlugins
4
- module VSphereDNS
4
+ module VSphereDDNS
5
5
  module Errors
6
6
  class VSphereDDNSError < Vagrant::Errors::VagrantError
7
7
  error_namespace("vagrant-vsphere-ddns.errors")
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module VSphereDDNS
3
- VERSION = '0.0.2'
3
+ VERSION = '0.0.3'
4
4
  end
5
5
  end
data/locales/en.yml CHANGED
@@ -2,4 +2,4 @@ en:
2
2
  vagrant-vsphere-ddns:
3
3
  errors:
4
4
  ip_addr_timeout: |-
5
- Could not resolve host within timeout
5
+ Could not resolve host %{host} within timeout %{timeout}s
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.2
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-06-22 00:00:00.000000000 Z
11
+ date: 2016-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: vagrant-vsphere