vmreverter 0.1.1 → 0.1.2

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: 71bee61dcff4fab8db12f0a51a05adbb16ed0a46
4
- data.tar.gz: b7dca1e2f746b87b142d52b85a8b34eb120de27e
3
+ metadata.gz: 59e8a9fe0161250b23680ca5d9ab363690bbb593
4
+ data.tar.gz: eb23f05cabfcfd968fcbc76ba3d09dcc6481092a
5
5
  SHA512:
6
- metadata.gz: 20a8134933876108d1f3e1c2165c179908097382b59604b17dff6710f1dc4d0e31b73373c92f5ad54bfd81d77a3029e0af5069a1a25223b635307ccff867bf88
7
- data.tar.gz: 36122ffdd382b0b930d95986698e9ed9228bef08dbcd90f3a9b5795b161126ef768a493631b82e3b6af5951e656d358b53865bbf2163d47a4afdb38bedf50adb
6
+ metadata.gz: aab154a683e29d190f7b178672f2dc1ae0140686ce09e69444497402dc3086e0a4b57877e7d830cb42608e90224cf5529855ec1ca11141da1c853ec85ee215cb
7
+ data.tar.gz: 4c66f97aa9fb47619eed1d88b55c7cc3e9f7e6bbee3abe9422628dc26dadc24dbe5d2cd895d1f7664ecb2184675c93578e70ecd86d7e82575befbcc763ea9518
@@ -13,7 +13,11 @@ module Vmreverter
13
13
 
14
14
  @logger.notify "Connecting to vSphere at #{vsphere_credentials[:server]}" + " with credentials for #{vsphere_credentials[:user]}"
15
15
 
16
- @vsphere_helper = VsphereHelper.new( vsphere_credentials )
16
+ begin
17
+ @vsphere_helper = VsphereHelper.new( vsphere_credentials, @logger )
18
+ rescue Exception => e
19
+ report_and_raise(@logger, e, "VSphere::connection")
20
+ end
17
21
 
18
22
  #Transpose Hash for @vsphere_vms = {"test-server01" => "gold-image", "test-server02" => "silver-image"}
19
23
  @vsphere_vms = {}
@@ -1,14 +1,8 @@
1
1
  # Apache Licensed - (github/puppetlabs) ripped from puppet_acceptance. ** See Legal notes
2
2
  # Changes include namespace swaps, and refactoring
3
3
 
4
- begin
5
- require 'Vmreverter/logger'
6
- rescue LoadError
7
- require File.expand_path(File.join(File.dirname(__FILE__), '..', 'logger.rb'))
8
- end
9
-
10
4
  class VsphereHelper
11
-
5
+
12
6
  #Class methods
13
7
  def self.load_config authfile
14
8
  vsphere_credentials = {}
@@ -19,7 +13,7 @@ class VsphereHelper
19
13
  vInfo = YAML.load_file( File.join(ENV['HOME'], '.fog') )
20
14
  else
21
15
  report_and_raise(@logger, RuntimeError.new("Couldn't authentication for vSphere in auth file !"), "VSphereHelper::load_config")
22
- end
16
+ end
23
17
 
24
18
  begin
25
19
  vsphere_credentials[:server] = vInfo[:default][:vsphere_server]
@@ -32,23 +26,24 @@ class VsphereHelper
32
26
  return vsphere_credentials
33
27
  end
34
28
 
35
- def initialize vInfo = {}
36
- @logger = vInfo[:logger] || Vmreverter::Logger.new
29
+ def initialize(vInfo, logger)
30
+
31
+ @logger = logger
37
32
  begin
38
33
  require 'rbvmomi'
39
34
  rescue LoadError
40
35
  raise "Unable to load RbVmomi, please ensure its installed"
41
36
  end
42
-
43
- # If you don’t have trusted SSL certificates installed on the host you’re connecting to,
44
- #you’ll get an +OpenSSL::SSL::SSLError+ “certificate verify failed”.
37
+
38
+ # If you don’t have trusted SSL certificates installed on the host you’re connecting to,
39
+ #you’ll get an +OpenSSL::SSL::SSLError+ “certificate verify failed”.
45
40
  #You can work around this by using the :insecure option to +RbVmomi::VIM.connect+.
46
-
41
+
47
42
  @connection = RbVmomi::VIM.connect :host => vInfo[:server],
48
43
  :user => vInfo[:user],
49
44
  :password => vInfo[:pass],
50
45
  :insecure => true
51
- end
46
+ end
52
47
  #Instance Methods
53
48
  def find_snapshot vm, snapname
54
49
  search_child_snaps vm.snapshot.rootSnapshotList, snapname
@@ -184,4 +179,3 @@ class VsphereHelper
184
179
  @connection.close
185
180
  end
186
181
  end
187
-
@@ -1,3 +1,3 @@
1
1
  module Vmreverter
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vmreverter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - shadowbq