Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for vagrant share #67

Merged
merged 4 commits into from
Sep 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
## 0.8.0 (unreleased)

* add Vagrant 1.8.5 compatibility and fix TravisCI build (see [#64](https://github.com/tknerr/vagrant-managed-servers/pull/64))
* 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!)
* 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!)
* 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!)
* 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!)
* add support for `vagrant share` command (see [#67](https://github.com/tknerr/vagrant-managed-servers/pull/67), thanks @nigelgbanks!)

## 0.7.1 (released 2015-05-22)

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This is a [Vagrant](http://www.vagrantup.com) 1.6+ plugin that adds a provider f

Since you don't control the lifecycle:
* `up` and `destroy` are re-interpreted as "linking" / "unlinking" vagrant with a managed server
* once "linked", the `ssh` and `provision` commands work as expected and `status` shows the managed server as either "running" or "not reachable"
* once "linked", the `ssh`, `provision` and `share` commands work as expected, and `status` shows the managed server as either "running" or "not reachable"
* `reload` will issue a reboot command on the managed server (cross your fingers ;-))
* `halt`, `suspend` and `resume` are no-ops in this provider

Expand All @@ -18,6 +18,7 @@ Credits: this provider was initially based on the [vagrant-aws](https://github.c
* Provision managed servers with any built-in Vagrant provisioner.
* Reboot a managed server.
* Synced folder support.
* Provide access to a managed server via Vagrant Share.

## Usage

Expand Down
17 changes: 17 additions & 0 deletions lib/vagrant-managed-servers/cap.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module VagrantPlugins
module ManagedServers
module Cap
# Returns guest's IP address that can be used to access the VM from the
# host machine.
#
# @return [String] Guest's IP address
def self.public_address(machine)
return nil if machine.state.id != :running

ssh_info = machine.ssh_info
return nil if !ssh_info
ssh_info[:host]
end
end
end
end
5 changes: 5 additions & 0 deletions lib/vagrant-managed-servers/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ class Plugin < Vagrant.plugin("2")
Provider
end

provider_capability(:managed, :public_address) do
require_relative 'cap'
Cap
end

# This initializes the internationalization strings.
def self.setup_i18n
I18n.load_path << File.expand_path("locales/en.yml", ManagedServers.source_root)
Expand Down