vmesh 0.1.7 → 0.1.11

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: 13acc89f7123087a1be93e4e2f58888372bbab23
4
- data.tar.gz: 51ce17731a26efaa36b16cb8dd6c982c8b15277e
3
+ metadata.gz: 16b4f7444b68395227a86910e9dd5d826c763ff4
4
+ data.tar.gz: e3bf41bda22c6b68a57b230324f0b4c526bf8b3d
5
5
  SHA512:
6
- metadata.gz: a14c8c8b35a3ef39bab783f5b54a364d816c74086c6b762e5720138138e18543b746c9155838685f8d0c0d76bae378b6014379739f1b2715773d0aa4883f72e1
7
- data.tar.gz: 86f5d7ac04306cfa0d79047bd71947ce62db8b50b4a23ea4e6512fe44152ff4524821342679c56d7e874a198ab0976d2da81c37f4a915248c73b3b564b1e158c
6
+ metadata.gz: b1bb4ea1f036397585c411c710cbbf3d5e8abb0f28a00fea02deb0221ebef6ffffbd56edc372022a89e6ea2d07c85a4cd7e319c4b1449325067d787c18d9d9d1
7
+ data.tar.gz: fbf1c771d30cf3e9a620200acdad87a89ba007e3ea59e38ab65d5d16728eecb63c71edc031919bb2600a5ff60b0345048d2090b53c9f00b9327f0ef926a1f0c4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- vmesh (0.1.6)
4
+ vmesh (0.1.7)
5
5
  gli (= 2.9.0)
6
6
  highline (~> 1.6)
7
7
  logger (= 1.2.8)
@@ -29,7 +29,7 @@ GEM
29
29
  gherkin (2.12.2)
30
30
  multi_json (~> 1.3)
31
31
  gli (2.9.0)
32
- highline (1.6.21)
32
+ highline (1.7.2)
33
33
  json (1.8.1)
34
34
  logger (1.2.8)
35
35
  metaclass (0.0.4)
@@ -49,7 +49,7 @@ GEM
49
49
  json (~> 1.4)
50
50
  rspec-expectations (2.14.5)
51
51
  diff-lcs (>= 1.1.3, < 2.0)
52
- trollop (2.1.1)
52
+ trollop (2.1.2)
53
53
 
54
54
  PLATFORMS
55
55
  ruby
data/bin/vmesh CHANGED
@@ -1,16 +1,18 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'gli'
3
- begin # XXX: Remove this begin/rescue before distributing your app
3
+ #begin # XXX: Remove this begin/rescue before distributing your app
4
4
  require 'vmesh'
5
5
  require 'logger'
6
6
  require 'highline/import'
7
7
 
8
+ =begin
8
9
  rescue LoadError
9
10
  STDERR.puts "In development, you need to use `bundle exec bin/vmesh` to run your app"
10
11
  STDERR.puts "At install-time, RubyGems will make sure lib, etc. are in the load path"
11
12
  STDERR.puts "Feel free to remove this message from bin/vmesh now"
12
13
  exit 64
13
14
  end
15
+ =end
14
16
 
15
17
  include GLI::App
16
18
 
@@ -33,6 +33,9 @@ command :create do |c|
33
33
  Vmesh::template.has_key? vm_type.to_sym or raise "unknown machine type #{vm_type}, known types are #{Vmesh::template.keys.to_s}"
34
34
 
35
35
  ip_address = options[:ip_address]
36
+ if ip_address.to_s != ''
37
+ raise RuntimeError, "IP Address #{ip_address} already in use" if Vmesh::pingecho(ip_address, 1)
38
+ end
36
39
  machine_options = {}
37
40
  vm_manager = Vmesh::VSphere.new global_options
38
41
  #default_vm_folder = vm_manager.get_folder(options[:folder]) if options[:folder]
@@ -0,0 +1,18 @@
1
+ require 'socket'
2
+ require 'timeout'
3
+
4
+ module Vmesh
5
+ def self.pingecho(host, timeout=5, service="echo")
6
+ begin
7
+ timeout(timeout) do
8
+ s = TCPSocket.new(host, service)
9
+ s.close
10
+ end
11
+ rescue Errno::ECONNREFUSED
12
+ return true
13
+ rescue Timeout::Error, StandardError
14
+ return false
15
+ end
16
+ return true
17
+ end
18
+ end
data/lib/vmesh/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Vmesh
2
- VERSION = '0.1.7'
2
+ VERSION = '0.1.11'
3
3
  end
data/lib/vmesh/vsphere.rb CHANGED
@@ -6,7 +6,7 @@ module Vmesh
6
6
  class VSphere
7
7
  attr_accessor :vim, :options
8
8
  def initialize(connection_options)
9
- Vmesh::logger.debug "Opening connection to #{connection_options['host']} #{connection_options.inspect}"
9
+ Vmesh::logger.debug "Opening connection to #{connection_options[:host]} as #{connection_options[:user]}, dc #{connection_options[:datacenter]}, resource pool #{connection_options[:resource_pool]}, insecure #{connection_options[:insecure]}"
10
10
  opts = {
11
11
  :host => connection_options[:host],
12
12
  :user => connection_options[:user],
data/lib/vmesh.rb CHANGED
@@ -12,6 +12,7 @@ require 'vmesh/custom_spec.rb'
12
12
  require 'vmesh/datacenter.rb'
13
13
  require 'vmesh/vsphere.rb'
14
14
  require 'vmesh/datastore.rb'
15
+ require 'vmesh/ping_helper.rb'
15
16
 
16
17
  module Vmesh
17
18
  def self.logger
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vmesh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kurt Gardiner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-12 00:00:00.000000000 Z
11
+ date: 2015-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -179,6 +179,7 @@ files:
179
179
  - lib/vmesh/list.rb
180
180
  - lib/vmesh/logger.rb
181
181
  - lib/vmesh/machine.rb
182
+ - lib/vmesh/ping_helper.rb
182
183
  - lib/vmesh/server_defaults.rb
183
184
  - lib/vmesh/version.rb
184
185
  - lib/vmesh/vsphere.rb