vagrant-managed-servers 0.7.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +8 -2
- data/CHANGELOG.md +13 -2
- data/Gemfile +4 -2
- data/README.md +5 -15
- data/lib/vagrant-managed-servers.rb +0 -1
- data/lib/vagrant-managed-servers/action.rb +4 -10
- data/lib/vagrant-managed-servers/action/warn_winrm_syncedfolders.rb +19 -0
- data/lib/vagrant-managed-servers/cap.rb +17 -0
- data/lib/vagrant-managed-servers/plugin.rb +5 -0
- data/lib/vagrant-managed-servers/version.rb +1 -1
- data/locales/en.yml +4 -0
- data/vagrant-managed-servers.gemspec +0 -1
- metadata +5 -19
- data/lib/vagrant-managed-servers/action/sync_folders.rb +0 -88
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bcb3b23240b46d355b5b2cf1c4ec8c6b8d3835a
|
4
|
+
data.tar.gz: cc618c2e2f2ba4639a9736997b5cddc6a1271ac3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50427cdd98b0afc5f39bb17cedc8d679bb0ebf50e11c8fd28bdbf9e360fd8ecc4f1d18837047d80db4dba2f8b95675b4933945d5e562a927870489b21eae17f6
|
7
|
+
data.tar.gz: 3b332208c37d114be59daa43114201eae97faeaa4b8176109b7b423982d6a52995c1366285f85e869cb8df71d3ce909fd902391b9c14c3371ce9d50d3c3173d0
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,20 @@
|
|
1
1
|
|
2
|
-
#
|
2
|
+
# CHANGELOG
|
3
|
+
|
4
|
+
## 0.8.0 (released 2016-11-04)
|
5
|
+
|
6
|
+
* add Vagrant 1.8.5 compatibility and fix TravisCI build (see [#64](https://github.com/tknerr/vagrant-managed-servers/pull/64))
|
7
|
+
* decouple from [vagrant-winrm-syncedfolders](https://github.com/Cimpress-MCP/vagrant-winrm-syncedfolders), which now needs to be installed separately (see [#65](https://github.com/tknerr/vagrant-managed-servers/pull/65), which reverts [#51](https://github.com/tknerr/vagrant-managed-servers/pull/51) and applies [#50](https://github.com/tknerr/vagrant-managed-servers/pull/50). thanks @chrisbaldauf!)
|
8
|
+
* ensure rsync does not keep stale files by adding the `--del` option (see [#61](https://github.com/tknerr/vagrant-managed-servers/issues/61), thanks @stephencooke!)
|
9
|
+
* add support for `vagrant share` command (see [#67](https://github.com/tknerr/vagrant-managed-servers/pull/67), thanks @nigelgbanks!)
|
10
|
+
* using the vagrant builtin SyncedFolder implementation (see [#68](https://github.com/tknerr/vagrant-managed-servers/pull/68)), which also fixes:
|
11
|
+
* [#17](https://github.com/tknerr/vagrant-managed-servers/pull/17) Reuse Rsync Action from Vagrant Core
|
12
|
+
* [#24](https://github.com/tknerr/vagrant-managed-servers/pull/24) rsync__exclude does not work
|
13
|
+
* [#52](https://github.com/tknerr/vagrant-managed-servers/pull/52) vagrant rsync and vagrant rsync-auto not working
|
3
14
|
|
4
15
|
## 0.7.1 (released 2015-05-22)
|
5
16
|
|
6
|
-
* fix bug where the vagrant-winrm-syncedfolders plugin dependency is not properly loaded (see [#49](https://github.com/tknerr/vagrant-managed-servers/issues/49), thanks @chrisbaldauf for the fix!)
|
17
|
+
* fix bug where the vagrant-winrm-syncedfolders plugin dependency is not properly loaded (see [#49](https://github.com/tknerr/vagrant-managed-servers/issues/49), thanks @chrisbaldauf for the fix!)
|
7
18
|
|
8
19
|
## 0.7.0 (released 2015-05-22)
|
9
20
|
|
data/Gemfile
CHANGED
@@ -1,17 +1,19 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
2
|
|
3
|
+
ruby ">= 2.2.3"
|
4
|
+
|
3
5
|
gemspec
|
4
6
|
|
5
7
|
group :development do
|
6
8
|
# We depend on Vagrant for development, but we don't add it as a
|
7
9
|
# gem dependency because we expect to be installed within the
|
8
10
|
# Vagrant environment itself using `vagrant plugin`.
|
9
|
-
gem "vagrant", git: "https://github.com/mitchellh/vagrant.git", ref: "v1.
|
11
|
+
gem "vagrant", git: "https://github.com/mitchellh/vagrant.git", ref: "v1.8.5"
|
10
12
|
end
|
11
13
|
|
12
14
|
group :plugins do
|
13
15
|
gem "vagrant-managed-servers", path: "."
|
14
16
|
gem "vagrant-omnibus", "1.4.1"
|
15
17
|
gem "vagrant-berkshelf", "4.0.4"
|
16
|
-
gem "vagrant-winrm-syncedfolders"
|
18
|
+
gem "vagrant-winrm-syncedfolders", "0.1.0"
|
17
19
|
end
|
data/README.md
CHANGED
@@ -6,20 +6,19 @@ This is a [Vagrant](http://www.vagrantup.com) 1.6+ plugin that adds a provider f
|
|
6
6
|
|
7
7
|
Since you don't control the lifecycle:
|
8
8
|
* `up` and `destroy` are re-interpreted as "linking" / "unlinking" vagrant with a managed server
|
9
|
-
* once "linked", the `ssh` and `
|
9
|
+
* once "linked", the `ssh`, `provision` and `share` commands work as expected, and `status` shows the managed server as either "running" or "not reachable"
|
10
10
|
* `reload` will issue a reboot command on the managed server (cross your fingers ;-))
|
11
11
|
* `halt`, `suspend` and `resume` are no-ops in this provider
|
12
12
|
|
13
13
|
Credits: this provider was initially based on the [vagrant-aws](https://github.com/mitchellh/vagrant-aws) provider with the AWS-specific functionality stripped out.
|
14
14
|
|
15
|
-
**NOTE:** This plugin requires Vagrant 1.2+
|
16
|
-
|
17
15
|
## Features
|
18
16
|
|
19
17
|
* SSH into managed servers.
|
20
18
|
* Provision managed servers with any built-in Vagrant provisioner.
|
21
19
|
* Reboot a managed server.
|
22
20
|
* Synced folder support.
|
21
|
+
* Provide access to a managed server via Vagrant Share.
|
23
22
|
|
24
23
|
## Usage
|
25
24
|
|
@@ -90,7 +89,7 @@ If you try any of the other VM lifecycle commands like `halt`, `suspend`, `resum
|
|
90
89
|
|
91
90
|
Every provider in Vagrant must introduce a custom box format. This provider introduces a "dummy box" for the `managed` provider which is really nothing more than the required `metadata.json` with the provider name set to "managed".
|
92
91
|
|
93
|
-
|
92
|
+
You can use the [tknerr/managed-server-dummy](https://atlas.hashicorp.com/tknerr/boxes/managed-server-dummy) box like that:
|
94
93
|
```ruby
|
95
94
|
Vagrant.configure("2") do |config|
|
96
95
|
config.vm.box = "tknerr/managed-server-dummy"
|
@@ -98,15 +97,6 @@ Vagrant.configure("2") do |config|
|
|
98
97
|
end
|
99
98
|
```
|
100
99
|
|
101
|
-
For Vagrant < 1.5 you can point to the [dummy.box](https://github.com/tknerr/vagrant-managed-servers/raw/master/dummy.box) URL directly:
|
102
|
-
```ruby
|
103
|
-
Vagrant.configure("2") do |config|
|
104
|
-
config.vm.box = "managed-server-dummy"
|
105
|
-
config.vm.box_url = "https://github.com/tknerr/vagrant-managed-servers/raw/master/dummy.box"
|
106
|
-
...
|
107
|
-
end
|
108
|
-
```
|
109
|
-
|
110
100
|
## Configuration
|
111
101
|
|
112
102
|
This provider currently exposes only a single provider-specific configuration option:
|
@@ -120,7 +110,7 @@ Vagrant.configure("2") do |config|
|
|
120
110
|
# ... other stuff
|
121
111
|
|
122
112
|
config.vm.provider :managed do |managed|
|
123
|
-
managed.server = "
|
113
|
+
managed.server = "myserver.mydomain.com"
|
124
114
|
end
|
125
115
|
end
|
126
116
|
```
|
@@ -164,7 +154,7 @@ end
|
|
164
154
|
```
|
165
155
|
|
166
156
|
### Synced Folders (Windows)
|
167
|
-
Vagrant Managed Servers will try several different mechanisms to sync folders for Windows guests. In order of priority:
|
157
|
+
It is recommended that you install the `vagrant-winrm-syncedfolders` plugin for communicating with Windows guests (`vagrant plugin install vagrant-winrm-syncedfolders`). Once installed, Vagrant Managed Servers will try several different mechanisms to sync folders for Windows guests. In order of priority:
|
168
158
|
|
169
159
|
1. [SMB](http://docs.vagrantup.com/v2/synced-folders/smb.html) - requires running from a Windows host, an Administrative console, and Powershell 3 or greater. Note that there is a known [bug](https://github.com/mitchellh/vagrant/issues/3139) which causes the Powershell version check to hang for Powershell 2
|
170
160
|
2. [WinRM](https://github.com/cimpress-mcp/vagrant-winrm-syncedfolders) - uses the WinRM communicator and is reliable, but can be slow for large numbers of files.
|
@@ -62,15 +62,9 @@ module VagrantPlugins
|
|
62
62
|
end
|
63
63
|
|
64
64
|
b3.use Provision
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
# WinRM uploader for any non-trivial number of files.
|
69
|
-
b3.use Vagrant::Action::Builtin::SyncedFolders
|
70
|
-
else
|
71
|
-
# Vagrant managed servers custom implementation
|
72
|
-
b3.use SyncFolders
|
73
|
-
end
|
65
|
+
b3.use WarnWinRMSyncedFolders
|
66
|
+
b3.use Vagrant::Action::Builtin::SyncedFolderCleanup
|
67
|
+
b3.use Vagrant::Action::Builtin::SyncedFolders
|
74
68
|
end
|
75
69
|
end
|
76
70
|
end
|
@@ -152,11 +146,11 @@ module VagrantPlugins
|
|
152
146
|
autoload :MessageNotLinked, action_root.join("message_not_linked")
|
153
147
|
autoload :MessageAlreadyLinked, action_root.join("message_already_linked")
|
154
148
|
autoload :ReadState, action_root.join("read_state")
|
155
|
-
autoload :SyncFolders, action_root.join("sync_folders")
|
156
149
|
autoload :WarnNetworks, action_root.join("warn_networks")
|
157
150
|
autoload :LinkServer, action_root.join("link_server")
|
158
151
|
autoload :UnlinkServer, action_root.join("unlink_server")
|
159
152
|
autoload :RebootServer, action_root.join("reboot_server")
|
153
|
+
autoload :WarnWinRMSyncedFolders, action_root.join("warn_winrm_syncedfolders")
|
160
154
|
end
|
161
155
|
end
|
162
156
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module ManagedServers
|
3
|
+
module Action
|
4
|
+
class WarnWinRMSyncedFolders
|
5
|
+
def initialize(app, env)
|
6
|
+
@app = app
|
7
|
+
end
|
8
|
+
|
9
|
+
def call(env)
|
10
|
+
if env[:machine].config.vm.communicator == :winrm && !Vagrant.has_plugin?("vagrant-winrm-syncedfolders")
|
11
|
+
env[:ui].warn(I18n.t("vagrant_managed_servers.warn_winrm_syncedfolders"))
|
12
|
+
end
|
13
|
+
|
14
|
+
@app.call(env)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module ManagedServers
|
3
|
+
module Cap
|
4
|
+
# Returns guest's IP address that can be used to access the VM from the
|
5
|
+
# host machine.
|
6
|
+
#
|
7
|
+
# @return [String] Guest's IP address
|
8
|
+
def self.public_address(machine)
|
9
|
+
return nil if machine.state.id != :running
|
10
|
+
|
11
|
+
ssh_info = machine.ssh_info
|
12
|
+
return nil if !ssh_info
|
13
|
+
ssh_info[:host]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -33,6 +33,11 @@ module VagrantPlugins
|
|
33
33
|
Provider
|
34
34
|
end
|
35
35
|
|
36
|
+
provider_capability(:managed, :public_address) do
|
37
|
+
require_relative 'cap'
|
38
|
+
Cap
|
39
|
+
end
|
40
|
+
|
36
41
|
# This initializes the internationalization strings.
|
37
42
|
def self.setup_i18n
|
38
43
|
I18n.load_path << File.expand_path("locales/en.yml", ManagedServers.source_root)
|
data/locales/en.yml
CHANGED
@@ -3,6 +3,10 @@ en:
|
|
3
3
|
warn_networks: |-
|
4
4
|
Warning! The ManagedServers provider doesn't support any of the Vagrant
|
5
5
|
high-level network configurations (`config.vm.network`). They will be ignored.
|
6
|
+
warn_winrm_syncedfolders: |-
|
7
|
+
Warning! The vagrant-winrm-syncedfolders plugin was not found and
|
8
|
+
is recommended for Windows guests. Install it with
|
9
|
+
`vagrant plugin install vagrant-winrm-syncedfolders`.
|
6
10
|
rsync_not_found_warning: |-
|
7
11
|
Warning! Folder sync disabled because the rsync binary is missing.
|
8
12
|
Make sure rsync is installed and the binary can be found in the PATH.
|
@@ -15,7 +15,6 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.required_rubygems_version = ">= 1.3.6"
|
16
16
|
s.rubyforge_project = "vagrant-managed-servers"
|
17
17
|
|
18
|
-
s.add_runtime_dependency "vagrant-winrm-syncedfolders"
|
19
18
|
s.add_development_dependency "rake"
|
20
19
|
s.add_development_dependency "rspec-core", "~> 2.14.7"
|
21
20
|
s.add_development_dependency "rspec-expectations", "~> 2.14.5"
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-managed-servers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Torben Knerr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: vagrant-winrm-syncedfolders
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: rake
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -106,9 +92,10 @@ files:
|
|
106
92
|
- lib/vagrant-managed-servers/action/message_not_reachable.rb
|
107
93
|
- lib/vagrant-managed-servers/action/read_state.rb
|
108
94
|
- lib/vagrant-managed-servers/action/reboot_server.rb
|
109
|
-
- lib/vagrant-managed-servers/action/sync_folders.rb
|
110
95
|
- lib/vagrant-managed-servers/action/unlink_server.rb
|
111
96
|
- lib/vagrant-managed-servers/action/warn_networks.rb
|
97
|
+
- lib/vagrant-managed-servers/action/warn_winrm_syncedfolders.rb
|
98
|
+
- lib/vagrant-managed-servers/cap.rb
|
112
99
|
- lib/vagrant-managed-servers/config.rb
|
113
100
|
- lib/vagrant-managed-servers/errors.rb
|
114
101
|
- lib/vagrant-managed-servers/plugin.rb
|
@@ -138,9 +125,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
125
|
version: 1.3.6
|
139
126
|
requirements: []
|
140
127
|
rubyforge_project: vagrant-managed-servers
|
141
|
-
rubygems_version: 2.4.
|
128
|
+
rubygems_version: 2.4.5.1
|
142
129
|
signing_key:
|
143
130
|
specification_version: 4
|
144
131
|
summary: Enables Vagrant to ssh into and provision managed servers.
|
145
132
|
test_files: []
|
146
|
-
has_rdoc:
|
@@ -1,88 +0,0 @@
|
|
1
|
-
require "log4r"
|
2
|
-
|
3
|
-
require "vagrant/util/subprocess"
|
4
|
-
|
5
|
-
require "vagrant/util/scoped_hash_override"
|
6
|
-
|
7
|
-
require "vagrant/util/which"
|
8
|
-
|
9
|
-
module VagrantPlugins
|
10
|
-
module ManagedServers
|
11
|
-
module Action
|
12
|
-
# This middleware uses `rsync` to sync the folders over to the
|
13
|
-
# AWS instance.
|
14
|
-
class SyncFolders
|
15
|
-
include Vagrant::Util::ScopedHashOverride
|
16
|
-
include Vagrant::Util::Retryable
|
17
|
-
|
18
|
-
def initialize(app, env)
|
19
|
-
@app = app
|
20
|
-
@logger = Log4r::Logger.new("vagrant_managed_servers::action::sync_folders")
|
21
|
-
end
|
22
|
-
|
23
|
-
def call(env)
|
24
|
-
@app.call(env)
|
25
|
-
|
26
|
-
ssh_info = env[:machine].ssh_info
|
27
|
-
|
28
|
-
env[:machine].config.vm.synced_folders.each do |id, data|
|
29
|
-
data = scoped_hash_override(data, :aws)
|
30
|
-
|
31
|
-
# Ignore disabled shared folders
|
32
|
-
next if data[:disabled]
|
33
|
-
|
34
|
-
hostpath = File.expand_path(data[:hostpath], env[:root_path])
|
35
|
-
guestpath = data[:guestpath]
|
36
|
-
|
37
|
-
unless Vagrant::Util::Which.which('rsync')
|
38
|
-
env[:ui].warn(I18n.t('vagrant_managed_servers.rsync_not_found_warning'))
|
39
|
-
break
|
40
|
-
end
|
41
|
-
|
42
|
-
# Make sure there is a trailing slash on the host path to
|
43
|
-
# avoid creating an additional directory with rsync
|
44
|
-
hostpath = "#{hostpath}/" if hostpath !~ /\/$/
|
45
|
-
|
46
|
-
# on windows rsync.exe requires cygdrive-style paths
|
47
|
-
if Vagrant::Util::Platform.windows?
|
48
|
-
hostpath = hostpath.gsub(/^(\w):/) { "/cygdrive/#{$1}" }
|
49
|
-
end
|
50
|
-
|
51
|
-
env[:ui].info(I18n.t("vagrant_managed_servers.rsync_folder",
|
52
|
-
:hostpath => hostpath,
|
53
|
-
:guestpath => guestpath))
|
54
|
-
|
55
|
-
# Create the guest path
|
56
|
-
env[:machine].communicate.sudo("mkdir -p '#{guestpath}'")
|
57
|
-
env[:machine].communicate.sudo(
|
58
|
-
"chown -R '#{ssh_info[:username]}' '#{guestpath}'")
|
59
|
-
|
60
|
-
# Rsync over to the guest path using the SSH info
|
61
|
-
ssh_key_options = Array(ssh_info[:private_key_path]).map { |path| "-i '#{path}' " }.join
|
62
|
-
ssh_proxy_commands = Array(ssh_info[:proxy_command]).map { |command| "-o ProxyCommand='#{command}' "}.join
|
63
|
-
command = [
|
64
|
-
"rsync", "--verbose", "--archive", "-z",
|
65
|
-
"--exclude", ".vagrant/", "--exclude", "Vagrantfile",
|
66
|
-
"-e", "ssh -l '#{ssh_info[:username]}' -p #{ssh_info[:port]} -o StrictHostKeyChecking=no #{ssh_key_options} #{ssh_proxy_commands}",
|
67
|
-
hostpath,
|
68
|
-
"#{ssh_info[:host]}:#{guestpath}"]
|
69
|
-
|
70
|
-
# we need to fix permissions when using rsync.exe on windows, see
|
71
|
-
# http://stackoverflow.com/questions/5798807/rsync-permission-denied-created-directories-have-no-permissions
|
72
|
-
if Vagrant::Util::Platform.windows?
|
73
|
-
command.insert(1, "--chmod", "ugo=rwX")
|
74
|
-
end
|
75
|
-
|
76
|
-
r = Vagrant::Util::Subprocess.execute(*command)
|
77
|
-
if r.exit_code != 0
|
78
|
-
raise Errors::RsyncError,
|
79
|
-
:guestpath => guestpath,
|
80
|
-
:hostpath => hostpath,
|
81
|
-
:stderr => r.stderr
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|