vagrant-vcloudair 0.5.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 +7 -0
- data/.gitignore +34 -0
- data/.rubocop.yml +34 -0
- data/Gemfile +7 -0
- data/LICENSE +21 -0
- data/README.md +109 -0
- data/lib/vagrant-vcloudair.rb +63 -0
- data/lib/vagrant-vcloudair/action.rb +298 -0
- data/lib/vagrant-vcloudair/action/announce_ssh_exec.rb +22 -0
- data/lib/vagrant-vcloudair/action/build_vapp.rb +235 -0
- data/lib/vagrant-vcloudair/action/connect_vcloud.rb +54 -0
- data/lib/vagrant-vcloudair/action/destroy_vapp.rb +54 -0
- data/lib/vagrant-vcloudair/action/destroy_vm.rb +37 -0
- data/lib/vagrant-vcloudair/action/disconnect_vcloud.rb +31 -0
- data/lib/vagrant-vcloudair/action/forward_ports.rb +132 -0
- data/lib/vagrant-vcloudair/action/handle_nat_port_collisions.rb +153 -0
- data/lib/vagrant-vcloudair/action/inventory_check.rb +210 -0
- data/lib/vagrant-vcloudair/action/is_bridged.rb +29 -0
- data/lib/vagrant-vcloudair/action/is_created.rb +35 -0
- data/lib/vagrant-vcloudair/action/is_last_vm.rb +31 -0
- data/lib/vagrant-vcloudair/action/is_paused.rb +20 -0
- data/lib/vagrant-vcloudair/action/is_running.rb +20 -0
- data/lib/vagrant-vcloudair/action/message_already_running.rb +16 -0
- data/lib/vagrant-vcloudair/action/message_cannot_suspend.rb +16 -0
- data/lib/vagrant-vcloudair/action/message_not_created.rb +16 -0
- data/lib/vagrant-vcloudair/action/message_not_running.rb +16 -0
- data/lib/vagrant-vcloudair/action/message_will_not_destroy.rb +21 -0
- data/lib/vagrant-vcloudair/action/power_off.rb +33 -0
- data/lib/vagrant-vcloudair/action/power_off_vapp.rb +40 -0
- data/lib/vagrant-vcloudair/action/power_on.rb +39 -0
- data/lib/vagrant-vcloudair/action/read_ssh_info.rb +153 -0
- data/lib/vagrant-vcloudair/action/read_state.rb +51 -0
- data/lib/vagrant-vcloudair/action/resume.rb +25 -0
- data/lib/vagrant-vcloudair/action/suspend.rb +25 -0
- data/lib/vagrant-vcloudair/action/unmap_port_forwardings.rb +74 -0
- data/lib/vagrant-vcloudair/cap/forwarded_ports.rb +38 -0
- data/lib/vagrant-vcloudair/cap/public_address.rb +18 -0
- data/lib/vagrant-vcloudair/cap/rdp_info.rb +18 -0
- data/lib/vagrant-vcloudair/cap/winrm_info.rb +15 -0
- data/lib/vagrant-vcloudair/command.rb +285 -0
- data/lib/vagrant-vcloudair/config.rb +205 -0
- data/lib/vagrant-vcloudair/driver/base.rb +643 -0
- data/lib/vagrant-vcloudair/driver/meta.rb +202 -0
- data/lib/vagrant-vcloudair/driver/version_5_1.rb +2019 -0
- data/lib/vagrant-vcloudair/errors.rb +77 -0
- data/lib/vagrant-vcloudair/model/forwarded_port.rb +66 -0
- data/lib/vagrant-vcloudair/plugin.rb +111 -0
- data/lib/vagrant-vcloudair/provider.rb +41 -0
- data/lib/vagrant-vcloudair/util/compile_forwarded_ports.rb +34 -0
- data/lib/vagrant-vcloudair/version.rb +5 -0
- data/locales/en.yml +169 -0
- data/vagrant-vcloudair.gemspec +33 -0
- metadata +266 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bb97f77dcc8cb0fd7fd54097f99fcab10509aee2
|
4
|
+
data.tar.gz: b700c8093042947546e4196890b0da3122b27e3f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3ed1050acf1059682a514aa55d3297893831790d89761f56f26a683a14559487d8252b38d0c52f747f6842484f9bc724b4b4aef9843c4278abcfbaca07a764b9
|
7
|
+
data.tar.gz: 803d87130b13c3e4bfb9bf2ea1400406860427a03c60faf64220562df128987e234e988c2c94d8c52406ddec7b1aef6cad29243cb4f0233e70f569d65c557a88
|
data/.gitignore
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/test/tmp/
|
9
|
+
/test/version_tmp/
|
10
|
+
/tmp/
|
11
|
+
|
12
|
+
## Specific to RubyMotion:
|
13
|
+
.dat*
|
14
|
+
.repl_history
|
15
|
+
build/
|
16
|
+
|
17
|
+
## Documentation cache and generated files:
|
18
|
+
/.yardoc/
|
19
|
+
/_yardoc/
|
20
|
+
/doc/
|
21
|
+
/rdoc/
|
22
|
+
|
23
|
+
## Environment normalisation:
|
24
|
+
/.bundle/
|
25
|
+
/lib/bundler/man/
|
26
|
+
|
27
|
+
# for a library or gem, you might want to ignore these files since the code is
|
28
|
+
# intended to run in multiple environments; otherwise, check them in:
|
29
|
+
# Gemfile.lock
|
30
|
+
# .ruby-version
|
31
|
+
# .ruby-gemset
|
32
|
+
|
33
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
34
|
+
.rvmrc
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
MethodLength:
|
2
|
+
CountComments: false # count full line comments?
|
3
|
+
Enabled: false
|
4
|
+
|
5
|
+
MethodName:
|
6
|
+
EnforcedStyle: snake_case
|
7
|
+
|
8
|
+
AccessorMethodName:
|
9
|
+
Description: Check the naming of accessor methods for get_/set_.
|
10
|
+
Enabled: false
|
11
|
+
|
12
|
+
Encoding:
|
13
|
+
Description: 'Use UTF-8 as the source file encoding.'
|
14
|
+
Enabled: true
|
15
|
+
|
16
|
+
HashSyntax:
|
17
|
+
Description: >-
|
18
|
+
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
|
19
|
+
{ :a => 1, :b => 2 }.
|
20
|
+
Enabled: false
|
21
|
+
EnforcedStyle: hash_rockets
|
22
|
+
|
23
|
+
LineEndConcatenation:
|
24
|
+
Description: 'Use \\ instead of + to concatenate two string literals at line end.'
|
25
|
+
Enabled: true
|
26
|
+
|
27
|
+
LineLength:
|
28
|
+
Description: 'Limit lines to 80 characters.'
|
29
|
+
Enabled: true
|
30
|
+
Max: 80
|
31
|
+
|
32
|
+
CyclomaticComplexity:
|
33
|
+
Description: 'Avoid complex methods.'
|
34
|
+
Enabled: false
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Go SDDC!
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
[Vagrant](http://www.vagrantup.com) provider for [VMware vCloud Air®](http://vcloud.vmware.com)
|
2
|
+
=============
|
3
|
+
|
4
|
+
[Version 0.5.0](../../releases/tag/v0.5.0) has been released!
|
5
|
+
-------------
|
6
|
+
|
7
|
+
We have a wide array of boxes available at [Vagrant Cloud](https://vagrantcloud.com/gosddc) you can use them directly or you can roll your own as you please, make sure to install VMware tools in it.
|
8
|
+
|
9
|
+
This plugin supports the universal [```vmware_ovf``` box format](https://github.com/gosddc/packer-post-processor-vagrant-vmware-ovf/wiki/vmware_ovf-Box-Format), that is 100% portable between [vagrant-vcloud](https://github.com/frapposelli/vagrant-vcloud), [vagrant-vcenter](https://github.com/gosddc/vagrant-vcenter) and [vagrant-vcloudair](https://github.com/gosddc/vagrant-vcloudair), no more double boxes!.
|
10
|
+
|
11
|
+
If you're unsure about what are the correct network settings for your Vagrantfile make sure to check out the [Network Deployment Options](https://github.com/gosddc/vagrant-vcloudair/wiki/Network-Deployment-Options) wiki page.
|
12
|
+
|
13
|
+
Check the full releases changelog [here](../../releases)
|
14
|
+
|
15
|
+
Install
|
16
|
+
-------------
|
17
|
+
|
18
|
+
Latest version can be easily installed by running the following command:
|
19
|
+
|
20
|
+
```vagrant plugin install vagrant-vcloudair```
|
21
|
+
|
22
|
+
Vagrant will download all the required gems during the installation process.
|
23
|
+
|
24
|
+
After the install has completed a ```vagrant up --provider=vcloudair``` will trigger the newly installed provider.
|
25
|
+
|
26
|
+
Upgrade
|
27
|
+
-------------
|
28
|
+
|
29
|
+
If you already have vagrant-vcloudair installed you can update to the latest version available by issuing:
|
30
|
+
|
31
|
+
```vagrant plugin update vagrant-vcloudair```
|
32
|
+
|
33
|
+
Vagrant will take care of the upgrade process.
|
34
|
+
|
35
|
+
Configuration
|
36
|
+
-------------
|
37
|
+
|
38
|
+
Here's a sample Vagrantfile that builds a docker host on vCloud Air and starts a Wordpress container on port 80, make sure you replace the placeholders with your own values.
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
# Set our default provider for this Vagrantfile to 'vcloudair'
|
42
|
+
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'vcloudair'
|
43
|
+
|
44
|
+
nodes = [
|
45
|
+
{ hostname: 'vagrant-test1', box: 'gosddc/trusty64' },
|
46
|
+
]
|
47
|
+
|
48
|
+
Vagrant.configure('2') do |config|
|
49
|
+
|
50
|
+
# vCloud Air provider settings
|
51
|
+
config.vm.provider :vcloudair do |vcloudair|
|
52
|
+
|
53
|
+
vcloudair.username = '<username@domain>'
|
54
|
+
vcloudair.password = '<password>'
|
55
|
+
|
56
|
+
# if you're using a vCloud Air Dedicated Cloud, put the cloud id here, if
|
57
|
+
# you're using a Virtual Private Cloud, skip this parameter.
|
58
|
+
vcloudair.cloud_id = '<dedicated cloud id>'
|
59
|
+
vcloudair.vdc_name = '<vdc name>'
|
60
|
+
|
61
|
+
# Set the network to deploy our VM on
|
62
|
+
vcloudair.vdc_network_name = '<vdc network name>'
|
63
|
+
|
64
|
+
# Set our Edge Gateway and the public IP we're going to use.
|
65
|
+
vcloudair.vdc_edge_gateway = '<vdc edge gateway>'
|
66
|
+
vcloudair.vdc_edge_gateway_ip = '<vdc edge gateway public ip>'
|
67
|
+
|
68
|
+
# Catalog that holds our templates.
|
69
|
+
vcloudair.catalog_name = 'Vagrant'
|
70
|
+
|
71
|
+
# Set our Memory and CPU to a sensible value for Docker.
|
72
|
+
vcloudair.memory = 2048
|
73
|
+
vcloudair.cpus = 2
|
74
|
+
end
|
75
|
+
|
76
|
+
# Go through nodes and configure each of them.
|
77
|
+
nodes.each do |node|
|
78
|
+
config.vm.define node[:hostname] do |node_config|
|
79
|
+
# Set the box we're using
|
80
|
+
node_config.vm.box = node[:box]
|
81
|
+
# Set the hostname for the box
|
82
|
+
node_config.vm.hostname = node[:hostname]
|
83
|
+
# Fix a customization problem on Ubuntu and vCloud Air.
|
84
|
+
node_config.vm.provision 'shell', inline: 'echo "nameserver 8.8.8.8" >> tmp; sudo mv tmp /etc/resolvconf/resolv.conf.d/base; sudo resolvconf -u'
|
85
|
+
# Fetch and run Docker and the 'tutum/wordpress' container.
|
86
|
+
node_config.vm.provision 'docker' do |d|
|
87
|
+
d.run 'tutum/wordpress', cmd: '/run.sh', args: '-p 80:80'
|
88
|
+
end
|
89
|
+
# Declare NFS non functional as our plugin doesn't provide for it.
|
90
|
+
node_config.nfs.functional = false
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
```
|
96
|
+
|
97
|
+
For additional documentation on different network setups with vCloud Director, check the [Network Deployment Options](../../wiki/Network-Deployment-Options) Wiki page
|
98
|
+
|
99
|
+
Contribute
|
100
|
+
-------------
|
101
|
+
|
102
|
+
What is still missing:
|
103
|
+
|
104
|
+
- TEST SUITES! (working on that).
|
105
|
+
- Permission checks, make sure you have at least Catalog Admin privileges if you want to upload boxes to vCloud.
|
106
|
+
- Some spaghetti code here and there.
|
107
|
+
|
108
|
+
If you're a developer and want to lend us a hand, head over to our ```develop``` branch and send us PRs!
|
109
|
+
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
require 'vagrant-vcloudair/plugin'
|
3
|
+
|
4
|
+
module VagrantPlugins
|
5
|
+
module VCloudAir
|
6
|
+
lib_path = Pathname.new(File.expand_path('../vagrant-vcloudair', __FILE__))
|
7
|
+
autoload :Action, lib_path.join('action')
|
8
|
+
autoload :Errors, lib_path.join('errors')
|
9
|
+
|
10
|
+
# This returns the path to the source of this plugin.
|
11
|
+
#
|
12
|
+
# @return [Pathname]
|
13
|
+
def self.source_root
|
14
|
+
@source_root ||= Pathname.new(File.expand_path('../../', __FILE__))
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
module Vagrant
|
20
|
+
class Machine
|
21
|
+
attr_reader :vappid
|
22
|
+
|
23
|
+
def vappid=(value)
|
24
|
+
@logger.info("New vApp ID: #{value.inspect}")
|
25
|
+
|
26
|
+
# The file that will store the id if we have one. This allows the
|
27
|
+
# ID to persist across Vagrant runs.
|
28
|
+
|
29
|
+
id_file = @data_dir.join('../../../vcloudair_vappid')
|
30
|
+
|
31
|
+
### this should be ./.vagrant/vcloudair_vappid
|
32
|
+
|
33
|
+
if value
|
34
|
+
# Write the "id" file with the id given.
|
35
|
+
id_file.open('w+') do |f|
|
36
|
+
f.write(value)
|
37
|
+
end
|
38
|
+
else
|
39
|
+
# Delete the file, since the machine is now destroyed
|
40
|
+
id_file.delete if id_file.file?
|
41
|
+
end
|
42
|
+
|
43
|
+
# Store the ID locally
|
44
|
+
@vappid = value
|
45
|
+
|
46
|
+
# Notify the provider that the ID changed in case it needs to do
|
47
|
+
# any accounting from it.
|
48
|
+
# @provider.machine_id_changed
|
49
|
+
end
|
50
|
+
|
51
|
+
# This returns the vCloud Air vApp ID.
|
52
|
+
#
|
53
|
+
# @return [vAppId]
|
54
|
+
def get_vapp_id
|
55
|
+
vappid_file = @data_dir.join('../../../vcloudair_vappid')
|
56
|
+
if vappid_file.file?
|
57
|
+
@vappid = vappid_file.read
|
58
|
+
else
|
59
|
+
nil
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,298 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
require 'vagrant/action/builder'
|
3
|
+
|
4
|
+
module VagrantPlugins
|
5
|
+
module VCloudAir
|
6
|
+
# This module dictates the actions to be performed by Vagrant when called
|
7
|
+
# with a specific command
|
8
|
+
module Action
|
9
|
+
include Vagrant::Action::Builtin
|
10
|
+
|
11
|
+
# Vagrant commands
|
12
|
+
# This action boots the VM, assuming the VM is in a state that requires
|
13
|
+
# a bootup (i.e. not saved).
|
14
|
+
def self.action_boot
|
15
|
+
Vagrant::Action::Builder.new.tap do |b|
|
16
|
+
b.use ConfigValidate
|
17
|
+
b.use PowerOn
|
18
|
+
b.use Call, IsCreated do |env, b2|
|
19
|
+
unless env[:bridged_network]
|
20
|
+
b2.use HandleNATPortCollisions
|
21
|
+
b2.use ForwardPorts
|
22
|
+
end
|
23
|
+
end
|
24
|
+
b.use WaitForCommunicator, [:starting, :running]
|
25
|
+
b.use Provision
|
26
|
+
b.use SyncedFolders
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.action_reload
|
31
|
+
Vagrant::Action::Builder.new.tap do |b|
|
32
|
+
b.use ConfigValidate
|
33
|
+
b.use Call, IsCreated do |env, b2|
|
34
|
+
unless env[:result]
|
35
|
+
b2.use MessageNotCreated
|
36
|
+
next
|
37
|
+
end
|
38
|
+
b2.use action_halt
|
39
|
+
b2.use action_start
|
40
|
+
b2.use DisconnectVCloudAir
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# This action starts a VM, assuming it is already imported and exists.
|
46
|
+
# A precondition of this action is that the VM exists.
|
47
|
+
def self.action_start
|
48
|
+
Vagrant::Action::Builder.new.tap do |b|
|
49
|
+
b.use ConfigValidate
|
50
|
+
b.use ConnectVCloudAir
|
51
|
+
b.use Call, IsRunning do |env, b2|
|
52
|
+
# If the VM is running, then our work here is done, exit
|
53
|
+
if env[:result]
|
54
|
+
b2.use MessageAlreadyRunning
|
55
|
+
else
|
56
|
+
b2.use PowerOn
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.action_halt
|
63
|
+
Vagrant::Action::Builder.new.tap do |b|
|
64
|
+
b.use ConfigValidate
|
65
|
+
b.use ConnectVCloudAir
|
66
|
+
b.use Call, IsPaused do |env, b2|
|
67
|
+
b2.use Resume if env[:result]
|
68
|
+
end
|
69
|
+
b.use PowerOff
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.action_suspend
|
74
|
+
Vagrant::Action::Builder.new.tap do |b|
|
75
|
+
b.use ConnectVCloudAir
|
76
|
+
b.use Call, IsRunning do |env, b2|
|
77
|
+
# If the VM is stopped, can't suspend
|
78
|
+
if !env[:result]
|
79
|
+
b2.use MessageCannotSuspend
|
80
|
+
else
|
81
|
+
b2.use Suspend
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def self.action_resume
|
88
|
+
Vagrant::Action::Builder.new.tap do |b|
|
89
|
+
b.use ConnectVCloudAir
|
90
|
+
b.use Resume
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.action_destroy
|
95
|
+
Vagrant::Action::Builder.new.tap do |b|
|
96
|
+
b.use Call, DestroyConfirm do |env, b2|
|
97
|
+
if env[:result]
|
98
|
+
b2.use ConfigValidate
|
99
|
+
b2.use ConnectVCloudAir
|
100
|
+
b2.use Call, IsCreated do |env2, b3|
|
101
|
+
unless env2[:result]
|
102
|
+
b3.use MessageNotCreated
|
103
|
+
next
|
104
|
+
end
|
105
|
+
|
106
|
+
b3.use Call, IsRunning do |env3, b4|
|
107
|
+
# If the VM is running, must power off
|
108
|
+
b4.use action_halt if env3[:result]
|
109
|
+
end
|
110
|
+
b3.use Call, IsLastVM do |env3, b4|
|
111
|
+
if env3[:result]
|
112
|
+
# Check if the network is bridged
|
113
|
+
b4.use Call, IsBridged do |env4, b5|
|
114
|
+
# if it's not, delete port forwardings.
|
115
|
+
b5.use UnmapPortForwardings unless env4[:bridged_network]
|
116
|
+
end
|
117
|
+
b4.use PowerOffVApp
|
118
|
+
b4.use DestroyVApp
|
119
|
+
else
|
120
|
+
b4.use DestroyVM
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
else
|
125
|
+
b2.use MessageWillNotDestroy
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def self.action_provision
|
132
|
+
Vagrant::Action::Builder.new.tap do |b|
|
133
|
+
b.use ConfigValidate
|
134
|
+
b.use Call, IsCreated do |env, b2|
|
135
|
+
unless env[:result]
|
136
|
+
b2.use MessageNotCreated
|
137
|
+
next
|
138
|
+
end
|
139
|
+
b2.use Call, IsRunning do |env2, b3|
|
140
|
+
# If the VM is not running, must power on
|
141
|
+
b3.use action_start unless env2[:result]
|
142
|
+
b3.use Provision
|
143
|
+
b3.use SyncedFolders
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
# This action is called to read the SSH info of the machine. The
|
150
|
+
# resulting state is expected to be put into the `:machine_ssh_info`
|
151
|
+
# key.
|
152
|
+
def self.action_read_ssh_info
|
153
|
+
Vagrant::Action::Builder.new.tap do |b|
|
154
|
+
b.use ConnectVCloudAir
|
155
|
+
b.use ReadSSHInfo, 22
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
def self.action_read_winrm_info
|
160
|
+
Vagrant::Action::Builder.new.tap do |b|
|
161
|
+
b.use ConnectVCloudAir
|
162
|
+
b.use ReadSSHInfo, 5985
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
def self.action_read_rdp_info
|
167
|
+
Vagrant::Action::Builder.new.tap do |b|
|
168
|
+
b.use ConnectVCloudAir
|
169
|
+
b.use ReadSSHInfo, 3389
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
# This action is called to read the state of the machine. The
|
174
|
+
# resulting state is expected to be put into the `:machine_state_id`
|
175
|
+
# key.
|
176
|
+
def self.action_read_state
|
177
|
+
Vagrant::Action::Builder.new.tap do |b|
|
178
|
+
b.use ConfigValidate
|
179
|
+
b.use ConnectVCloudAir
|
180
|
+
b.use ReadState
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
def self.action_ssh
|
185
|
+
Vagrant::Action::Builder.new.tap do |b|
|
186
|
+
# b.use ConfigValidate
|
187
|
+
b.use Call, IsCreated do |env, b2|
|
188
|
+
unless env[:result]
|
189
|
+
b2.use MessageNotCreated
|
190
|
+
next
|
191
|
+
end
|
192
|
+
|
193
|
+
b2.use Call, IsRunning do |env2, b3|
|
194
|
+
unless env2[:result]
|
195
|
+
b3.use MessageNotRunning
|
196
|
+
next
|
197
|
+
end
|
198
|
+
# This calls our helper that announces the IP used to connect
|
199
|
+
# to the VM, either directly to the vApp vShield or to the Org Edge
|
200
|
+
b3.use AnnounceSSHExec
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
def self.action_ssh_run
|
207
|
+
Vagrant::Action::Builder.new.tap do |b|
|
208
|
+
b.use ConfigValidate
|
209
|
+
b.use Call, IsCreated do |env, b2|
|
210
|
+
unless env[:result]
|
211
|
+
b2.use MessageNotCreated
|
212
|
+
next
|
213
|
+
end
|
214
|
+
|
215
|
+
b2.use SSHRun
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
def self.action_up
|
221
|
+
Vagrant::Action::Builder.new.tap do |b|
|
222
|
+
b.use ConfigValidate
|
223
|
+
b.use Call, IsCreated do |env, b2|
|
224
|
+
b2.use HandleBox unless env[:result]
|
225
|
+
end
|
226
|
+
b.use ConnectVCloudAir
|
227
|
+
b.use InventoryCheck
|
228
|
+
b.use Call, IsCreated do |env, b2|
|
229
|
+
if env[:result]
|
230
|
+
b2.use action_start
|
231
|
+
else
|
232
|
+
b2.use BuildVApp
|
233
|
+
b2.use action_boot
|
234
|
+
end
|
235
|
+
end
|
236
|
+
b.use DisconnectVCloudAir
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
# The autoload farm
|
241
|
+
action_root = Pathname.new(File.expand_path('../action', __FILE__))
|
242
|
+
autoload :AnnounceSSHExec,
|
243
|
+
action_root.join('announce_ssh_exec')
|
244
|
+
autoload :BuildVApp,
|
245
|
+
action_root.join('build_vapp')
|
246
|
+
autoload :ConnectVCloudAir,
|
247
|
+
action_root.join('connect_vcloud')
|
248
|
+
autoload :DestroyVM,
|
249
|
+
action_root.join('destroy_vm')
|
250
|
+
autoload :DestroyVApp,
|
251
|
+
action_root.join('destroy_vapp')
|
252
|
+
autoload :DisconnectVCloudAir,
|
253
|
+
action_root.join('disconnect_vcloud')
|
254
|
+
autoload :ForwardPorts,
|
255
|
+
action_root.join('forward_ports')
|
256
|
+
autoload :HandleNATPortCollisions,
|
257
|
+
action_root.join('handle_nat_port_collisions')
|
258
|
+
autoload :InventoryCheck,
|
259
|
+
action_root.join('inventory_check')
|
260
|
+
autoload :IsCreated,
|
261
|
+
action_root.join('is_created')
|
262
|
+
autoload :IsBridged,
|
263
|
+
action_root.join('is_bridged')
|
264
|
+
autoload :IsPaused,
|
265
|
+
action_root.join('is_paused')
|
266
|
+
autoload :IsRunning,
|
267
|
+
action_root.join('is_running')
|
268
|
+
autoload :IsLastVM,
|
269
|
+
action_root.join('is_last_vm')
|
270
|
+
autoload :MessageAlreadyRunning,
|
271
|
+
action_root.join('message_already_running')
|
272
|
+
autoload :MessageNotRunning,
|
273
|
+
action_root.join('message_not_running')
|
274
|
+
autoload :MessageCannotSuspend,
|
275
|
+
action_root.join('message_cannot_suspend')
|
276
|
+
autoload :MessageNotCreated,
|
277
|
+
action_root.join('message_not_created')
|
278
|
+
autoload :MessageWillNotDestroy,
|
279
|
+
action_root.join('message_will_not_destroy')
|
280
|
+
autoload :PowerOff,
|
281
|
+
action_root.join('power_off')
|
282
|
+
autoload :PowerOffVApp,
|
283
|
+
action_root.join('power_off_vapp')
|
284
|
+
autoload :PowerOn,
|
285
|
+
action_root.join('power_on')
|
286
|
+
autoload :ReadSSHInfo,
|
287
|
+
action_root.join('read_ssh_info')
|
288
|
+
autoload :ReadState,
|
289
|
+
action_root.join('read_state')
|
290
|
+
autoload :Resume,
|
291
|
+
action_root.join('resume')
|
292
|
+
autoload :Suspend,
|
293
|
+
action_root.join('suspend')
|
294
|
+
autoload :UnmapPortForwardings,
|
295
|
+
action_root.join('unmap_port_forwardings')
|
296
|
+
end
|
297
|
+
end
|
298
|
+
end
|