vagrant-xenserver 0.0.8 → 0.0.9

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: 21d130e14805be4d3322b14f8e9210e512b9ddca
4
- data.tar.gz: f6b52d37d73fe2fbb8bb6a507049b2af353f7e81
3
+ metadata.gz: c36e407b54f5793660b1d301dca4043ab1027588
4
+ data.tar.gz: a36f6232bc1afee81fbeb034a38a1b9954fde56b
5
5
  SHA512:
6
- metadata.gz: 5fc5a26835d2fdd138c3059fc08ffcbc6ebc06d3a7af8429cc00682363ffc706547597370d7ac54d56e0d9f4c67713b617f36049597819652775a9cda6461e81
7
- data.tar.gz: 78ffce3ab5bf2f16debc6593759dfb62d663c56f3afc23c49f8a44494fb4ee549a51975af7c2676646c4b928b450e2e159548ce57dad7ee84f515c3bc6dd166d
6
+ metadata.gz: 0d0d585621e5cf7e9f0b9d9b6a73b1c264c4fa656788dd95fe8a1cc9240a162c65bc8c31b0c66f627b17b4dfcb236181c92fc44e5a4c71a3982ff2727845aac8
7
+ data.tar.gz: beaf065687e10e559d7eb529e4ea727f454655b0fa7340baac3fe3304f7d8bfd365415ca3078cd6f50fcb4262e0726b40f1902be5f09925d6ef5f9b793868296
@@ -20,7 +20,7 @@ module VagrantPlugins
20
20
 
21
21
  env[:my_vdi] = clone
22
22
 
23
- @logger.info("clone VDI="+clone)
23
+ @logger.info("clone VDI=#{clone}")
24
24
 
25
25
  @app.call(env)
26
26
  end
@@ -1,5 +1,25 @@
1
1
  require 'nokogiri'
2
2
  require 'socket'
3
+ require 'rbconfig'
4
+
5
+ def os
6
+ @os ||= (
7
+ host_os = RbConfig::CONFIG['host_os']
8
+ case host_os
9
+ when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
10
+ :windows
11
+ when /darwin|mac os/
12
+ :macosx
13
+ when /linux/
14
+ :linux
15
+ when /solaris|bsd/
16
+ :unix
17
+ else
18
+ raise Vagrant::Errors::UnknownOS # "unknown os: #{host_os.inspect}"
19
+ end
20
+ )
21
+ end
22
+
3
23
 
4
24
  module VagrantPlugins
5
25
  module XenServer
@@ -41,9 +61,23 @@ module VagrantPlugins
41
61
  def read_host_ip(machine,env)
42
62
  ip = Socket.getaddrinfo(env[:machine].provider_config.xs_host,nil)[0][2]
43
63
  env[:xs_host_ip] = ip
44
- re = /src ([0-9\.]+)/
45
- match = `ip route get to #{ip} | head -n 1`.match re
46
- match[1]
64
+ def get_local_ip_linux(ip)
65
+ re = /src ([0-9\.]+)/
66
+ match = `ip route get to #{ip} | head -n 1`.match re
67
+ match[1]
68
+ end
69
+ def get_local_ip_mac(ip)
70
+ re = /interface: ([a-z0-9]+)/
71
+ match = `route get #{ip} | grep interface | head -n 1`.match re
72
+ interface = match[1]
73
+ re = /inet ([0-9\.]+)/
74
+ match = `ifconfig #{interface} inet | tail -1`.match re
75
+ match[1]
76
+ end
77
+ if os == :linux then get_local_ip_linux(ip)
78
+ elsif os == :macosx then get_local_ip_mac(ip)
79
+ else raise Vagrant::Errors::UnknownOS # "unknown os: #{host_os.inspect}"
80
+ end
47
81
  end
48
82
  end
49
83
  end
@@ -23,6 +23,9 @@ module VagrantPlugins
23
23
  error_key(:api_error)
24
24
  end
25
25
 
26
+ class UnknownOS < VagrantXenServerError
27
+ error_key(:unknown_os)
28
+ end
26
29
  end
27
30
  end
28
31
  end
@@ -1,6 +1,6 @@
1
1
  module VagrantPlugins
2
2
  module XenServer
3
- VERSION = "0.0.8"
3
+ VERSION = "0.0.9"
4
4
  end
5
5
  end
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-xenserver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Ludlam
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-08 00:00:00.000000000 Z
11
+ date: 2014-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  version: '0'
87
87
  requirements: []
88
88
  rubyforge_project:
89
- rubygems_version: 2.2.2
89
+ rubygems_version: 2.4.1
90
90
  signing_key:
91
91
  specification_version: 4
92
92
  summary: Enables Vagrant to manage XenServers.