vagrant-vcloud 0.1.2 → 0.2.0
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 +3 -0
- data/.rubocop.yml +34 -0
- data/README.md +19 -2
- data/Rakefile +1 -1
- data/lib/vagrant-vcloud.rb +11 -13
- data/lib/vagrant-vcloud/action.rb +74 -47
- data/lib/vagrant-vcloud/action/announce_ssh_exec.rb +4 -2
- data/lib/vagrant-vcloud/action/build_vapp.rb +134 -110
- data/lib/vagrant-vcloud/action/connect_vcloud.rb +31 -42
- data/lib/vagrant-vcloud/action/destroy.rb +34 -29
- data/lib/vagrant-vcloud/action/disconnect_vcloud.rb +7 -5
- data/lib/vagrant-vcloud/action/forward_ports.rb +42 -35
- data/lib/vagrant-vcloud/action/handle_nat_port_collisions.rb +26 -22
- data/lib/vagrant-vcloud/action/inventory_check.rb +79 -52
- data/lib/vagrant-vcloud/action/is_bridged.rb +30 -0
- data/lib/vagrant-vcloud/action/is_created.rb +13 -14
- data/lib/vagrant-vcloud/action/is_paused.rb +0 -2
- data/lib/vagrant-vcloud/action/is_running.rb +0 -2
- data/lib/vagrant-vcloud/action/message_already_running.rb +1 -1
- data/lib/vagrant-vcloud/action/message_cannot_suspend.rb +1 -1
- data/lib/vagrant-vcloud/action/message_not_created.rb +1 -1
- data/lib/vagrant-vcloud/action/message_will_not_destroy.rb +6 -1
- data/lib/vagrant-vcloud/action/power_off.rb +16 -21
- data/lib/vagrant-vcloud/action/power_on.rb +64 -28
- data/lib/vagrant-vcloud/action/read_ssh_info.rb +44 -28
- data/lib/vagrant-vcloud/action/read_state.rb +16 -23
- data/lib/vagrant-vcloud/action/resume.rb +5 -13
- data/lib/vagrant-vcloud/action/suspend.rb +5 -13
- data/lib/vagrant-vcloud/action/sync_folders.rb +82 -48
- data/lib/vagrant-vcloud/action/unmap_port_forwardings.rb +27 -29
- data/lib/vagrant-vcloud/command.rb +186 -0
- data/lib/vagrant-vcloud/config.rb +41 -20
- data/lib/vagrant-vcloud/driver/base.rb +170 -121
- data/lib/vagrant-vcloud/driver/meta.rb +64 -70
- data/lib/vagrant-vcloud/driver/version_5_1.rb +1038 -716
- data/lib/vagrant-vcloud/errors.rb +4 -4
- data/lib/vagrant-vcloud/model/forwarded_port.rb +4 -2
- data/lib/vagrant-vcloud/plugin.rb +30 -20
- data/lib/vagrant-vcloud/provider.rb +6 -6
- data/lib/vagrant-vcloud/util/compile_forwarded_ports.rb +1 -1
- data/lib/vagrant-vcloud/version.rb +1 -1
- data/locales/en.yml +6 -5
- data/vagrant-vcloud.gemspec +10 -7
- metadata +35 -4
@@ -1,10 +1,10 @@
|
|
1
|
-
require
|
1
|
+
require 'vagrant'
|
2
2
|
|
3
3
|
module VagrantPlugins
|
4
4
|
module VCloud
|
5
5
|
module Errors
|
6
6
|
class VCloudError < Vagrant::Errors::VagrantError
|
7
|
-
error_namespace(
|
7
|
+
error_namespace('vagrant_vcloud.errors')
|
8
8
|
end
|
9
9
|
class RsyncError < VCloudError
|
10
10
|
error_key(:rsync_error)
|
@@ -41,7 +41,7 @@ module VagrantPlugins
|
|
41
41
|
error_key(:forward_port_collision)
|
42
42
|
end
|
43
43
|
class SubnetErrors < VCloudError
|
44
|
-
error_namespace(
|
44
|
+
error_namespace('vagrant_vcloud.errors.subnet_errors')
|
45
45
|
end
|
46
46
|
class InvalidSubnet < SubnetErrors
|
47
47
|
error_key(:invalid_subnet)
|
@@ -50,7 +50,7 @@ module VagrantPlugins
|
|
50
50
|
error_key(:subnet_too_small)
|
51
51
|
end
|
52
52
|
class RestError < VCloudError
|
53
|
-
error_namespace(
|
53
|
+
error_namespace('vagrant_vcloud.errors.rest_errors')
|
54
54
|
end
|
55
55
|
class ObjectNotFound < RestError
|
56
56
|
error_key(:object_not_found)
|
@@ -46,10 +46,12 @@ module VagrantPlugins
|
|
46
46
|
|
47
47
|
options ||= {}
|
48
48
|
@auto_correct = false
|
49
|
-
|
49
|
+
if options.key?(:auto_correct)
|
50
|
+
@auto_correct = options[:auto_correct]
|
51
|
+
end
|
50
52
|
@guest_ip = options[:guest_ip] || nil
|
51
53
|
@host_ip = options[:host_ip] || nil
|
52
|
-
@protocol = options[:protocol] ||
|
54
|
+
@protocol = options[:protocol] || 'tcp'
|
53
55
|
end
|
54
56
|
|
55
57
|
# This corrects the host port and changes it to the given new port.
|
@@ -1,21 +1,22 @@
|
|
1
1
|
begin
|
2
|
-
require
|
2
|
+
require 'vagrant'
|
3
3
|
rescue LoadError
|
4
|
-
raise
|
4
|
+
raise 'The Vagrant vCloud plugin must be run within Vagrant.'
|
5
5
|
end
|
6
6
|
|
7
|
-
if Vagrant::VERSION <
|
8
|
-
|
7
|
+
if Vagrant::VERSION < '1.2.0'
|
8
|
+
fail 'The Vagrant vCloud plugin is only compatible with Vagrant 1.2+'
|
9
9
|
end
|
10
10
|
|
11
11
|
module VagrantPlugins
|
12
12
|
module VCloud
|
13
13
|
class Plugin < Vagrant.plugin('2')
|
14
|
-
name
|
15
|
-
description
|
14
|
+
name 'VMware vCloud Director Provider'
|
15
|
+
description 'Allows Vagrant to manage machines with VMware vCloud
|
16
|
+
Director(R)'
|
16
17
|
|
17
18
|
config(:vcloud, :provider) do
|
18
|
-
require_relative
|
19
|
+
require_relative 'config'
|
19
20
|
Config
|
20
21
|
end
|
21
22
|
|
@@ -25,22 +26,29 @@ module VagrantPlugins
|
|
25
26
|
setup_i18n
|
26
27
|
|
27
28
|
# Return the provider
|
28
|
-
require_relative
|
29
|
+
require_relative 'provider'
|
29
30
|
Provider
|
30
31
|
end
|
31
32
|
|
33
|
+
# Added a vagrant vcloud-status command to enhance troubleshooting and
|
34
|
+
# visibility.
|
35
|
+
command('vcloud-status') do
|
36
|
+
require_relative 'command'
|
37
|
+
Command
|
38
|
+
end
|
39
|
+
|
32
40
|
def self.setup_i18n
|
33
|
-
I18n.load_path << File.expand_path(
|
41
|
+
I18n.load_path << File.expand_path('locales/en.yml', VCloud.source_root)
|
34
42
|
I18n.reload!
|
35
43
|
end
|
36
44
|
|
37
45
|
# This sets up our log level to be whatever VAGRANT_LOG is.
|
38
46
|
def self.setup_logging
|
39
|
-
require
|
47
|
+
require 'log4r'
|
40
48
|
|
41
49
|
level = nil
|
42
50
|
begin
|
43
|
-
level = Log4r.const_get(ENV[
|
51
|
+
level = Log4r.const_get(ENV['VAGRANT_LOG'].upcase)
|
44
52
|
rescue NameError
|
45
53
|
# This means that the logging constant wasn't found,
|
46
54
|
# which is fine. We just keep `level` as `nil`. But
|
@@ -48,31 +56,33 @@ module VagrantPlugins
|
|
48
56
|
level = nil
|
49
57
|
end
|
50
58
|
|
51
|
-
# Some constants, such as
|
59
|
+
# Some constants, such as 'true' resolve to booleans, so the
|
52
60
|
# above error checking doesn't catch it. This will check to make
|
53
61
|
# sure that the log level is an integer, as Log4r requires.
|
54
|
-
level = nil
|
62
|
+
level = nil unless level.is_a?(Integer)
|
55
63
|
|
56
|
-
# Set the logging level on all
|
64
|
+
# Set the logging level on all 'vagrant' namespaced
|
57
65
|
# logs as long as we have a valid level.
|
58
66
|
if level
|
59
|
-
logger = Log4r::Logger.new(
|
67
|
+
logger = Log4r::Logger.new('vagrant_vcloud')
|
60
68
|
logger.outputters = Log4r::Outputter.stderr
|
61
69
|
logger.level = level
|
62
|
-
logger = nil
|
70
|
+
# logger = nil
|
63
71
|
end
|
64
72
|
end
|
65
73
|
end
|
66
74
|
module Driver
|
67
|
-
autoload :Meta, File.expand_path(
|
68
|
-
autoload :Version_5_1, File.expand_path(
|
75
|
+
autoload :Meta, File.expand_path('../driver/meta', __FILE__)
|
76
|
+
autoload :Version_5_1, File.expand_path('../driver/version_5_1', __FILE__)
|
69
77
|
end
|
70
78
|
module Model
|
71
|
-
autoload :ForwardedPort,
|
79
|
+
autoload :ForwardedPort,
|
80
|
+
File.expand_path('../model/forwarded_port', __FILE__)
|
72
81
|
end
|
73
82
|
|
74
83
|
module Util
|
75
|
-
autoload :CompileForwardedPorts,
|
84
|
+
autoload :CompileForwardedPorts,
|
85
|
+
File.expand_path('../util/compile_forwarded_ports', __FILE__)
|
76
86
|
end
|
77
87
|
end
|
78
88
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'log4r'
|
2
|
+
require 'vagrant'
|
3
3
|
|
4
4
|
module VagrantPlugins
|
5
5
|
module VCloud
|
@@ -15,17 +15,17 @@ module VagrantPlugins
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def ssh_info
|
18
|
-
env = @machine.action(
|
18
|
+
env = @machine.action('read_ssh_info')
|
19
19
|
env[:machine_ssh_info]
|
20
20
|
end
|
21
21
|
|
22
22
|
def state
|
23
|
-
env = @machine.action(
|
23
|
+
env = @machine.action('read_state')
|
24
24
|
|
25
25
|
state_id = env[:machine_state_id]
|
26
26
|
|
27
27
|
# Translate into short/long descriptions
|
28
|
-
short = state_id.to_s.gsub(
|
28
|
+
short = state_id.to_s.gsub('_', ' ')
|
29
29
|
long = I18n.t("vagrant_vcloud.states.#{state_id}")
|
30
30
|
|
31
31
|
# Return the MachineState object
|
@@ -33,7 +33,7 @@ module VagrantPlugins
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def to_s
|
36
|
-
id = @machine.id.nil? ?
|
36
|
+
id = @machine.id.nil? ? 'new' : @machine.id
|
37
37
|
"vCloud (#{id})"
|
38
38
|
end
|
39
39
|
end
|
data/locales/en.yml
CHANGED
@@ -4,11 +4,12 @@ en:
|
|
4
4
|
will_not_destroy: "VM will not be destroyed"
|
5
5
|
vm_already_running: "VM is already running"
|
6
6
|
vm_halted_cannot_suspend: "VM is not running or already suspended, cannot suspend it."
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
sync:
|
8
|
+
rsync_not_found_warning: |-
|
9
|
+
Warning! Folder sync disabled because the rsync binary is missing.
|
10
|
+
Make sure rsync is installed and the binary can be found in the PATH.
|
11
|
+
rsync_folder: |-
|
12
|
+
Rsyncing folder: %{hostpath} => %{guestpath}
|
12
13
|
config:
|
13
14
|
api_version: "Configuration must specify a vCloud API version (default=5.1)"
|
14
15
|
catalog_name: "Configuration must specify a vCloud Director Catalog (for the VM templates images)"
|
data/vagrant-vcloud.gemspec
CHANGED
@@ -11,19 +11,22 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.license = 'MIT'
|
12
12
|
s.summary = 'VMware vCloud Director® provider'
|
13
13
|
s.description = 'Enables Vagrant to manage machines with VMware vCloud Director®.'
|
14
|
-
|
14
|
+
|
15
15
|
s.add_runtime_dependency 'i18n', '~> 0.6.4'
|
16
16
|
s.add_runtime_dependency 'log4r', '~> 1.1.10'
|
17
|
-
s.add_runtime_dependency 'nokogiri', '~> 1.
|
17
|
+
s.add_runtime_dependency 'nokogiri', '~> 1.5.5'
|
18
18
|
s.add_runtime_dependency 'httpclient', '~> 2.3.4.1'
|
19
19
|
s.add_runtime_dependency 'ruby-progressbar', '~> 1.1.1'
|
20
20
|
s.add_runtime_dependency 'netaddr', '~> 1.5.0'
|
21
|
+
# Adding awesome_print because it's just awesome to read XML
|
22
|
+
s.add_runtime_dependency 'awesome_print', '~> 1.2.0'
|
23
|
+
s.add_runtime_dependency 'terminal-table', '~> 1.4.5'
|
24
|
+
|
25
|
+
s.add_development_dependency 'rake'
|
26
|
+
s.add_development_dependency 'rspec-core', '~> 2.12.2'
|
27
|
+
s.add_development_dependency 'rspec-expectations', '~> 2.12.1'
|
28
|
+
s.add_development_dependency 'rspec-mocks', '~> 2.12.1'
|
21
29
|
|
22
|
-
s.add_development_dependency "rake"
|
23
|
-
s.add_development_dependency "rspec-core", "~> 2.12.2"
|
24
|
-
s.add_development_dependency "rspec-expectations", "~> 2.12.1"
|
25
|
-
s.add_development_dependency "rspec-mocks", "~> 2.12.1"
|
26
|
-
|
27
30
|
s.files = `git ls-files`.split($/)
|
28
31
|
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
29
32
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-vcloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fabio Rapposelli
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-02
|
12
|
+
date: 2014-04-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: i18n
|
@@ -45,14 +45,14 @@ dependencies:
|
|
45
45
|
requirements:
|
46
46
|
- - ~>
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: 1.
|
48
|
+
version: 1.5.5
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - ~>
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 1.
|
55
|
+
version: 1.5.5
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: httpclient
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,6 +95,34 @@ dependencies:
|
|
95
95
|
- - ~>
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: 1.5.0
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: awesome_print
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ~>
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: 1.2.0
|
105
|
+
type: :runtime
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ~>
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: 1.2.0
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: terminal-table
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ~>
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: 1.4.5
|
119
|
+
type: :runtime
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 1.4.5
|
98
126
|
- !ruby/object:Gem::Dependency
|
99
127
|
name: rake
|
100
128
|
requirement: !ruby/object:Gem::Requirement
|
@@ -160,6 +188,7 @@ extensions: []
|
|
160
188
|
extra_rdoc_files: []
|
161
189
|
files:
|
162
190
|
- .gitignore
|
191
|
+
- .rubocop.yml
|
163
192
|
- Gemfile
|
164
193
|
- LICENSE
|
165
194
|
- README.md
|
@@ -177,6 +206,7 @@ files:
|
|
177
206
|
- lib/vagrant-vcloud/action/forward_ports.rb
|
178
207
|
- lib/vagrant-vcloud/action/handle_nat_port_collisions.rb
|
179
208
|
- lib/vagrant-vcloud/action/inventory_check.rb
|
209
|
+
- lib/vagrant-vcloud/action/is_bridged.rb
|
180
210
|
- lib/vagrant-vcloud/action/is_created.rb
|
181
211
|
- lib/vagrant-vcloud/action/is_paused.rb
|
182
212
|
- lib/vagrant-vcloud/action/is_running.rb
|
@@ -192,6 +222,7 @@ files:
|
|
192
222
|
- lib/vagrant-vcloud/action/suspend.rb
|
193
223
|
- lib/vagrant-vcloud/action/sync_folders.rb
|
194
224
|
- lib/vagrant-vcloud/action/unmap_port_forwardings.rb
|
225
|
+
- lib/vagrant-vcloud/command.rb
|
195
226
|
- lib/vagrant-vcloud/config.rb
|
196
227
|
- lib/vagrant-vcloud/driver/base.rb
|
197
228
|
- lib/vagrant-vcloud/driver/meta.rb
|