vagrant-vmware-appcatalyst 1.0.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 +7 -0
- data/.gitignore +38 -0
- data/.rubocop.yml +34 -0
- data/Gemfile +7 -0
- data/LICENSE +177 -0
- data/README.md +72 -0
- data/lib/vagrant-vmware-appcatalyst.rb +30 -0
- data/lib/vagrant-vmware-appcatalyst/action.rb +249 -0
- data/lib/vagrant-vmware-appcatalyst/action/connect_appcatalyst.rb +45 -0
- data/lib/vagrant-vmware-appcatalyst/action/destroy_vm.rb +33 -0
- data/lib/vagrant-vmware-appcatalyst/action/import.rb +101 -0
- data/lib/vagrant-vmware-appcatalyst/action/is_created.rb +34 -0
- data/lib/vagrant-vmware-appcatalyst/action/is_paused.rb +33 -0
- data/lib/vagrant-vmware-appcatalyst/action/is_running.rb +32 -0
- data/lib/vagrant-vmware-appcatalyst/action/message_already_running.rb +29 -0
- data/lib/vagrant-vmware-appcatalyst/action/message_not_created.rb +29 -0
- data/lib/vagrant-vmware-appcatalyst/action/message_not_running.rb +29 -0
- data/lib/vagrant-vmware-appcatalyst/action/message_not_supported.rb +29 -0
- data/lib/vagrant-vmware-appcatalyst/action/message_will_not_destroy.rb +30 -0
- data/lib/vagrant-vmware-appcatalyst/action/power_off.rb +40 -0
- data/lib/vagrant-vmware-appcatalyst/action/power_on.rb +34 -0
- data/lib/vagrant-vmware-appcatalyst/action/read_ssh_info.rb +56 -0
- data/lib/vagrant-vmware-appcatalyst/action/read_state.rb +72 -0
- data/lib/vagrant-vmware-appcatalyst/action/resume.rb +31 -0
- data/lib/vagrant-vmware-appcatalyst/action/suspend.rb +31 -0
- data/lib/vagrant-vmware-appcatalyst/cap/mount_appcatalyst_shared_folder.rb +100 -0
- data/lib/vagrant-vmware-appcatalyst/cap/public_address.rb +31 -0
- data/lib/vagrant-vmware-appcatalyst/config.rb +40 -0
- data/lib/vagrant-vmware-appcatalyst/driver/base.rb +131 -0
- data/lib/vagrant-vmware-appcatalyst/driver/meta.rb +106 -0
- data/lib/vagrant-vmware-appcatalyst/driver/version_1_0.rb +223 -0
- data/lib/vagrant-vmware-appcatalyst/errors.rb +44 -0
- data/lib/vagrant-vmware-appcatalyst/plugin.rb +111 -0
- data/lib/vagrant-vmware-appcatalyst/provider.rb +60 -0
- data/lib/vagrant-vmware-appcatalyst/synced_folder.rb +123 -0
- data/lib/vagrant-vmware-appcatalyst/version.rb +18 -0
- data/locales/en.yml +29 -0
- data/vagrant-vmware-appcatalyst.gemspec +40 -0
- metadata +165 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b426847c9163652262ca396c7cc001219e005f74
|
4
|
+
data.tar.gz: ad1584d44fd398d7769f37038bd843731de6c50c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 32f729a479ca49017f92e19aadfa91953b8351d38ee4c5220496757d5837ca530c0f3038640a6332a2ecfc531d1b136de6c15013400d957c0ba9a0bf52b20641
|
7
|
+
data.tar.gz: 694c59dcd7cf1ba91e70ea46c440cda593f1db9606aa00acebc8c312639c4c8528bc1b1bdabd3d0e337bada57719b7acd05490e0859f227e59a68f0c40ba3ac0
|
data/.gitignore
ADDED
@@ -0,0 +1,38 @@
|
|
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
|
35
|
+
|
36
|
+
# Vagrant specifics
|
37
|
+
Vagrantfile*
|
38
|
+
vagrant*deb
|
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,177 @@
|
|
1
|
+
|
2
|
+
Apache License
|
3
|
+
Version 2.0, January 2004
|
4
|
+
http://www.apache.org/licenses/
|
5
|
+
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
7
|
+
|
8
|
+
1. Definitions.
|
9
|
+
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
12
|
+
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
14
|
+
the copyright owner that is granting the License.
|
15
|
+
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
17
|
+
other entities that control, are controlled by, or are under common
|
18
|
+
control with that entity. For the purposes of this definition,
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
20
|
+
direction or management of such entity, whether by contract or
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
23
|
+
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
25
|
+
exercising permissions granted by this License.
|
26
|
+
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
28
|
+
including but not limited to software source code, documentation
|
29
|
+
source, and configuration files.
|
30
|
+
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
32
|
+
transformation or translation of a Source form, including but
|
33
|
+
not limited to compiled object code, generated documentation,
|
34
|
+
and conversions to other media types.
|
35
|
+
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
37
|
+
Object form, made available under the License, as indicated by a
|
38
|
+
copyright notice that is included in or attached to the work
|
39
|
+
(an example is provided in the Appendix below).
|
40
|
+
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
47
|
+
the Work and Derivative Works thereof.
|
48
|
+
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
50
|
+
the original version of the Work and any modifications or additions
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
62
|
+
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
65
|
+
subsequently incorporated within the Work.
|
66
|
+
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
73
|
+
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
79
|
+
where such license applies only to those patent claims licensable
|
80
|
+
by such Contributor that are necessarily infringed by their
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
83
|
+
institute patent litigation against any entity (including a
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
86
|
+
or contributory patent infringement, then any patent licenses
|
87
|
+
granted to You under this License for that Work shall terminate
|
88
|
+
as of the date such litigation is filed.
|
89
|
+
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
92
|
+
modifications, and in Source or Object form, provided that You
|
93
|
+
meet the following conditions:
|
94
|
+
|
95
|
+
(a) You must give any other recipients of the Work or
|
96
|
+
Derivative Works a copy of this License; and
|
97
|
+
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
99
|
+
stating that You changed the files; and
|
100
|
+
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
103
|
+
attribution notices from the Source form of the Work,
|
104
|
+
excluding those notices that do not pertain to any part of
|
105
|
+
the Derivative Works; and
|
106
|
+
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
109
|
+
include a readable copy of the attribution notices contained
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
112
|
+
of the following places: within a NOTICE text file distributed
|
113
|
+
as part of the Derivative Works; within the Source form or
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
115
|
+
within a display generated by the Derivative Works, if and
|
116
|
+
wherever such third-party notices normally appear. The contents
|
117
|
+
of the NOTICE file are for informational purposes only and
|
118
|
+
do not modify the License. You may add Your own attribution
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
121
|
+
that such additional attribution notices cannot be construed
|
122
|
+
as modifying the License.
|
123
|
+
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
125
|
+
may provide additional or different license terms and conditions
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
129
|
+
the conditions stated in this License.
|
130
|
+
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
134
|
+
this License, without any additional terms or conditions.
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
136
|
+
the terms of any separate license agreement you may have executed
|
137
|
+
with Licensor regarding such Contributions.
|
138
|
+
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
141
|
+
except as required for reasonable and customary use in describing the
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
143
|
+
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
153
|
+
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
159
|
+
incidental, or consequential damages of any character arising as a
|
160
|
+
result of this License or out of the use or inability to use the
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
163
|
+
other commercial damages or losses), even if such Contributor
|
164
|
+
has been advised of the possibility of such damages.
|
165
|
+
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
169
|
+
or other liability obligations and/or rights consistent with this
|
170
|
+
License. However, in accepting such obligations, You may act only
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
175
|
+
of your accepting any such warranty or additional liability.
|
176
|
+
|
177
|
+
END OF TERMS AND CONDITIONS
|
data/README.md
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
[Vagrant](http://www.vagrantup.com) provider for [VMware AppCatalyst®](https://communities.vmware.com/community/vmtn/devops/vmware-appcatalyst) [](http://badge.fury.io/rb/vagrant-vmware-appcatalyst) [](https://gitter.im/vmware/vagrant-vmware-appcatalyst?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
2
|
+
=============
|
3
|
+
|
4
|
+
This plugin supports `vmware_desktop`, `vmware_fusion` and `vmware_workstation` box type, the same used by Hashicorp plugins for VMware products.
|
5
|
+
|
6
|
+
Install
|
7
|
+
-------------
|
8
|
+
|
9
|
+
Latest version can be easily installed by running the following command:
|
10
|
+
|
11
|
+
```vagrant plugin install vagrant-vmware-appcatalyst```
|
12
|
+
|
13
|
+
Vagrant will download all the required gems during the installation process.
|
14
|
+
|
15
|
+
After the install has completed a ```vagrant up --provider=vmware_appcatalyst``` will trigger the newly installed provider.
|
16
|
+
|
17
|
+
Upgrade
|
18
|
+
-------------
|
19
|
+
|
20
|
+
If you already have vagrant-vmware-appcatalyst installed you can update to the latest version available by issuing:
|
21
|
+
|
22
|
+
```vagrant plugin update vagrant-vmware-appcatalyst```
|
23
|
+
|
24
|
+
Vagrant will take care of the upgrade process.
|
25
|
+
|
26
|
+
Configuration
|
27
|
+
-------------
|
28
|
+
|
29
|
+
Here's a sample Vagrantfile that builds a docker host on AppCatalyst and starts a Wordpress container on port 80, make sure you replace the placeholders with your own values.
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
# Set our default provider for this Vagrantfile to 'vmware_appcatalyst'
|
33
|
+
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'vmware_appcatalyst'
|
34
|
+
|
35
|
+
nodes = [
|
36
|
+
{ hostname: 'gantry-test-1', box: 'hashicorp/precise64' },
|
37
|
+
{ hostname: 'gantry-test-2', box: 'hashicorp/precise64' }
|
38
|
+
]
|
39
|
+
|
40
|
+
Vagrant.configure('2') do |config|
|
41
|
+
|
42
|
+
# Configure our boxes with 1 CPU and 384MB of RAM
|
43
|
+
config.vm.provider 'vmware_gantry' do |v|
|
44
|
+
v.vmx['numvcpus'] = '1'
|
45
|
+
v.vmx['memsize'] = '384'
|
46
|
+
end
|
47
|
+
|
48
|
+
# Go through nodes and configure each of them.j
|
49
|
+
nodes.each do |node|
|
50
|
+
config.vm.define node[:hostname] do |node_config|
|
51
|
+
node_config.vm.box = node[:box]
|
52
|
+
node_config.vm.hostname = node[:hostname]
|
53
|
+
node_config.vm.synced_folder('/Users/frapposelli/Development', '/development')
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
```
|
59
|
+
|
60
|
+
Legal
|
61
|
+
-----
|
62
|
+
|
63
|
+
Copyright © 2015 VMware, Inc. All Rights Reserved.
|
64
|
+
|
65
|
+
Licensed under the Apache License, Version 2.0 (the “License”); you may not
|
66
|
+
use this file except in compliance with the License. You may obtain a copy of
|
67
|
+
the License at http://www.apache.org/licenses/LICENSE-2.0
|
68
|
+
|
69
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
70
|
+
under the License is distributed on an “AS IS” BASIS, without warranties or
|
71
|
+
conditions of any kind, EITHER EXPRESS OR IMPLIED. See the License for the
|
72
|
+
specific language governing permissions and limitations under the License.
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Copyright (c) 2015 VMware, Inc. All Rights Reserved.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
5
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
6
|
+
# the License at http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
#
|
8
|
+
# Unless required by applicable law or agreed to in writing, software
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS, without
|
10
|
+
# warranties or conditions of any kind, EITHER EXPRESS OR IMPLIED. See the
|
11
|
+
# License for the specific language governing permissions and limitations under
|
12
|
+
# the License.
|
13
|
+
|
14
|
+
require 'pathname'
|
15
|
+
require 'vagrant-vmware-appcatalyst/plugin'
|
16
|
+
|
17
|
+
module VagrantPlugins
|
18
|
+
module AppCatalyst
|
19
|
+
lib_path = Pathname.new(File.expand_path('../vagrant-vmware-appcatalyst', __FILE__))
|
20
|
+
autoload :Action, lib_path.join('action')
|
21
|
+
autoload :Errors, lib_path.join('errors')
|
22
|
+
|
23
|
+
# This returns the path to the source of this plugin.
|
24
|
+
#
|
25
|
+
# @return [Pathname]
|
26
|
+
def self.source_root
|
27
|
+
@source_root ||= Pathname.new(File.expand_path('../../', __FILE__))
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,249 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Copyright (c) 2015 VMware, Inc. All Rights Reserved.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
5
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
6
|
+
# the License at http://www.apache.org/licenses/LICENSE-2.0
|
7
|
+
#
|
8
|
+
# Unless required by applicable law or agreed to in writing, software
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS, without
|
10
|
+
# warranties or conditions of any kind, EITHER EXPRESS OR IMPLIED. See the
|
11
|
+
# License for the specific language governing permissions and limitations under
|
12
|
+
# the License.
|
13
|
+
|
14
|
+
require 'pathname'
|
15
|
+
require 'vagrant/action/builder'
|
16
|
+
|
17
|
+
module VagrantPlugins
|
18
|
+
module AppCatalyst
|
19
|
+
# This module dictates the actions to be performed by Vagrant when called
|
20
|
+
# with a specific command
|
21
|
+
module Action
|
22
|
+
include Vagrant::Action::Builtin
|
23
|
+
|
24
|
+
# Vagrant commands
|
25
|
+
# This action boots the VM, assuming the VM is in a state that requires
|
26
|
+
# a bootup (i.e. not saved).
|
27
|
+
def self.action_boot
|
28
|
+
Vagrant::Action::Builder.new.tap do |b|
|
29
|
+
b.use ConfigValidate
|
30
|
+
b.use PowerOn
|
31
|
+
b.use WaitForCommunicator, [:starting, :running]
|
32
|
+
b.use Provision
|
33
|
+
b.use SetHostname
|
34
|
+
b.use SyncedFolderCleanup
|
35
|
+
b.use SyncedFolders
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.action_reload
|
40
|
+
Vagrant::Action::Builder.new.tap do |b|
|
41
|
+
b.use ConfigValidate
|
42
|
+
b.use Call, IsCreated do |env, b2|
|
43
|
+
unless env[:result]
|
44
|
+
b2.use MessageNotCreated
|
45
|
+
next
|
46
|
+
end
|
47
|
+
b2.use action_halt
|
48
|
+
b2.use action_start
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# This action starts a VM, assuming it is already imported and exists.
|
54
|
+
# A precondition of this action is that the VM exists.
|
55
|
+
def self.action_start
|
56
|
+
Vagrant::Action::Builder.new.tap do |b|
|
57
|
+
b.use ConnectAppCatalyst
|
58
|
+
b.use ConfigValidate
|
59
|
+
b.use BoxCheckOutdated
|
60
|
+
b.use Call, IsRunning do |env, b2|
|
61
|
+
# If the VM is running, then our work here is done, exit
|
62
|
+
if env[:result]
|
63
|
+
b2.use MessageAlreadyRunning
|
64
|
+
next
|
65
|
+
end
|
66
|
+
|
67
|
+
b2.use action_boot
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.action_halt
|
73
|
+
Vagrant::Action::Builder.new.tap do |b|
|
74
|
+
b.use ConfigValidate
|
75
|
+
b.use ConnectAppCatalyst
|
76
|
+
b.use PowerOff
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def self.action_suspend
|
81
|
+
Vagrant::Action::Builder.new.tap do |b|
|
82
|
+
b.use MessageNotSupported
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.action_resume
|
87
|
+
Vagrant::Action::Builder.new.tap do |b|
|
88
|
+
b.use MessageNotSupported
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def self.action_destroy
|
93
|
+
Vagrant::Action::Builder.new.tap do |b|
|
94
|
+
b.use Call, DestroyConfirm do |env, b2|
|
95
|
+
if env[:result]
|
96
|
+
b2.use ConfigValidate
|
97
|
+
b2.use ConnectAppCatalyst
|
98
|
+
b2.use Call, IsCreated do |env2, b3|
|
99
|
+
unless env2[:result]
|
100
|
+
b3.use MessageNotCreated
|
101
|
+
next
|
102
|
+
end
|
103
|
+
b3.use ProvisionerCleanup
|
104
|
+
b3.use Call, IsRunning do |env3, b4|
|
105
|
+
# If the VM is running, must power off
|
106
|
+
b4.use action_halt if env3[:result]
|
107
|
+
end
|
108
|
+
b3.use DestroyVM
|
109
|
+
end
|
110
|
+
else
|
111
|
+
b2.use MessageWillNotDestroy
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def self.action_provision
|
118
|
+
Vagrant::Action::Builder.new.tap do |b|
|
119
|
+
b.use ConfigValidate
|
120
|
+
b.use Call, IsCreated do |env, b2|
|
121
|
+
unless env[:result]
|
122
|
+
b2.use MessageNotCreated
|
123
|
+
next
|
124
|
+
end
|
125
|
+
b2.use Call, IsRunning do |env2, b3|
|
126
|
+
unless env2[:result]
|
127
|
+
b3.use MessageNotRunning
|
128
|
+
next
|
129
|
+
end
|
130
|
+
b3.use Provision
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
# This action is called to read the SSH info of the machine. The
|
137
|
+
# resulting state is expected to be put into the `:machine_ssh_info`
|
138
|
+
# key.
|
139
|
+
def self.action_read_ssh_info
|
140
|
+
Vagrant::Action::Builder.new.tap do |b|
|
141
|
+
b.use ConnectAppCatalyst
|
142
|
+
b.use ReadSSHInfo, 22
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
# This action is called to read the state of the machine. The
|
147
|
+
# resulting state is expected to be put into the `:machine_state_id`
|
148
|
+
# key.
|
149
|
+
def self.action_read_state
|
150
|
+
Vagrant::Action::Builder.new.tap do |b|
|
151
|
+
b.use ConfigValidate
|
152
|
+
b.use ConnectAppCatalyst
|
153
|
+
b.use ReadState
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
def self.action_ssh
|
158
|
+
Vagrant::Action::Builder.new.tap do |b|
|
159
|
+
# b.use ConfigValidate
|
160
|
+
b.use Call, IsCreated do |env, b2|
|
161
|
+
unless env[:result]
|
162
|
+
b2.use MessageNotCreated
|
163
|
+
next
|
164
|
+
end
|
165
|
+
|
166
|
+
b2.use Call, IsRunning do |env2, b3|
|
167
|
+
unless env2[:result]
|
168
|
+
b3.use MessageNotRunning
|
169
|
+
next
|
170
|
+
end
|
171
|
+
b3.use SSHExec
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
def self.action_ssh_run
|
178
|
+
Vagrant::Action::Builder.new.tap do |b|
|
179
|
+
b.use ConfigValidate
|
180
|
+
b.use Call, IsCreated do |env, b2|
|
181
|
+
unless env[:result]
|
182
|
+
b2.use MessageNotCreated
|
183
|
+
next
|
184
|
+
end
|
185
|
+
|
186
|
+
b2.use SSHRun
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
def self.action_up
|
192
|
+
Vagrant::Action::Builder.new.tap do |b|
|
193
|
+
b.use ConnectAppCatalyst
|
194
|
+
|
195
|
+
b.use Call, IsCreated do |env, b2|
|
196
|
+
b2.use HandleBox unless env[:result]
|
197
|
+
end
|
198
|
+
|
199
|
+
b.use ConfigValidate
|
200
|
+
|
201
|
+
b.use Call, IsCreated do |env, b2|
|
202
|
+
unless env[:result]
|
203
|
+
b2.use Import
|
204
|
+
end
|
205
|
+
end
|
206
|
+
b.use action_start
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
def self.action_connect
|
211
|
+
Vagrant::Action::Builder.new.tap do |b|
|
212
|
+
b.use ConnectAppCatalyst
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
|
217
|
+
# The autoload farm
|
218
|
+
action_root = Pathname.new(File.expand_path('../action', __FILE__))
|
219
|
+
autoload :Import,
|
220
|
+
action_root.join('import')
|
221
|
+
autoload :ConnectAppCatalyst,
|
222
|
+
action_root.join('connect_appcatalyst')
|
223
|
+
autoload :DestroyVM,
|
224
|
+
action_root.join('destroy_vm')
|
225
|
+
autoload :IsCreated,
|
226
|
+
action_root.join('is_created')
|
227
|
+
autoload :IsRunning,
|
228
|
+
action_root.join('is_running')
|
229
|
+
autoload :MessageAlreadyRunning,
|
230
|
+
action_root.join('message_already_running')
|
231
|
+
autoload :MessageNotRunning,
|
232
|
+
action_root.join('message_not_running')
|
233
|
+
autoload :MessageNotCreated,
|
234
|
+
action_root.join('message_not_created')
|
235
|
+
autoload :MessageNotSupported,
|
236
|
+
action_root.join('message_not_supported')
|
237
|
+
autoload :MessageWillNotDestroy,
|
238
|
+
action_root.join('message_will_not_destroy')
|
239
|
+
autoload :PowerOff,
|
240
|
+
action_root.join('power_off')
|
241
|
+
autoload :PowerOn,
|
242
|
+
action_root.join('power_on')
|
243
|
+
autoload :ReadSSHInfo,
|
244
|
+
action_root.join('read_ssh_info')
|
245
|
+
autoload :ReadState,
|
246
|
+
action_root.join('read_state')
|
247
|
+
end
|
248
|
+
end
|
249
|
+
end
|