vagrant-google 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +8 -6
- data/lib/vagrant-google/action.rb +4 -3
- data/lib/vagrant-google/action/sync_folders.rb +104 -0
- data/lib/vagrant-google/version.rb +1 -1
- data/tasks/acceptance.rake +0 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56c269053218677aef26b41cdf092fe60b890fc8
|
4
|
+
data.tar.gz: bd41eebae2f6bd365cae32764d04b2999a9f6dad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a8bbc4a2194f92ccdf15bb7962f87a1d41af8ed94f6bd676b9fe63450ec8845edcc701893732d283df9f5b7f699542a67c7a184395fb77cd043153939c4fa3a
|
7
|
+
data.tar.gz: 6b4c64c595b3789d1f5d4b50c86289d0a18618d02b567d151a90ff230a05577eeeef6d0aa82751ac75dc4118c74c2483e4175f5ff1a0eb69d861fe23532be85e
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -180,8 +180,8 @@ This provider exposes quite a few provider-specific configuration options:
|
|
180
180
|
* `can_ip_forward` - Boolean whether to enable IP Forwarding.
|
181
181
|
* `external_ip` - The external IP address to use (supports names).
|
182
182
|
* `preemptible` - Boolean whether to enable preemptibility. Default is false.
|
183
|
-
* `auto_restart` - Boolean whether to enable auto_restart. Default is true.
|
184
|
-
* `on_host_maintenance` - What to do on host maintenance. Default is "MIGRATE".
|
183
|
+
* `auto_restart` - Boolean whether to enable auto_restart. Default is true.
|
184
|
+
* `on_host_maintenance` - What to do on host maintenance. Default is "MIGRATE".
|
185
185
|
* `service_accounts` or `scopes` - An array of OAuth2 account scopes for
|
186
186
|
services that the instance will have access to. Those can be both full API
|
187
187
|
scopes, just endpoint aliases (the part after `...auth/`), and `gcloud`
|
@@ -252,7 +252,9 @@ There is minimal support for synced folders. Upon `vagrant up`,
|
|
252
252
|
`vagrant reload`, and `vagrant provision`, the Google provider will use
|
253
253
|
`rsync` (if available) to uni-directionally sync the folder to the remote
|
254
254
|
machine over SSH.
|
255
|
-
|
255
|
+
|
256
|
+
This is good enough for all built-in Vagrant provisioners (`shell`, `chef`, and
|
257
|
+
`puppet`) to work!
|
256
258
|
|
257
259
|
## Development
|
258
260
|
|
@@ -308,7 +310,7 @@ $ bundle exec rake acceptance:run
|
|
308
310
|
- Since those are live instances, **you will be billed** for running them.
|
309
311
|
|
310
312
|
## Changelog
|
311
|
-
|
313
|
+
See [CHANGELOG.md](CHANGELOG.md)
|
312
314
|
|
313
|
-
##
|
314
|
-
|
315
|
+
## License
|
316
|
+
Apache 2.0; see [LICENSE](LICENSE) for details.
|
@@ -66,7 +66,7 @@ module VagrantPlugins
|
|
66
66
|
end
|
67
67
|
|
68
68
|
b2.use Provision
|
69
|
-
b2.use
|
69
|
+
b2.use SyncFolders
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
@@ -134,7 +134,7 @@ module VagrantPlugins
|
|
134
134
|
b1.use Call, IsTerminated do |env2, b2|
|
135
135
|
if env2[:result]
|
136
136
|
b2.use Provision
|
137
|
-
b2.use
|
137
|
+
b2.use SyncFolders
|
138
138
|
b2.use WarnNetworks
|
139
139
|
b2.use StartInstance
|
140
140
|
else
|
@@ -144,7 +144,7 @@ module VagrantPlugins
|
|
144
144
|
end
|
145
145
|
else
|
146
146
|
b1.use Provision
|
147
|
-
b1.use
|
147
|
+
b1.use SyncFolders
|
148
148
|
b1.use WarnNetworks
|
149
149
|
b1.use RunInstance
|
150
150
|
end
|
@@ -182,6 +182,7 @@ module VagrantPlugins
|
|
182
182
|
autoload :RunInstance, action_root.join("run_instance")
|
183
183
|
autoload :StartInstance, action_root.join("start_instance")
|
184
184
|
autoload :StopInstance, action_root.join("stop_instance")
|
185
|
+
autoload :SyncFolders, action_root.join("sync_folders")
|
185
186
|
autoload :TerminateInstance, action_root.join("terminate_instance")
|
186
187
|
autoload :TimedProvision, action_root.join("timed_provision")
|
187
188
|
autoload :WarnNetworks, action_root.join("warn_networks")
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# Copyright 2013 Google Inc. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
require "log4r"
|
15
|
+
require "vagrant/util/subprocess"
|
16
|
+
require "vagrant/util/scoped_hash_override"
|
17
|
+
require "vagrant/util/which"
|
18
|
+
|
19
|
+
module VagrantPlugins
|
20
|
+
module Google
|
21
|
+
module Action
|
22
|
+
# This middleware uses `rsync` to sync the folders over to the
|
23
|
+
# Google instance.
|
24
|
+
class SyncFolders
|
25
|
+
include Vagrant::Util::ScopedHashOverride
|
26
|
+
|
27
|
+
def initialize(app, env)
|
28
|
+
@app = app
|
29
|
+
@logger = Log4r::Logger.new("vagrant_google::action::sync_folders")
|
30
|
+
end
|
31
|
+
|
32
|
+
def call(env)
|
33
|
+
@app.call(env)
|
34
|
+
|
35
|
+
ssh_info = env[:machine].ssh_info
|
36
|
+
|
37
|
+
env[:machine].config.vm.synced_folders.each do |id, data|
|
38
|
+
data = scoped_hash_override(data, :google)
|
39
|
+
|
40
|
+
# Ignore disabled shared folders
|
41
|
+
next if data[:disabled]
|
42
|
+
|
43
|
+
unless Vagrant::Util::Which.which('rsync')
|
44
|
+
env[:ui].warn(I18n.t('vagrant_aws.rsync_not_found_warning'))
|
45
|
+
break
|
46
|
+
end
|
47
|
+
|
48
|
+
hostpath = File.expand_path(data[:hostpath], env[:root_path])
|
49
|
+
guestpath = data[:guestpath]
|
50
|
+
|
51
|
+
# Make sure there is a trailing slash on the host path to
|
52
|
+
# avoid creating an additional directory with rsync
|
53
|
+
hostpath = "#{hostpath}/" if hostpath !~ /\/$/
|
54
|
+
|
55
|
+
# on windows rsync.exe requires cygdrive-style paths
|
56
|
+
if Vagrant::Util::Platform.windows?
|
57
|
+
hostpath = hostpath.gsub(/^(\w):/) { "/cygdrive/#{$1}" }
|
58
|
+
end
|
59
|
+
|
60
|
+
env[:ui].info(I18n.t("vagrant_google.rsync_folder",
|
61
|
+
:hostpath => hostpath,
|
62
|
+
:guestpath => guestpath))
|
63
|
+
|
64
|
+
# Create the guest path
|
65
|
+
env[:machine].communicate.sudo("mkdir -p '#{guestpath}'")
|
66
|
+
env[:machine].communicate.sudo(
|
67
|
+
"chown #{ssh_info[:username]} '#{guestpath}'")
|
68
|
+
|
69
|
+
# patch from https://github.com/tmatilai/vagrant-aws/commit/4a043a96076c332220ec4ec19470c4af5597dd51
|
70
|
+
def ssh_key_options(ssh_info)
|
71
|
+
# Ensure that `private_key_path` is an Array (for Vagrant < 1.4)
|
72
|
+
Array(ssh_info[:private_key_path]).map { |path| "-i '#{path}' " }.join
|
73
|
+
end
|
74
|
+
|
75
|
+
#collect rsync excludes specified :rsync__excludes=>['path1',...] in synced_folder options
|
76
|
+
excludes = ['.vagrant/', *Array(data[:rsync__excludes])]
|
77
|
+
|
78
|
+
# Rsync over to the guest path using the SSH info
|
79
|
+
command = [
|
80
|
+
"rsync", "--verbose", "--archive", "-z",
|
81
|
+
*excludes.map{|e| ['--exclude', e]}.flatten,
|
82
|
+
"-e", "ssh -p #{ssh_info[:port]} -o StrictHostKeyChecking=no #{ssh_key_options(ssh_info)}",
|
83
|
+
hostpath,
|
84
|
+
"#{ssh_info[:username]}@#{ssh_info[:host]}:#{guestpath}"]
|
85
|
+
|
86
|
+
# we need to fix permissions when using rsync.exe on windows, see
|
87
|
+
# http://stackoverflow.com/questions/5798807/rsync-permission-denied-created-directories-have-no-permissions
|
88
|
+
if Vagrant::Util::Platform.windows?
|
89
|
+
command.insert(1, "--chmod", "ugo=rwX")
|
90
|
+
end
|
91
|
+
|
92
|
+
r = Vagrant::Util::Subprocess.execute(*command)
|
93
|
+
if r.exit_code != 0
|
94
|
+
raise Errors::RsyncError,
|
95
|
+
:guestpath => guestpath,
|
96
|
+
:hostpath => hostpath,
|
97
|
+
:stderr => r.stderr
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
data/tasks/acceptance.rake
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-google
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Johnson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-07-
|
12
|
+
date: 2015-07-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fog-google
|
@@ -87,8 +87,10 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
+
- CHANGELOG.md
|
90
91
|
- Gemfile
|
91
92
|
- LICENSE
|
93
|
+
- README.md
|
92
94
|
- Rakefile
|
93
95
|
- example_boxes/README.md
|
94
96
|
- example_boxes/gce-test/Vagrantfile
|
@@ -110,6 +112,7 @@ files:
|
|
110
112
|
- lib/vagrant-google/action/run_instance.rb
|
111
113
|
- lib/vagrant-google/action/start_instance.rb
|
112
114
|
- lib/vagrant-google/action/stop_instance.rb
|
115
|
+
- lib/vagrant-google/action/sync_folders.rb
|
113
116
|
- lib/vagrant-google/action/terminate_instance.rb
|
114
117
|
- lib/vagrant-google/action/timed_provision.rb
|
115
118
|
- lib/vagrant-google/action/warn_networks.rb
|
@@ -140,8 +143,6 @@ files:
|
|
140
143
|
- vagrantfile_examples/Vagrantfile.provision_single
|
141
144
|
- vagrantfile_examples/Vagrantfile.simple
|
142
145
|
- vagrantfile_examples/Vagrantfile.zone_config
|
143
|
-
- CHANGELOG.md
|
144
|
-
- README.md
|
145
146
|
- .gitignore
|
146
147
|
- .rubocop.yml
|
147
148
|
- .rubocop_todo.yml
|