vagrant-managed-servers 0.4.1 → 0.5.0
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 +14 -1
- data/Rakefile +1 -0
- data/Vagrantfile +38 -37
- data/lib/vagrant-managed-servers/action/reboot_server.rb +71 -0
- data/lib/vagrant-managed-servers/action.rb +124 -118
- data/lib/vagrant-managed-servers/plugin.rb +77 -72
- data/lib/vagrant-managed-servers/version.rb +1 -1
- data/locales/en.yml +46 -42
- metadata +13 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef79dda1ac0ab0b9f493d3b8355ba75319d77371
|
4
|
+
data.tar.gz: 06602d43f9ffd6fbc07803106075918405c6c386
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 780884c3ce763012c705821edbfbeb6cb00b0c4367edae2a2dbfcdd4a48b70ee741b0a5a18f7015f2b5433ce91c248daf8edb366d999ce5f0135583f5707039a
|
7
|
+
data.tar.gz: 27f25a107778e394349c45c83c1c353724992251d85c6ada790655fea2fbdf8fcb42b1b39ac40ffd4c6482ed82c128e99e892a3ee4de38a5b6a875d28b0c2e82
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
|
2
2
|
# Changelog
|
3
3
|
|
4
|
+
## 0.5.0 (released 2015-02-08)
|
5
|
+
|
6
|
+
* add `reload` functionality ([#31](https://github.com/tknerr/vagrant-managed-servers/pull/31), thanks @jdaviscooke!)
|
7
|
+
|
4
8
|
## 0.4.1 (released 2014-11-17)
|
5
9
|
|
6
10
|
* fix missing parameters in translation for winrm ([#30](https://github.com/tknerr/vagrant-managed-servers/pull/30), thanks @chrisbaldauf!)
|
data/README.md
CHANGED
@@ -7,7 +7,8 @@ This is a [Vagrant](http://www.vagrantup.com) 1.2+ plugin that adds a provider f
|
|
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
9
|
* once "linked", the `ssh` and `provision` 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
|
+
* `halt`, `suspend` and `resume` are no-ops in this provider
|
11
12
|
|
12
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.
|
13
14
|
|
@@ -17,6 +18,7 @@ Credits: this provider was initially based on the [vagrant-aws](https://github.c
|
|
17
18
|
|
18
19
|
* SSH into managed servers.
|
19
20
|
* Provision managed servers with any built-in Vagrant provisioner.
|
21
|
+
* Reboot a managed server.
|
20
22
|
* Minimal synced folder support via `rsync`.
|
21
23
|
|
22
24
|
## Usage
|
@@ -64,6 +66,17 @@ $ vagrant ssh
|
|
64
66
|
...
|
65
67
|
```
|
66
68
|
|
69
|
+
In some cases you might need to reboot the managed server via `vagrant reload`:
|
70
|
+
```
|
71
|
+
$ vagrant reload
|
72
|
+
==> default: Rebooting managed server foo.acme.com
|
73
|
+
==> default: -- Server: foo.acme.com
|
74
|
+
==> default: Waiting for foo.acme.com to reboot
|
75
|
+
==> default: Waiting for foo.acme.com to reboot
|
76
|
+
==> default: Waiting for foo.acme.com to reboot
|
77
|
+
==> default: foo.acme.com rebooted and ready.
|
78
|
+
```
|
79
|
+
|
67
80
|
If you are done, you can "unlink" vagrant from the managed server by running `vagrant destroy`:
|
68
81
|
```
|
69
82
|
$ vagrant destroy -f
|
data/Rakefile
CHANGED
data/Vagrantfile
CHANGED
@@ -1,37 +1,38 @@
|
|
1
|
-
# -*- mode: ruby -*-
|
2
|
-
# vi: set ft=ruby :
|
3
|
-
|
4
|
-
Vagrant.configure("2") do |config|
|
5
|
-
|
6
|
-
#
|
7
|
-
# fake a managed server by bringing up a virtualbox vm
|
8
|
-
#
|
9
|
-
config.vm.define :fake_managed_server do |fms_config|
|
10
|
-
fms_config.vm.box = "chef/ubuntu-12.04-i386"
|
11
|
-
fms_config.vm.network :private_network, ip: "192.168.40.35"
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
#
|
16
|
-
#
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
ms_config.
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
override.ssh.
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
chef.
|
33
|
-
chef.add_recipe "
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
Vagrant.configure("2") do |config|
|
5
|
+
|
6
|
+
#
|
7
|
+
# fake a managed server by bringing up a virtualbox vm
|
8
|
+
#
|
9
|
+
config.vm.define :fake_managed_server do |fms_config|
|
10
|
+
fms_config.vm.box = "chef/ubuntu-12.04-i386"
|
11
|
+
fms_config.vm.network :private_network, ip: "192.168.40.35"
|
12
|
+
fms_config.berkshelf.enabled = false
|
13
|
+
end
|
14
|
+
|
15
|
+
#
|
16
|
+
# configure managed provider to connect to `fake_managed_server`
|
17
|
+
#
|
18
|
+
config.vm.define :my_server do |ms_config|
|
19
|
+
|
20
|
+
ms_config.vm.box = "tknerr/managed-server-dummy"
|
21
|
+
|
22
|
+
ms_config.omnibus.chef_version = "12.0.3"
|
23
|
+
ms_config.berkshelf.enabled = true
|
24
|
+
|
25
|
+
ms_config.vm.provider :managed do |managed_config, override|
|
26
|
+
managed_config.server = "192.168.40.35"
|
27
|
+
override.ssh.username = "vagrant"
|
28
|
+
override.ssh.private_key_path = ".vagrant/machines/fake_managed_server/virtualbox/private_key"
|
29
|
+
end
|
30
|
+
|
31
|
+
ms_config.vm.provision :chef_solo do |chef|
|
32
|
+
chef.cookbooks_path = [ './cookbooks' ]
|
33
|
+
chef.add_recipe "apt"
|
34
|
+
chef.add_recipe "apache2"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require "log4r"
|
2
|
+
require "timeout"
|
3
|
+
|
4
|
+
module VagrantPlugins
|
5
|
+
module ManagedServers
|
6
|
+
module Action
|
7
|
+
# reboot the managed server
|
8
|
+
class RebootServer
|
9
|
+
|
10
|
+
def initialize(app, env)
|
11
|
+
@app = app
|
12
|
+
@logger = Log4r::Logger.new("vagrant_managed_servers::action::reboot_server")
|
13
|
+
end
|
14
|
+
|
15
|
+
def call(env)
|
16
|
+
server = env[:machine].id
|
17
|
+
|
18
|
+
boot_timeout = env[:machine].config.vm.boot_timeout ## This is user configurable, defaults to 300 seconds
|
19
|
+
|
20
|
+
# "Reboot"
|
21
|
+
env[:ui].info(I18n.t("vagrant_managed_servers.rebooting_server", :host => server))
|
22
|
+
env[:ui].info(" -- Server: #{server}")
|
23
|
+
send_reboot(env[:machine])
|
24
|
+
# We don't want to spin endlessly waiting for the machine to come back.
|
25
|
+
# Wait for the config.vm.boot_timeout amount of time.
|
26
|
+
begin
|
27
|
+
Timeout::timeout(boot_timeout) {
|
28
|
+
# keep track of if the server has gone unreachable
|
29
|
+
machine_up = true
|
30
|
+
while machine_up
|
31
|
+
begin
|
32
|
+
# communicate.ready? takes a long time to return false (the indication that the machine has gone down for reboot)
|
33
|
+
# and this was causing the loop to never register that the machine had gone down. So if it has taken a long time to
|
34
|
+
# return, we assume that the machine has indeed gone down.
|
35
|
+
status = Timeout::timeout(5) { machine_up = env[:machine].communicate.ready? }
|
36
|
+
rescue Exception => err
|
37
|
+
# The Timeout::Error is getting swallowed somewhere. If err is execution expired, then the timeout was hit.
|
38
|
+
# Otherwise re-raise err
|
39
|
+
raise err unless err.message == "execution expired"
|
40
|
+
# Machine is down. Wait for it to come back up!
|
41
|
+
env[:ui].info(I18n.t("vagrant_managed_servers.waiting_for_server", :host => server))
|
42
|
+
until env[:machine].communicate.ready?
|
43
|
+
sleep 1
|
44
|
+
end
|
45
|
+
machine_up = false
|
46
|
+
end
|
47
|
+
sleep 1
|
48
|
+
env[:ui].info(I18n.t("vagrant_managed_servers.waiting_for_server", :host => server))
|
49
|
+
end
|
50
|
+
env[:ui].info(" #{server} rebooted and ready.")
|
51
|
+
@app.call(env)
|
52
|
+
}
|
53
|
+
rescue Exception => err
|
54
|
+
raise err unless err.message == "execution expired"
|
55
|
+
env[:ui].error("Timed out waiting for machine to reboot!")
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def send_reboot(machine)
|
60
|
+
if (machine.config.vm.communicator == :winrm)
|
61
|
+
machine.communicate.sudo("shutdown -f -r -t 0")
|
62
|
+
else
|
63
|
+
machine.communicate.sudo("reboot")
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -1,118 +1,124 @@
|
|
1
|
-
require "pathname"
|
2
|
-
|
3
|
-
require "vagrant/action/builder"
|
4
|
-
|
5
|
-
module VagrantPlugins
|
6
|
-
module ManagedServers
|
7
|
-
module Action
|
8
|
-
# Include the built-in modules so we can use them as top-level things.
|
9
|
-
include Vagrant::Action::Builtin
|
10
|
-
|
11
|
-
# This action is called to establish linkage between vagrant and the managed server
|
12
|
-
def self.action_up
|
13
|
-
Vagrant::Action::Builder.new.tap do |b|
|
14
|
-
if Vagrant::VERSION < '1.5.0'
|
15
|
-
b.use HandleBoxUrl
|
16
|
-
else
|
17
|
-
b.use HandleBox
|
18
|
-
end
|
19
|
-
b.use ConfigValidate
|
20
|
-
b.use WarnNetworks
|
21
|
-
b.use LinkServer
|
22
|
-
=begin
|
23
|
-
b.use HandleBoxUrl
|
24
|
-
b.use ConfigValidate
|
25
|
-
b.use Call, IsReachable do |env, b2|
|
26
|
-
if env[:result]
|
27
|
-
b2.use !MessageNotReachable
|
28
|
-
next
|
29
|
-
end
|
30
|
-
|
31
|
-
b2.use Provision
|
32
|
-
b2.use SyncFolders
|
33
|
-
b2.use WarnNetworks
|
34
|
-
b2.use LinkServer
|
35
|
-
end
|
36
|
-
=end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
# This action is called to "unlink" vagrant from the managed server
|
41
|
-
def self.action_destroy
|
42
|
-
Vagrant::Action::Builder.new.tap do |b|
|
43
|
-
b.use ConfigValidate
|
44
|
-
b.use UnlinkServer
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
# This action is called when `vagrant provision` is called.
|
49
|
-
def self.action_provision
|
50
|
-
Vagrant::Action::Builder.new.tap do |b|
|
51
|
-
b.use ConfigValidate
|
52
|
-
b.use WarnNetworks
|
53
|
-
b.use Call, IsReachable do |env, b2|
|
54
|
-
if !env[:result]
|
55
|
-
b2.use MessageNotReachable
|
56
|
-
next
|
57
|
-
end
|
58
|
-
|
59
|
-
b2.use Provision
|
60
|
-
b2.use SyncFolders
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
# This action is called to read the state of the machine. The
|
66
|
-
# resulting state is expected to be put into the `:machine_state_id`
|
67
|
-
# key.
|
68
|
-
def self.action_read_state
|
69
|
-
Vagrant::Action::Builder.new.tap do |b|
|
70
|
-
b.use ConfigValidate
|
71
|
-
b.use ReadState
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
# This action is called to SSH into the machine.
|
76
|
-
def self.action_ssh
|
77
|
-
Vagrant::Action::Builder.new.tap do |b|
|
78
|
-
b.use ConfigValidate
|
79
|
-
b.use WarnNetworks
|
80
|
-
b.use Call, IsReachable do |env, b2|
|
81
|
-
if !env[:result]
|
82
|
-
b2.use MessageNotReachable
|
83
|
-
next
|
84
|
-
end
|
85
|
-
|
86
|
-
b2.use SSHExec
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
def self.action_ssh_run
|
92
|
-
Vagrant::Action::Builder.new.tap do |b|
|
93
|
-
b.use ConfigValidate
|
94
|
-
b.use WarnNetworks
|
95
|
-
b.use Call, IsReachable do |env, b2|
|
96
|
-
if !env[:result]
|
97
|
-
b2.use MessageNotReachable
|
98
|
-
next
|
99
|
-
end
|
100
|
-
|
101
|
-
b2.use SSHRun
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
autoload
|
113
|
-
|
114
|
-
autoload :
|
115
|
-
autoload :
|
116
|
-
|
117
|
-
|
118
|
-
|
1
|
+
require "pathname"
|
2
|
+
|
3
|
+
require "vagrant/action/builder"
|
4
|
+
|
5
|
+
module VagrantPlugins
|
6
|
+
module ManagedServers
|
7
|
+
module Action
|
8
|
+
# Include the built-in modules so we can use them as top-level things.
|
9
|
+
include Vagrant::Action::Builtin
|
10
|
+
|
11
|
+
# This action is called to establish linkage between vagrant and the managed server
|
12
|
+
def self.action_up
|
13
|
+
Vagrant::Action::Builder.new.tap do |b|
|
14
|
+
if Vagrant::VERSION < '1.5.0'
|
15
|
+
b.use HandleBoxUrl
|
16
|
+
else
|
17
|
+
b.use HandleBox
|
18
|
+
end
|
19
|
+
b.use ConfigValidate
|
20
|
+
b.use WarnNetworks
|
21
|
+
b.use LinkServer
|
22
|
+
=begin
|
23
|
+
b.use HandleBoxUrl
|
24
|
+
b.use ConfigValidate
|
25
|
+
b.use Call, IsReachable do |env, b2|
|
26
|
+
if env[:result]
|
27
|
+
b2.use !MessageNotReachable
|
28
|
+
next
|
29
|
+
end
|
30
|
+
|
31
|
+
b2.use Provision
|
32
|
+
b2.use SyncFolders
|
33
|
+
b2.use WarnNetworks
|
34
|
+
b2.use LinkServer
|
35
|
+
end
|
36
|
+
=end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# This action is called to "unlink" vagrant from the managed server
|
41
|
+
def self.action_destroy
|
42
|
+
Vagrant::Action::Builder.new.tap do |b|
|
43
|
+
b.use ConfigValidate
|
44
|
+
b.use UnlinkServer
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# This action is called when `vagrant provision` is called.
|
49
|
+
def self.action_provision
|
50
|
+
Vagrant::Action::Builder.new.tap do |b|
|
51
|
+
b.use ConfigValidate
|
52
|
+
b.use WarnNetworks
|
53
|
+
b.use Call, IsReachable do |env, b2|
|
54
|
+
if !env[:result]
|
55
|
+
b2.use MessageNotReachable
|
56
|
+
next
|
57
|
+
end
|
58
|
+
|
59
|
+
b2.use Provision
|
60
|
+
b2.use SyncFolders
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# This action is called to read the state of the machine. The
|
66
|
+
# resulting state is expected to be put into the `:machine_state_id`
|
67
|
+
# key.
|
68
|
+
def self.action_read_state
|
69
|
+
Vagrant::Action::Builder.new.tap do |b|
|
70
|
+
b.use ConfigValidate
|
71
|
+
b.use ReadState
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# This action is called to SSH into the machine.
|
76
|
+
def self.action_ssh
|
77
|
+
Vagrant::Action::Builder.new.tap do |b|
|
78
|
+
b.use ConfigValidate
|
79
|
+
b.use WarnNetworks
|
80
|
+
b.use Call, IsReachable do |env, b2|
|
81
|
+
if !env[:result]
|
82
|
+
b2.use MessageNotReachable
|
83
|
+
next
|
84
|
+
end
|
85
|
+
|
86
|
+
b2.use SSHExec
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def self.action_ssh_run
|
92
|
+
Vagrant::Action::Builder.new.tap do |b|
|
93
|
+
b.use ConfigValidate
|
94
|
+
b.use WarnNetworks
|
95
|
+
b.use Call, IsReachable do |env, b2|
|
96
|
+
if !env[:result]
|
97
|
+
b2.use MessageNotReachable
|
98
|
+
next
|
99
|
+
end
|
100
|
+
|
101
|
+
b2.use SSHRun
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def self.action_reload
|
107
|
+
Vagrant::Action::Builder.new.tap do |b|
|
108
|
+
b.use RebootServer
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
# The autoload farm
|
113
|
+
action_root = Pathname.new(File.expand_path("../action", __FILE__))
|
114
|
+
autoload :IsReachable, action_root.join("is_reachable")
|
115
|
+
autoload :MessageNotReachable, action_root.join("message_not_reachable")
|
116
|
+
autoload :ReadState, action_root.join("read_state")
|
117
|
+
autoload :SyncFolders, action_root.join("sync_folders")
|
118
|
+
autoload :WarnNetworks, action_root.join("warn_networks")
|
119
|
+
autoload :LinkServer, action_root.join("link_server")
|
120
|
+
autoload :UnlinkServer, action_root.join("unlink_server")
|
121
|
+
autoload :RebootServer, action_root.join("reboot_server")
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
@@ -1,72 +1,77 @@
|
|
1
|
-
begin
|
2
|
-
require "vagrant"
|
3
|
-
rescue LoadError
|
4
|
-
raise "The Vagrant ManagedServers plugin must be run within Vagrant."
|
5
|
-
end
|
6
|
-
|
7
|
-
# This is a sanity check to make sure no one is attempting to install
|
8
|
-
# this into an early Vagrant version.
|
9
|
-
if Vagrant::VERSION < "1.2.0"
|
10
|
-
raise "The Vagrant ManagedServers plugin is only compatible with Vagrant 1.2+"
|
11
|
-
end
|
12
|
-
|
13
|
-
module VagrantPlugins
|
14
|
-
module ManagedServers
|
15
|
-
class Plugin < Vagrant.plugin("2")
|
16
|
-
name "ManagedServers"
|
17
|
-
description <<-DESC
|
18
|
-
This plugin installs a provider that allows Vagrant to interact with managed servers.
|
19
|
-
DESC
|
20
|
-
|
21
|
-
config(:managed, :provider) do
|
22
|
-
require_relative "config"
|
23
|
-
Config
|
24
|
-
end
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
level =
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
#
|
62
|
-
#
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
1
|
+
begin
|
2
|
+
require "vagrant"
|
3
|
+
rescue LoadError
|
4
|
+
raise "The Vagrant ManagedServers plugin must be run within Vagrant."
|
5
|
+
end
|
6
|
+
|
7
|
+
# This is a sanity check to make sure no one is attempting to install
|
8
|
+
# this into an early Vagrant version.
|
9
|
+
if Vagrant::VERSION < "1.2.0"
|
10
|
+
raise "The Vagrant ManagedServers plugin is only compatible with Vagrant 1.2+"
|
11
|
+
end
|
12
|
+
|
13
|
+
module VagrantPlugins
|
14
|
+
module ManagedServers
|
15
|
+
class Plugin < Vagrant.plugin("2")
|
16
|
+
name "ManagedServers"
|
17
|
+
description <<-DESC
|
18
|
+
This plugin installs a provider that allows Vagrant to interact with managed servers.
|
19
|
+
DESC
|
20
|
+
|
21
|
+
config(:managed, :provider) do
|
22
|
+
require_relative "config"
|
23
|
+
Config
|
24
|
+
end
|
25
|
+
|
26
|
+
command(:reboot) do
|
27
|
+
require_relative "command/reboot"
|
28
|
+
Command::Reboot
|
29
|
+
end
|
30
|
+
|
31
|
+
provider(:managed, parallel: true) do
|
32
|
+
# Setup logging and i18n
|
33
|
+
setup_logging
|
34
|
+
setup_i18n
|
35
|
+
|
36
|
+
# Return the provider
|
37
|
+
require_relative "provider"
|
38
|
+
Provider
|
39
|
+
end
|
40
|
+
|
41
|
+
# This initializes the internationalization strings.
|
42
|
+
def self.setup_i18n
|
43
|
+
I18n.load_path << File.expand_path("locales/en.yml", ManagedServers.source_root)
|
44
|
+
I18n.reload!
|
45
|
+
end
|
46
|
+
|
47
|
+
# This sets up our log level to be whatever VAGRANT_LOG is.
|
48
|
+
def self.setup_logging
|
49
|
+
require "log4r"
|
50
|
+
|
51
|
+
level = nil
|
52
|
+
begin
|
53
|
+
level = Log4r.const_get(ENV["VAGRANT_LOG"].upcase)
|
54
|
+
rescue NameError
|
55
|
+
# This means that the logging constant wasn't found,
|
56
|
+
# which is fine. We just keep `level` as `nil`. But
|
57
|
+
# we tell the user.
|
58
|
+
level = nil
|
59
|
+
end
|
60
|
+
|
61
|
+
# Some constants, such as "true" resolve to booleans, so the
|
62
|
+
# above error checking doesn't catch it. This will check to make
|
63
|
+
# sure that the log level is an integer, as Log4r requires.
|
64
|
+
level = nil if !level.is_a?(Integer)
|
65
|
+
|
66
|
+
# Set the logging level on all "vagrant" namespaced
|
67
|
+
# logs as long as we have a valid level.
|
68
|
+
if level
|
69
|
+
logger = Log4r::Logger.new("vagrant_managed_servers")
|
70
|
+
logger.outputters = Log4r::Outputter.stderr
|
71
|
+
logger.level = level
|
72
|
+
logger = nil
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
data/locales/en.yml
CHANGED
@@ -1,42 +1,46 @@
|
|
1
|
-
en:
|
2
|
-
vagrant_managed_servers:
|
3
|
-
host_not_reachable: |-
|
4
|
-
The host specified in `config.managed.server` is not reachable.
|
5
|
-
warn_networks: |-
|
6
|
-
Warning! The ManagedServers provider doesn't support any of the Vagrant
|
7
|
-
high-level network configurations (`config.vm.network`). They
|
8
|
-
will be silently ignored.
|
9
|
-
rsync_not_found_warning: |-
|
10
|
-
Warning! Folder sync disabled because the rsync binary is missing.
|
11
|
-
Make sure rsync is installed and the binary can be found in the PATH.
|
12
|
-
rsync_folder: |-
|
13
|
-
Rsyncing folder: %{hostpath} => %{guestpath}
|
14
|
-
winrm_upload: |-
|
15
|
-
Uploading with WinRM: %{hostpath} => %{guestpath}
|
16
|
-
linking_server: |-
|
17
|
-
Linking vagrant with managed server %{host}
|
18
|
-
unlinking_server: |-
|
19
|
-
Unlinking vagrant from managed server %{host}
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
The managed server is
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
The
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
1
|
+
en:
|
2
|
+
vagrant_managed_servers:
|
3
|
+
host_not_reachable: |-
|
4
|
+
The host specified in `config.managed.server` is not reachable.
|
5
|
+
warn_networks: |-
|
6
|
+
Warning! The ManagedServers provider doesn't support any of the Vagrant
|
7
|
+
high-level network configurations (`config.vm.network`). They
|
8
|
+
will be silently ignored.
|
9
|
+
rsync_not_found_warning: |-
|
10
|
+
Warning! Folder sync disabled because the rsync binary is missing.
|
11
|
+
Make sure rsync is installed and the binary can be found in the PATH.
|
12
|
+
rsync_folder: |-
|
13
|
+
Rsyncing folder: %{hostpath} => %{guestpath}
|
14
|
+
winrm_upload: |-
|
15
|
+
Uploading with WinRM: %{hostpath} => %{guestpath}
|
16
|
+
linking_server: |-
|
17
|
+
Linking vagrant with managed server %{host}
|
18
|
+
unlinking_server: |-
|
19
|
+
Unlinking vagrant from managed server %{host}
|
20
|
+
rebooting_server: |-
|
21
|
+
Rebooting managed server %{host}
|
22
|
+
waiting_for_server: |-
|
23
|
+
Waiting for %{host} to reboot
|
24
|
+
states:
|
25
|
+
short_not_reachable: |-
|
26
|
+
not reachable
|
27
|
+
long_not_reachable: |-
|
28
|
+
The managed server is not reachable. Check if the `config.managed.server` is correct.
|
29
|
+
short_running: |-
|
30
|
+
running
|
31
|
+
long_running: |-
|
32
|
+
The managed server is running. To ssh into this machine, you can run
|
33
|
+
`vagrant ssh`. To provision the machine, you can run `vagrant provision`.
|
34
|
+
config:
|
35
|
+
server_required: |-
|
36
|
+
The IP or hostname of the server must be configured via "server"
|
37
|
+
private_key_missing: |-
|
38
|
+
The specified private key could not be found
|
39
|
+
errors:
|
40
|
+
rsync_error: |-
|
41
|
+
There was an error when attemping to rsync a shared folder.
|
42
|
+
Please inspect the error message below for more info.
|
43
|
+
|
44
|
+
Host path: %{hostpath}
|
45
|
+
Guest path: %{guestpath}
|
46
|
+
Error: %{stderr}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.5.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: 2015-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -72,35 +72,36 @@ executables: []
|
|
72
72
|
extensions: []
|
73
73
|
extra_rdoc_files: []
|
74
74
|
files:
|
75
|
+
- .gitignore
|
76
|
+
- .travis.yml
|
75
77
|
- Berksfile
|
76
78
|
- CHANGELOG.md
|
77
|
-
- dummy.box
|
78
79
|
- Gemfile
|
80
|
+
- LICENSE
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- Vagrantfile
|
84
|
+
- dummy.box
|
85
|
+
- lib/vagrant-managed-servers.rb
|
86
|
+
- lib/vagrant-managed-servers/action.rb
|
79
87
|
- lib/vagrant-managed-servers/action/is_created.rb
|
80
88
|
- lib/vagrant-managed-servers/action/is_reachable.rb
|
81
89
|
- lib/vagrant-managed-servers/action/link_server.rb
|
82
90
|
- lib/vagrant-managed-servers/action/message_not_reachable.rb
|
83
91
|
- lib/vagrant-managed-servers/action/read_state.rb
|
92
|
+
- lib/vagrant-managed-servers/action/reboot_server.rb
|
84
93
|
- lib/vagrant-managed-servers/action/sync_folders.rb
|
85
94
|
- lib/vagrant-managed-servers/action/unlink_server.rb
|
86
95
|
- lib/vagrant-managed-servers/action/warn_networks.rb
|
87
|
-
- lib/vagrant-managed-servers/action.rb
|
88
96
|
- lib/vagrant-managed-servers/config.rb
|
89
97
|
- lib/vagrant-managed-servers/errors.rb
|
90
98
|
- lib/vagrant-managed-servers/plugin.rb
|
91
99
|
- lib/vagrant-managed-servers/provider.rb
|
92
100
|
- lib/vagrant-managed-servers/util/timer.rb
|
93
101
|
- lib/vagrant-managed-servers/version.rb
|
94
|
-
- lib/vagrant-managed-servers.rb
|
95
|
-
- LICENSE
|
96
102
|
- locales/en.yml
|
97
|
-
- Rakefile
|
98
|
-
- README.md
|
99
103
|
- spec/vagrant-managed-servers/config_spec.rb
|
100
104
|
- vagrant-managed-servers.gemspec
|
101
|
-
- Vagrantfile
|
102
|
-
- .gitignore
|
103
|
-
- .travis.yml
|
104
105
|
homepage: https://github.com/tknerr/vagrant-managed-servers
|
105
106
|
licenses:
|
106
107
|
- MIT
|
@@ -121,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
122
|
version: 1.3.6
|
122
123
|
requirements: []
|
123
124
|
rubyforge_project: vagrant-managed-servers
|
124
|
-
rubygems_version: 2.
|
125
|
+
rubygems_version: 2.4.4
|
125
126
|
signing_key:
|
126
127
|
specification_version: 4
|
127
128
|
summary: Enables Vagrant to ssh into and provision managed servers.
|