vagrant-brightbox 0.2.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +14 -0
- data/Gemfile +5 -1
- data/README.md +20 -0
- data/Rakefile +1 -0
- data/Vagrantfile.example +0 -1
- data/lib/vagrant-brightbox/action.rb +105 -80
- data/lib/vagrant-brightbox/action/connect_brightbox.rb +1 -1
- data/lib/vagrant-brightbox/action/create_server.rb +30 -2
- data/lib/vagrant-brightbox/action/{is_running.rb → is_stopped.rb} +3 -3
- data/lib/vagrant-brightbox/action/message_already_created.rb +1 -1
- data/lib/vagrant-brightbox/action/message_will_not_destroy.rb +16 -0
- data/lib/vagrant-brightbox/action/wait_for_state.rb +41 -0
- data/lib/vagrant-brightbox/errors.rb +0 -1
- data/lib/vagrant-brightbox/plugin.rb +1 -1
- data/lib/vagrant-brightbox/version.rb +1 -1
- data/locales/en.yml +5 -2
- data/vagrant-brightbox.gemspec +41 -5
- metadata +20 -33
- data/lib/vagrant-brightbox/action/sync_folders.rb +0 -66
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: fc94646eff27be3d9d076707b26a2cac32387813
|
4
|
+
data.tar.gz: e623ba8c109814ffee2a0d469f6442e2961f943f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0fe15959ed570d6f942dce526a39d4de05190407f550eff4c4f6823efc4bffffc15180bd70dd8f8b46c66efba629b1e45b24765d75e1d57d1567bf7497318e5b
|
7
|
+
data.tar.gz: e259b28cf12dbca51ed73ee24b95d6ee27207ae414f2c3c2fa5a974756ca3ae434452b5839e28fb45e2b50bf403ffe62b8b09b31aa2ec708aefb65cb81e67c0d
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
# 0.3.1 (July 2, 2015)
|
2
|
+
* Gem FUBAR
|
3
|
+
|
4
|
+
# 0.3.0 (July 2, 2015)
|
5
|
+
* Refresh dependencies
|
6
|
+
* Merge from upstream 'vagrant-aws' v0.6.0
|
7
|
+
* Don't sync folders on a provision
|
8
|
+
* Check for outdated box file
|
9
|
+
|
10
|
+
# 0.2.1 (unreleased)
|
11
|
+
|
12
|
+
* Confirm before destroying server
|
13
|
+
* Handle BoxURL before validate on box startup.
|
14
|
+
|
1
15
|
# 0.2.0 (April 19, 2013)
|
2
16
|
|
3
17
|
* Merge from upstream 'vagrant-aws' v0.2.2
|
data/Gemfile
CHANGED
@@ -6,5 +6,9 @@ group :development do
|
|
6
6
|
# We depend on Vagrant for development, but we don't add it as a
|
7
7
|
# gem dependency because we expect to be installed within the
|
8
8
|
# Vagrant environment itself using `vagrant plugin`.
|
9
|
-
gem "vagrant", :git => "
|
9
|
+
gem "vagrant", :git => "https://github.com/mitchellh/vagrant.git"
|
10
|
+
end
|
11
|
+
|
12
|
+
group :plugins do
|
13
|
+
gem "vagrant-brightbox", path: "."
|
10
14
|
end
|
data/README.md
CHANGED
@@ -209,6 +209,26 @@ the remote machine over SSH.
|
|
209
209
|
This is good enough for all built-in Vagrant provisioners (shell,
|
210
210
|
chef, and puppet) to work!
|
211
211
|
|
212
|
+
## Other Examples
|
213
|
+
|
214
|
+
### User data
|
215
|
+
|
216
|
+
You can specify user data for the server being booted.
|
217
|
+
|
218
|
+
```ruby
|
219
|
+
Vagrant.configure("2") do |config|
|
220
|
+
# ... other stuff
|
221
|
+
|
222
|
+
config.vm.provider "brightbox" do |brightbox|
|
223
|
+
# Option 1: a single string
|
224
|
+
brightbox.user_data = "#!/bin/bash\necho 'got user data' > /tmp/user_data.log\necho"
|
225
|
+
|
226
|
+
# Option 2: use a file
|
227
|
+
brightbox.user_data = File.read("user_data.txt")
|
228
|
+
end
|
229
|
+
end
|
230
|
+
```
|
231
|
+
|
212
232
|
## Development
|
213
233
|
|
214
234
|
To work on the `vagrant-brightbox` plugin, clone this repository out, and use
|
data/Rakefile
CHANGED
data/Vagrantfile.example
CHANGED
@@ -8,53 +8,56 @@ module VagrantPlugins
|
|
8
8
|
# Include the built-in modules so we can use them as top-level things.
|
9
9
|
include Vagrant::Action::Builtin
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
def self.action_package
|
12
|
+
Vagrant::Action::Builder.new.tap do |b|
|
13
|
+
b.use Unsupported
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class << self
|
18
|
+
alias action_resume action_package
|
19
|
+
alias action_suspend action_package
|
20
|
+
end
|
21
|
+
|
22
|
+
# This action is called to halt the server - gracefully or by force.
|
23
|
+
def self.action_halt
|
13
24
|
Vagrant::Action::Builder.new.tap do |b|
|
14
25
|
b.use ConfigValidate
|
15
26
|
b.use Call, IsCreated do |env, b2|
|
16
27
|
if env[:result]
|
17
|
-
|
18
|
-
|
19
|
-
|
28
|
+
b2.use Call, GracefulHalt, :inactive, :active do |env2, b3|
|
29
|
+
if !env2[:result]
|
30
|
+
b3.use ConnectBrightbox
|
31
|
+
b3.use ForcedHalt
|
32
|
+
end
|
33
|
+
end
|
34
|
+
else
|
20
35
|
b2.use MessageNotCreated
|
21
36
|
end
|
22
37
|
end
|
23
38
|
end
|
24
39
|
end
|
25
40
|
|
26
|
-
# This action is called to
|
27
|
-
def self.
|
28
|
-
Vagrant::Action::Builder.new.tap do |b|
|
29
|
-
b.use ConfigValidate
|
30
|
-
b.use Call, IsCreated do |env, b2|
|
31
|
-
if env[:result]
|
32
|
-
b2.use Call, GracefulHalt, :inactive, :active do |env2, b3|
|
33
|
-
if !env2[:result]
|
34
|
-
b3.use ConnectBrightbox
|
35
|
-
b3.use ForcedHalt
|
36
|
-
end
|
37
|
-
end
|
38
|
-
else
|
39
|
-
b2.use MessageNotCreated
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
# This action reloads the machine - essentially shutting it down
|
46
|
-
# and bringing it back up again in the new configuration.
|
47
|
-
def self.action_reload
|
41
|
+
# This action is called to destroy the remote machine.
|
42
|
+
def self.action_destroy
|
48
43
|
Vagrant::Action::Builder.new.tap do |b|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
44
|
+
b.use Call, DestroyConfirm do |env, b2|
|
45
|
+
if env[:result]
|
46
|
+
b2.use ConfigValidate
|
47
|
+
b2.use Call, IsCreated do |env2, b3|
|
48
|
+
if env2[:result]
|
49
|
+
b3.use ConnectBrightbox
|
50
|
+
b3.use DeleteServer
|
51
|
+
b3.use ProvisionerCleanup if defined?(ProvisionerCleanup)
|
52
|
+
else
|
53
|
+
b3.use MessageNotCreated
|
54
|
+
end
|
55
|
+
end
|
56
|
+
else
|
57
|
+
b2.use MessageWillNotDestroy
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
58
61
|
end
|
59
62
|
|
60
63
|
# This action is called when `vagrant provision` is called.
|
@@ -63,15 +66,13 @@ module VagrantPlugins
|
|
63
66
|
b.use ConfigValidate
|
64
67
|
b.use Call, IsCreated do |env, b2|
|
65
68
|
if env[:result]
|
66
|
-
|
67
|
-
|
68
|
-
else
|
69
|
+
b2.use Provision
|
70
|
+
else
|
69
71
|
b2.use MessageNotCreated
|
70
72
|
end
|
71
73
|
end
|
72
74
|
end
|
73
75
|
end
|
74
|
-
|
75
76
|
|
76
77
|
# This action is called to read the SSH info of the machine. The
|
77
78
|
# resulting state is expected to be put into the `:machine_ssh_info`
|
@@ -95,13 +96,14 @@ module VagrantPlugins
|
|
95
96
|
end
|
96
97
|
end
|
97
98
|
|
99
|
+
# This action is called to SSH into the machine.
|
98
100
|
def self.action_ssh
|
99
101
|
Vagrant::Action::Builder.new.tap do |b|
|
100
102
|
b.use ConfigValidate
|
101
103
|
b.use Call, IsCreated do |env, b2|
|
102
104
|
if env[:result]
|
103
|
-
|
104
|
-
|
105
|
+
b2.use SSHExec
|
106
|
+
else
|
105
107
|
b2.use MessageNotCreated
|
106
108
|
end
|
107
109
|
end
|
@@ -110,69 +112,92 @@ module VagrantPlugins
|
|
110
112
|
|
111
113
|
def self.action_ssh_run
|
112
114
|
Vagrant::Action::Builder.new.tap do |b|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
115
|
+
b.use ConfigValidate
|
116
|
+
b.use Call, IsCreated do |env, b2|
|
117
|
+
if env[:result]
|
118
|
+
b2.use SSHRun
|
119
|
+
else
|
120
|
+
b2.use MessageNotCreated
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def self.action_prepare_boot
|
127
|
+
Vagrant::Action::Builder.new.tap do |b|
|
128
|
+
b.use Provision
|
129
|
+
b.use SyncedFolders
|
130
|
+
end
|
122
131
|
end
|
123
132
|
|
124
133
|
def self.action_up
|
125
134
|
Vagrant::Action::Builder.new.tap do |b|
|
135
|
+
b.use HandleBox
|
126
136
|
b.use ConfigValidate
|
127
|
-
b.use
|
128
|
-
b.use
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
137
|
+
b.use BoxCheckOutdated
|
138
|
+
b.use ConnectBrightbox
|
139
|
+
b.use Call, IsCreated do |env1, b1|
|
140
|
+
if env1[:result]
|
141
|
+
b1.use Call, IsStopped do |env2, b2|
|
142
|
+
if env2[:result]
|
143
|
+
b2.use action_prepare_boot
|
144
|
+
b2.use StartServer
|
145
|
+
b2.use MapCloudIp
|
146
|
+
else
|
147
|
+
b2.use MessageAlreadyCreated
|
148
|
+
end
|
149
|
+
end
|
150
|
+
else
|
151
|
+
b1.use action_prepare_boot
|
152
|
+
b1.use CreateServer
|
153
|
+
b1.use MapCloudIp
|
143
154
|
end
|
144
155
|
end
|
145
156
|
end
|
146
157
|
end
|
147
158
|
|
148
|
-
|
159
|
+
# This action reloads the machine - essentially shutting it down
|
160
|
+
# and bringing it back up again in the new configuration.
|
161
|
+
def self.action_reload
|
149
162
|
Vagrant::Action::Builder.new.tap do |b|
|
150
|
-
|
151
|
-
|
163
|
+
b.use ConfigValidate
|
164
|
+
b.use ConnectBrightbox
|
165
|
+
b.use Call, IsCreated do |env, b2|
|
166
|
+
if env[:result]
|
167
|
+
b2.use action_halt
|
168
|
+
b2.use Call, WaitForState, :stopped, 120 do |env2, b3|
|
169
|
+
if env2[:result]
|
170
|
+
b3.use action_up
|
171
|
+
else
|
172
|
+
# TODO we couldn't reach :stopped, what now?
|
173
|
+
end
|
174
|
+
end
|
175
|
+
else
|
176
|
+
b2.use MessageNotCreated
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
152
180
|
end
|
153
181
|
|
154
|
-
class << self
|
155
|
-
alias action_resume action_package
|
156
|
-
alias action_suspend action_package
|
157
|
-
end
|
158
182
|
|
159
183
|
# The autoload farm
|
160
184
|
action_root = Pathname.new(File.expand_path("../action", __FILE__))
|
161
185
|
autoload :ConnectBrightbox, action_root.join("connect_brightbox")
|
162
|
-
autoload :CreateServer, action_root.join("create_server")
|
163
|
-
autoload :DeleteServer, action_root.join("delete_server")
|
164
186
|
autoload :IsCreated, action_root.join("is_created")
|
165
|
-
autoload :
|
187
|
+
autoload :IsStopped, action_root.join("is_stopped")
|
166
188
|
autoload :MessageAlreadyCreated, action_root.join("message_already_created")
|
167
189
|
autoload :MessageNotCreated, action_root.join("message_not_created")
|
190
|
+
autoload :MessageWillNotDestroy, action_root.join("message_will_not_destroy")
|
168
191
|
autoload :ReadSSHInfo, action_root.join("read_ssh_info")
|
169
192
|
autoload :ReadState, action_root.join("read_state")
|
170
|
-
autoload :
|
171
|
-
autoload :
|
193
|
+
autoload :CreateServer, action_root.join("create_server")
|
194
|
+
autoload :DeleteServer, action_root.join("delete_server")
|
172
195
|
autoload :ForcedHalt, action_root.join("forced_halt")
|
196
|
+
autoload :MapCloudIp, action_root.join("map_cloud_ip")
|
173
197
|
autoload :StartServer, action_root.join("start_server")
|
174
|
-
autoload :Unsupported, action_root.join("unsupported")
|
175
198
|
autoload :TimedProvision, action_root.join("timed_provision")
|
199
|
+
autoload :Unsupported, action_root.join("unsupported")
|
200
|
+
autoload :WaitForState, action_root.join("wait_for_state")
|
176
201
|
end
|
177
202
|
end
|
178
203
|
end
|
@@ -32,6 +32,15 @@ module VagrantPlugins
|
|
32
32
|
server_groups = region_config.server_groups
|
33
33
|
user_data = region_config.user_data
|
34
34
|
|
35
|
+
zone_id = normalise_id(
|
36
|
+
lambda {env[:brightbox_compute].zones},
|
37
|
+
zone,
|
38
|
+
/^zon-/)
|
39
|
+
server_type_id = normalise_id(
|
40
|
+
lambda {env[:brightbox_compute].flavors},
|
41
|
+
server_type,
|
42
|
+
/^typ-/)
|
43
|
+
|
35
44
|
# Launch!
|
36
45
|
env[:ui].info(I18n.t("vagrant_brightbox.launching_server"))
|
37
46
|
env[:ui].info(I18n.t("vagrant_brightbox.supplied_user_data")) if user_data
|
@@ -41,14 +50,16 @@ module VagrantPlugins
|
|
41
50
|
env[:ui].info(" -- Name: #{server_name}") if server_name
|
42
51
|
env[:ui].info(" -- Zone: #{zone}") if zone
|
43
52
|
env[:ui].info(" -- Server Groups: #{server_groups.inspect}") if !server_groups.empty?
|
53
|
+
@logger.info(" -- Zone ID: #{zone_id}") if zone_id
|
54
|
+
@logger.info(" -- Type ID: #{server_type_id}") if server_type_id
|
44
55
|
|
45
56
|
begin
|
46
57
|
options = {
|
47
58
|
:image_id => image_id,
|
48
59
|
:name => server_name,
|
49
|
-
:flavor_id =>
|
60
|
+
:flavor_id => server_type_id,
|
50
61
|
:user_data => user_data,
|
51
|
-
:zone_id =>
|
62
|
+
:zone_id => zone_id
|
52
63
|
}
|
53
64
|
|
54
65
|
options[:server_groups] = server_groups unless server_groups.empty?
|
@@ -142,6 +153,23 @@ module VagrantPlugins
|
|
142
153
|
destroy_env[:force_confirm_destroy] = true
|
143
154
|
env[:action_runner].run(Action.action_destroy, destroy_env)
|
144
155
|
end
|
156
|
+
|
157
|
+
def normalise_id(collection, element, pattern)
|
158
|
+
@logger.info("Normalising element #{element.inspect}")
|
159
|
+
@logger.info("Against pattern #{pattern.inspect}")
|
160
|
+
case element
|
161
|
+
when pattern, nil
|
162
|
+
element
|
163
|
+
else
|
164
|
+
result = collection.call.find { |f| f.handle == element }
|
165
|
+
if result
|
166
|
+
result.id
|
167
|
+
else
|
168
|
+
element
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
145
173
|
end
|
146
174
|
end
|
147
175
|
end
|
@@ -2,14 +2,14 @@ module VagrantPlugins
|
|
2
2
|
module Brightbox
|
3
3
|
module Action
|
4
4
|
# This can be used with "Call" built-in to check if the machine
|
5
|
-
# is
|
6
|
-
class
|
5
|
+
# is stopped and branch in the middleware.
|
6
|
+
class IsStopped
|
7
7
|
def initialize(app, env)
|
8
8
|
@app = app
|
9
9
|
end
|
10
10
|
|
11
11
|
def call(env)
|
12
|
-
env[:result] = env[:machine].state.id == :
|
12
|
+
env[:result] = env[:machine].state.id == :stopped
|
13
13
|
@app.call(env)
|
14
14
|
end
|
15
15
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Brightbox
|
3
|
+
module Action
|
4
|
+
class MessageWillNotDestroy
|
5
|
+
def initialize(app, env)
|
6
|
+
@app = app
|
7
|
+
end
|
8
|
+
|
9
|
+
def call(env)
|
10
|
+
env[:ui].info(I18n.t("vagrant_brightbox.will_not_destroy", name: env[:machine].name))
|
11
|
+
@app.call(env)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require "log4r"
|
2
|
+
require "timeout"
|
3
|
+
|
4
|
+
module VagrantPlugins
|
5
|
+
module Brightbox
|
6
|
+
module Action
|
7
|
+
# This action will wait for a machine to reach a specific state or quit by timeout
|
8
|
+
class WaitForState
|
9
|
+
# env[:result] will be false in case of timeout.
|
10
|
+
# @param [Symbol] state Target machine state.
|
11
|
+
# @param [Number] timeout Timeout in seconds.
|
12
|
+
def initialize(app, env, state, timeout)
|
13
|
+
@app = app
|
14
|
+
@logger = Log4r::Logger.new("vagrant_brightbox::action::wait_for_state")
|
15
|
+
@state = state
|
16
|
+
@timeout = timeout
|
17
|
+
end
|
18
|
+
|
19
|
+
def call(env)
|
20
|
+
env[:result] = true
|
21
|
+
if env[:machine].state.id == @state
|
22
|
+
@logger.info(I18n.t("vagrant_brightbox.already_status", :status => @state))
|
23
|
+
else
|
24
|
+
@logger.info("Waiting for machine to reach state #{@state}")
|
25
|
+
begin
|
26
|
+
Timeout.timeout(@timeout) do
|
27
|
+
until env[:machine].state.id == @state
|
28
|
+
sleep 2
|
29
|
+
end
|
30
|
+
end
|
31
|
+
rescue Timeout::Error
|
32
|
+
env[:result] = false # couldn't reach state in time
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
@app.call(env)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -12,7 +12,6 @@ module VagrantPlugins
|
|
12
12
|
if message.is_a?(Hash)
|
13
13
|
target = message[:message]
|
14
14
|
if target.respond_to?(:body)
|
15
|
-
puts target.body.inspect
|
16
15
|
decode = Fog::JSON.decode(target.body)
|
17
16
|
if decode["errors"]
|
18
17
|
message[:message] = decode["error_name"]+":\n"+decode["errors"].join("\n")
|
data/locales/en.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
en:
|
2
2
|
vagrant_brightbox:
|
3
|
-
|
4
|
-
The server is already
|
3
|
+
already_status: |-
|
4
|
+
The server is already %{status}.
|
5
5
|
deleting_server: |-
|
6
6
|
Deleting server...
|
7
7
|
finding_image: |-
|
@@ -28,6 +28,9 @@ en:
|
|
28
28
|
Stopping server...
|
29
29
|
unsupported: |-
|
30
30
|
This command is not supported on the Brightbox Provider
|
31
|
+
will_not_destroy: |-
|
32
|
+
The server '%{name}' will not be destroyed, since the confirmation
|
33
|
+
was declined.
|
31
34
|
|
32
35
|
config:
|
33
36
|
region_required: |-
|
data/vagrant-brightbox.gemspec
CHANGED
@@ -6,18 +6,54 @@ require 'vagrant-brightbox/version'
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
7
|
gem.name = "vagrant-brightbox"
|
8
8
|
gem.version = VagrantPlugins::Brightbox::VERSION
|
9
|
+
gem.platform = Gem::Platform::RUBY
|
10
|
+
gem.license = "MIT"
|
9
11
|
gem.authors = ["Mitchell Hashimoto", "Neil Wilson"]
|
10
12
|
gem.email = ["neil@aldur.co.uk"]
|
11
13
|
gem.description = "Enables Vagrant to manage servers in Brightbox Cloud."
|
12
14
|
gem.summary = "Enables Vagrant to manage servers in Brightbox Cloud."
|
13
15
|
|
14
|
-
gem.
|
16
|
+
gem.required_ruby_version = ">= 2.0.0"
|
17
|
+
gem.required_rubygems_version = ">= 1.3.6"
|
18
|
+
|
19
|
+
gem.add_runtime_dependency "fog-brightbox", "~> 0.7"
|
15
20
|
|
16
21
|
gem.add_development_dependency "rake"
|
17
22
|
gem.add_development_dependency "rspec", "~> 2.13.0"
|
18
23
|
|
19
|
-
|
20
|
-
gem.
|
21
|
-
|
22
|
-
|
24
|
+
# The following block of code determines the files that should be included
|
25
|
+
# in the gem. It does this by reading all the files in the directory where
|
26
|
+
# this gemspec is, and parsing out the ignored files from the gitignore.
|
27
|
+
# Note that the entire gitignore(5) syntax is not supported, specifically
|
28
|
+
# the "!" syntax, but it should mostly work correctly.
|
29
|
+
root_path = File.dirname(__FILE__)
|
30
|
+
all_files = Dir.chdir(root_path) { Dir.glob("**/{*,.*}") }
|
31
|
+
all_files.reject! { |file| [".", ".."].include?(File.basename(file)) }
|
32
|
+
gitignore_path = File.join(root_path, ".gitignore")
|
33
|
+
gitignore = File.readlines(gitignore_path)
|
34
|
+
gitignore.map! { |line| line.chomp.strip }
|
35
|
+
gitignore.reject! { |line| line.empty? || line =~ /^(#|!)/ }
|
36
|
+
|
37
|
+
unignored_files = all_files.reject do |file|
|
38
|
+
# Ignore any directories, the gemspec only cares about files
|
39
|
+
next true if File.directory?(file)
|
40
|
+
|
41
|
+
# Ignore any paths that match anything in the gitignore. We do
|
42
|
+
# two tests here:
|
43
|
+
#
|
44
|
+
# - First, test to see if the entire path matches the gitignore.
|
45
|
+
# - Second, match if the basename does, this makes it so that things
|
46
|
+
# like '.DS_Store' will match sub-directories too (same behavior
|
47
|
+
# as git).
|
48
|
+
#
|
49
|
+
gitignore.any? do |ignore|
|
50
|
+
File.fnmatch(ignore, file, File::FNM_PATHNAME) ||
|
51
|
+
File.fnmatch(ignore, File.basename(file), File::FNM_PATHNAME)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
gem.files = unignored_files
|
56
|
+
gem.executables = unignored_files.map { |f| f[/^bin\/(.*)/, 1] }.compact
|
57
|
+
gem.require_path = 'lib'
|
58
|
+
|
23
59
|
end
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-brightbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Mitchell Hashimoto
|
@@ -10,44 +9,39 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2015-07-02 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
|
-
name: fog
|
15
|
+
name: fog-brightbox
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
18
|
- - ~>
|
21
19
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
20
|
+
version: '0.7'
|
23
21
|
type: :runtime
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
25
|
- - ~>
|
29
26
|
- !ruby/object:Gem::Version
|
30
|
-
version:
|
27
|
+
version: '0.7'
|
31
28
|
- !ruby/object:Gem::Dependency
|
32
29
|
name: rake
|
33
30
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
31
|
requirements:
|
36
|
-
- -
|
32
|
+
- - '>='
|
37
33
|
- !ruby/object:Gem::Version
|
38
34
|
version: '0'
|
39
35
|
type: :development
|
40
36
|
prerelease: false
|
41
37
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
38
|
requirements:
|
44
|
-
- -
|
39
|
+
- - '>='
|
45
40
|
- !ruby/object:Gem::Version
|
46
41
|
version: '0'
|
47
42
|
- !ruby/object:Gem::Dependency
|
48
43
|
name: rspec
|
49
44
|
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
45
|
requirements:
|
52
46
|
- - ~>
|
53
47
|
- !ruby/object:Gem::Version
|
@@ -55,7 +49,6 @@ dependencies:
|
|
55
49
|
type: :development
|
56
50
|
prerelease: false
|
57
51
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
52
|
requirements:
|
60
53
|
- - ~>
|
61
54
|
- !ruby/object:Gem::Version
|
@@ -83,16 +76,17 @@ files:
|
|
83
76
|
- lib/vagrant-brightbox/action/delete_server.rb
|
84
77
|
- lib/vagrant-brightbox/action/forced_halt.rb
|
85
78
|
- lib/vagrant-brightbox/action/is_created.rb
|
86
|
-
- lib/vagrant-brightbox/action/
|
79
|
+
- lib/vagrant-brightbox/action/is_stopped.rb
|
87
80
|
- lib/vagrant-brightbox/action/map_cloud_ip.rb
|
88
81
|
- lib/vagrant-brightbox/action/message_already_created.rb
|
89
82
|
- lib/vagrant-brightbox/action/message_not_created.rb
|
83
|
+
- lib/vagrant-brightbox/action/message_will_not_destroy.rb
|
90
84
|
- lib/vagrant-brightbox/action/read_ssh_info.rb
|
91
85
|
- lib/vagrant-brightbox/action/read_state.rb
|
92
86
|
- lib/vagrant-brightbox/action/start_server.rb
|
93
|
-
- lib/vagrant-brightbox/action/sync_folders.rb
|
94
87
|
- lib/vagrant-brightbox/action/timed_provision.rb
|
95
88
|
- lib/vagrant-brightbox/action/unsupported.rb
|
89
|
+
- lib/vagrant-brightbox/action/wait_for_state.rb
|
96
90
|
- lib/vagrant-brightbox/config.rb
|
97
91
|
- lib/vagrant-brightbox/errors.rb
|
98
92
|
- lib/vagrant-brightbox/plugin.rb
|
@@ -103,34 +97,27 @@ files:
|
|
103
97
|
- spec/vagrant-brightbox/config_spec.rb
|
104
98
|
- vagrant-brightbox.gemspec
|
105
99
|
homepage:
|
106
|
-
licenses:
|
100
|
+
licenses:
|
101
|
+
- MIT
|
102
|
+
metadata: {}
|
107
103
|
post_install_message:
|
108
104
|
rdoc_options: []
|
109
105
|
require_paths:
|
110
106
|
- lib
|
111
107
|
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
-
none: false
|
113
108
|
requirements:
|
114
|
-
- -
|
109
|
+
- - '>='
|
115
110
|
- !ruby/object:Gem::Version
|
116
|
-
version:
|
117
|
-
segments:
|
118
|
-
- 0
|
119
|
-
hash: -4267484700850995720
|
111
|
+
version: 2.0.0
|
120
112
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
113
|
requirements:
|
123
|
-
- -
|
114
|
+
- - '>='
|
124
115
|
- !ruby/object:Gem::Version
|
125
|
-
version:
|
126
|
-
segments:
|
127
|
-
- 0
|
128
|
-
hash: -4267484700850995720
|
116
|
+
version: 1.3.6
|
129
117
|
requirements: []
|
130
118
|
rubyforge_project:
|
131
|
-
rubygems_version:
|
119
|
+
rubygems_version: 2.4.8
|
132
120
|
signing_key:
|
133
|
-
specification_version:
|
121
|
+
specification_version: 4
|
134
122
|
summary: Enables Vagrant to manage servers in Brightbox Cloud.
|
135
|
-
test_files:
|
136
|
-
- spec/vagrant-brightbox/config_spec.rb
|
123
|
+
test_files: []
|
@@ -1,66 +0,0 @@
|
|
1
|
-
require "log4r"
|
2
|
-
|
3
|
-
require "vagrant/util/subprocess"
|
4
|
-
|
5
|
-
require "vagrant/util/scoped_hash_override"
|
6
|
-
|
7
|
-
module VagrantPlugins
|
8
|
-
module Brightbox
|
9
|
-
module Action
|
10
|
-
# This middleware uses `rsync` to sync the folders
|
11
|
-
class SyncFolders
|
12
|
-
include Vagrant::Util::ScopedHashOverride
|
13
|
-
|
14
|
-
def initialize(app, env)
|
15
|
-
@app = app
|
16
|
-
@logger = Log4r::Logger.new("vagrant_brightbox::action::sync_folders")
|
17
|
-
end
|
18
|
-
|
19
|
-
def call(env)
|
20
|
-
@app.call(env)
|
21
|
-
|
22
|
-
ssh_info = env[:machine].ssh_info
|
23
|
-
|
24
|
-
env[:machine].config.vm.synced_folders.each do |id, data|
|
25
|
-
data = scoped_hash_override(data, :brightbox)
|
26
|
-
|
27
|
-
# Ignore disabled shared folders
|
28
|
-
next if data[:disabled]
|
29
|
-
|
30
|
-
hostpath = File.expand_path(data[:hostpath], env[:root_path])
|
31
|
-
guestpath = data[:guestpath]
|
32
|
-
|
33
|
-
# Make sure there is a trailing slash on the host path to
|
34
|
-
# avoid creating an additional directory with rsync
|
35
|
-
hostpath = "#{hostpath}/" if hostpath !~ /\/$/
|
36
|
-
|
37
|
-
env[:ui].info(I18n.t("vagrant_brightbox.rsync_folder",
|
38
|
-
:hostpath => hostpath,
|
39
|
-
:guestpath => guestpath))
|
40
|
-
|
41
|
-
# Create the guest path
|
42
|
-
env[:machine].communicate.sudo("mkdir -p '#{guestpath}'")
|
43
|
-
env[:machine].communicate.sudo(
|
44
|
-
"chown #{ssh_info[:username]} '#{guestpath}'")
|
45
|
-
|
46
|
-
# Rsync over to the guest path using the SSH info
|
47
|
-
command = [
|
48
|
-
"rsync", "--verbose", "--archive", "-z",
|
49
|
-
"--exclude", ".vagrant/",
|
50
|
-
"-e", "ssh -p #{ssh_info[:port]} -o StrictHostKeyChecking=no -i '#{ssh_info[:private_key_path]}'",
|
51
|
-
hostpath,
|
52
|
-
"#{ssh_info[:username]}@#{ssh_info[:host]}:#{guestpath}"]
|
53
|
-
|
54
|
-
r = Vagrant::Util::Subprocess.execute(*command)
|
55
|
-
if r.exit_code != 0
|
56
|
-
raise Errors::RsyncError,
|
57
|
-
:guestpath => guestpath,
|
58
|
-
:hostpath => hostpath,
|
59
|
-
:stderr => r.stderr
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|