Skip to content

Commit

Permalink
Merge pull request #67 from tknerr/vagrant-share
Browse files Browse the repository at this point in the history
Add support for vagrant share
  • Loading branch information
tknerr authored Sep 15, 2016
2 parents 47429c6 + 735679d commit c68547c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
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

0 comments on commit c68547c

Please sign in to comment.