vagrant-vsphere 0.9.0 → 0.9.1
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/.gitignore +1 -0
- data/README.md +4 -3
- data/lib/vSphere/action.rb +3 -4
- data/lib/vSphere/errors.rb +0 -3
- data/lib/vSphere/plugin.rb +11 -1
- data/lib/vSphere/version.rb +1 -1
- data/locales/en.yml +0 -13
- data/spec/spec_helper.rb +5 -0
- metadata +1 -2
- data/lib/vSphere/action/sync_folders.rb +0 -99
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbccf22b0e44382e8f2add33082883350d12afb5
|
4
|
+
data.tar.gz: 535b241382bf743cf38772121109fc2f6e37635b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f219f8c40f9ffd9680e1d70c5355dd33e71459a3215832ad1ab724b37dc53c811b8c6f3430c1936be2f2f839bb123cc3fa97ff51c8bf1978cef303c809f006a1
|
7
|
+
data.tar.gz: c014ce7bb4eed32bc3bc39358bad9e25630dad57a4905700f5aba803978160884796ded09d87278120df846f7b8b0e6496dd787b9423a42f8b1c3e60fd680a93
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -12,9 +12,9 @@ This provider is built on top of the [RbVmomi](https://github.com/vmware/rbvmomi
|
|
12
12
|
* libxml2, libxml2-dev, libxslt, libxslt-dev
|
13
13
|
|
14
14
|
## Current Version
|
15
|
-
**0.9.
|
15
|
+
**0.9.1**
|
16
16
|
|
17
|
-
vagrant-vsphere (0.9.
|
17
|
+
vagrant-vsphere (0.9.1) is available from [RubyGems.org](https://rubygems.org/gems/vagrant-vsphere)
|
18
18
|
|
19
19
|
## Installation
|
20
20
|
|
@@ -168,7 +168,8 @@ This is useful if running Vagrant from multiple directories or if multiple machi
|
|
168
168
|
* 0.9.0
|
169
169
|
* increases Vagrant requirements to 1.6.3+
|
170
170
|
* Supports differentiating between SSH/WinRM communicator [#67 marnovdm:feature/waiting-for-winrm](https://github.com/nsidc/vagrant-vsphere/pull/67)
|
171
|
-
|
171
|
+
* 0.9.1
|
172
|
+
* reuse folder sync code from Vagrant core. [#66 mkuzmin:sync-folders](https://github.com/nsidc/vagrant-vsphere/pull/66)
|
172
173
|
|
173
174
|
|
174
175
|
## Versioning
|
data/lib/vSphere/action.rb
CHANGED
@@ -37,8 +37,8 @@ module VagrantPlugins
|
|
37
37
|
end
|
38
38
|
|
39
39
|
b3.use Provision
|
40
|
-
b3.use
|
41
|
-
end
|
40
|
+
b3.use SyncedFolders
|
41
|
+
end
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
@@ -104,7 +104,7 @@ module VagrantPlugins
|
|
104
104
|
end
|
105
105
|
b.use CloseVSphere
|
106
106
|
b.use Provision
|
107
|
-
b.use
|
107
|
+
b.use SyncedFolders
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
@@ -165,7 +165,6 @@ module VagrantPlugins
|
|
165
165
|
autoload :MessageNotRunning, action_root.join('message_not_running')
|
166
166
|
autoload :PowerOff, action_root.join('power_off')
|
167
167
|
autoload :PowerOn, action_root.join('power_on')
|
168
|
-
autoload :SyncFolders, action_root.join('sync_folders')
|
169
168
|
end
|
170
169
|
end
|
171
170
|
end
|
data/lib/vSphere/errors.rb
CHANGED
data/lib/vSphere/plugin.rb
CHANGED
@@ -1,4 +1,14 @@
|
|
1
|
-
|
1
|
+
begin
|
2
|
+
require "vagrant"
|
3
|
+
rescue LoadError
|
4
|
+
raise "The Vagrant vSphere plugin must be run within Vagrant."
|
5
|
+
end
|
6
|
+
|
7
|
+
# This is a sanity check to make sure no one is attempting to install
|
8
|
+
# this into an early Vagrant version.
|
9
|
+
if Vagrant::VERSION < "1.5"
|
10
|
+
raise "The Vagrant vSphere plugin is only compatible with Vagrant 1.5+"
|
11
|
+
end
|
2
12
|
|
3
13
|
module VagrantPlugins
|
4
14
|
module VSphere
|
data/lib/vSphere/version.rb
CHANGED
data/locales/en.yml
CHANGED
@@ -20,8 +20,6 @@ en:
|
|
20
20
|
Waiting for SSH to become available...
|
21
21
|
waiting_for_winrm: |-
|
22
22
|
Waiting for WinRM to become available...
|
23
|
-
rsync_folder: |-
|
24
|
-
Rsyncing folder: %{hostpath} => %{guestpath}
|
25
23
|
|
26
24
|
errors:
|
27
25
|
missing_template: |-
|
@@ -38,19 +36,8 @@ en:
|
|
38
36
|
Configured configuration spec not found
|
39
37
|
missing_datastore: |-
|
40
38
|
Configured data store not found
|
41
|
-
rsync_error: |-
|
42
|
-
There was an error when attemping to rsync a share folder.
|
43
|
-
Please inspect the error message below for more info.
|
44
|
-
|
45
|
-
Host path: %{hostpath}
|
46
|
-
Guest path: %{guestpath}
|
47
|
-
Error: %{stderr}
|
48
39
|
too_many_private_networks: |-
|
49
40
|
There a more private networks configured than can be assigned to the customization spec
|
50
|
-
rsync_not_found: |-
|
51
|
-
Warning! Folder sync disabled because the rsync binary is
|
52
|
-
missing. Make sure rsync is installed and the binary can
|
53
|
-
be found in PATH.
|
54
41
|
config:
|
55
42
|
host: |-
|
56
43
|
Configuration must specify a vSphere host
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'rbvmomi'
|
2
|
+
require 'pathname'
|
2
3
|
require 'vSphere/errors'
|
3
4
|
require 'vSphere/action'
|
4
5
|
require 'vSphere/action/connect_vsphere'
|
@@ -62,8 +63,11 @@ RSpec.configure do |config|
|
|
62
63
|
:state => double('state', :id => nil),
|
63
64
|
:communicate => double('communicator', :ready? => true),
|
64
65
|
:ssh_info => {},
|
66
|
+
:data_dir => Pathname.new(''),
|
65
67
|
:id => nil,
|
66
68
|
:id= => nil
|
69
|
+
|
70
|
+
|
67
71
|
@env = {
|
68
72
|
:machine => @machine,
|
69
73
|
:ui => double('ui', :info => nil)
|
@@ -81,6 +85,7 @@ RSpec.configure do |config|
|
|
81
85
|
vm_folder.stub(:findByUuid).with(MISSING_UUID).and_return(nil)
|
82
86
|
vm_folder.stub(:findByUuid).with(nil).and_return(nil)
|
83
87
|
|
88
|
+
|
84
89
|
@child_resource_pool = double('testresourcepool')
|
85
90
|
@root_resource_pool = double('pools', :find => @child_resource_pool)
|
86
91
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-vsphere
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Grauch
|
@@ -135,7 +135,6 @@ files:
|
|
135
135
|
- lib/vSphere/action/message_not_running.rb
|
136
136
|
- lib/vSphere/action/power_off.rb
|
137
137
|
- lib/vSphere/action/power_on.rb
|
138
|
-
- lib/vSphere/action/sync_folders.rb
|
139
138
|
- lib/vSphere/config.rb
|
140
139
|
- lib/vSphere/errors.rb
|
141
140
|
- lib/vSphere/plugin.rb
|
@@ -1,99 +0,0 @@
|
|
1
|
-
require 'i18n'
|
2
|
-
require "vagrant/util/subprocess"
|
3
|
-
require "vagrant/util/scoped_hash_override"
|
4
|
-
require "vagrant/util/which"
|
5
|
-
|
6
|
-
module VagrantPlugins
|
7
|
-
module VSphere
|
8
|
-
module Action
|
9
|
-
# This middleware uses `rsync` to sync the folders over to the vSphere instance
|
10
|
-
# Borrowed from the Vagrant AWS gem, see https://github.com/mitchellh/vagrant-aws/blob/master/lib/vagrant-aws/action/sync_folders.rb
|
11
|
-
class SyncFolders
|
12
|
-
include Vagrant::Util::ScopedHashOverride
|
13
|
-
|
14
|
-
def initialize(app, env)
|
15
|
-
@app = app
|
16
|
-
end
|
17
|
-
|
18
|
-
def call(env)
|
19
|
-
@app.call(env)
|
20
|
-
|
21
|
-
ssh_info = env[:machine].ssh_info
|
22
|
-
|
23
|
-
env[:machine].config.vm.synced_folders.each do |id, data|
|
24
|
-
data = scoped_hash_override(data, :vsphere)
|
25
|
-
|
26
|
-
# Ignore disabled shared folders
|
27
|
-
next if data[:disabled]
|
28
|
-
|
29
|
-
unless Vagrant::Util::Which.which('rsync')
|
30
|
-
env[:ui].warn(I18n.t('vsphere.errors.rsync_not_found'))
|
31
|
-
break
|
32
|
-
end
|
33
|
-
hostpath = File.expand_path(data[:hostpath], env[:root_path])
|
34
|
-
guestpath = data[:guestpath]
|
35
|
-
|
36
|
-
# Make sure there is a trailing slash on the host path to
|
37
|
-
# avoid creating an additional directory with rsync
|
38
|
-
hostpath = "#{hostpath}/" if hostpath !~ /\/$/
|
39
|
-
|
40
|
-
# on windows rsync.exe requires cygdrive-style paths
|
41
|
-
if Vagrant::Util::Platform.windows?
|
42
|
-
hostpath = hostpath.gsub(/^(\w):/) { "/cygdrive/#{$1}" }
|
43
|
-
end
|
44
|
-
|
45
|
-
env[:ui].info(I18n.t("vsphere.rsync_folder",
|
46
|
-
:hostpath => hostpath,
|
47
|
-
:guestpath => guestpath))
|
48
|
-
|
49
|
-
# Create the guest path
|
50
|
-
if env[:machine].communicate.class.to_s =~ /WinRM/
|
51
|
-
env[:machine].communicate.execute("New-Item '#{guestpath}' -type directory -force")
|
52
|
-
|
53
|
-
else
|
54
|
-
env[:machine].communicate.sudo("mkdir -p '#{guestpath}'")
|
55
|
-
env[:machine].communicate.sudo("chown #{ssh_info[:username]} '#{guestpath}'")
|
56
|
-
end
|
57
|
-
|
58
|
-
# Rsync over to the guest path using the SSH info
|
59
|
-
command = [
|
60
|
-
"rsync", "--verbose", "--archive", "-z",
|
61
|
-
"--exclude", ".vagrant/",
|
62
|
-
"-e", "ssh -p #{ssh_info[:port]} -o StrictHostKeyChecking=no #{get_private_key_options ssh_info}",
|
63
|
-
hostpath,
|
64
|
-
"#{ssh_info[:username]}@#{ssh_info[:host]}:#{guestpath}"]
|
65
|
-
|
66
|
-
|
67
|
-
# we need to fix permissions when using rsync.exe on windows, see
|
68
|
-
# http://stackoverflow.com/questions/5798807/rsync-permission-denied-created-directories-have-no-permissions
|
69
|
-
if Vagrant::Util::Platform.windows?
|
70
|
-
command.insert(1, "--chmod", "ugo=rwX")
|
71
|
-
end
|
72
|
-
|
73
|
-
r = Vagrant::Util::Subprocess.execute(*command)
|
74
|
-
if r.exit_code != 0
|
75
|
-
raise Errors::RsyncError,
|
76
|
-
:guestpath => guestpath,
|
77
|
-
:hostpath => hostpath,
|
78
|
-
:stderr => r.stderr
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
private
|
84
|
-
|
85
|
-
def get_private_key_options(ssh_info)
|
86
|
-
if ssh_info[:private_key_path].is_a? String
|
87
|
-
build_key_option ssh_info[:private_key_path]
|
88
|
-
elsif ssh_info[:private_key_path].is_a? Array
|
89
|
-
ssh_info[:private_key_path].map { |path| build_key_option path }.join(' ')
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
def build_key_option(key)
|
94
|
-
"-i '#{key}'"
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|