vagrant-notify-forwarder 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0de481fac4a7e43796671364c899c5dacaf63c68
4
- data.tar.gz: 62ee6182f5f9c1eb47f02e283688d8f8d3720426
3
+ metadata.gz: c3f0078e68ff06061fdaa7747628a44f7f258537
4
+ data.tar.gz: dd2d4b0d4a5ba9964dbe05dbfd12c9f9cb02e881
5
5
  SHA512:
6
- metadata.gz: 5939a4088a66cb58af7add7b435443f9ed86eb7b83ba2ecb225c2f1bc6783c46bb388cb6c43fcf685ec2864e7b12116404710dad153adcdcb01526f89437666d
7
- data.tar.gz: e8d9340c781a795d9f482c27687beb43b5068bafc9407ce08b2f6668bf8d4a47835a81a818e9b161d72cef6e7eee310323a166add8c62342bc51645adb87e25f
6
+ metadata.gz: fe9af0569a977ee0a226e550328f9d5a7421fc84bf28601741781d7a3ffcbeee2de724120db2f699d751de947b7ee2dc901e34d68bf00fd27455ccb9b5b6e78e
7
+ data.tar.gz: b5ece858b8e0b9ca63070d029cea65e12902af4468c12748790d7e68db8cbae4a1ce114a7ebeb752bdf3c315c7bedf7cf1e4234fbdbc8f08f75e67441582246f
data/README.md CHANGED
@@ -24,6 +24,15 @@ config.notify_forwarder.port = 22020 # Or your port number
24
24
  The server and guest binaries will be automatically downloaded from the notify-forwarder repo's
25
25
  releases and verified with SHA256.
26
26
 
27
+ ### Permissions
28
+
29
+ The client in the guest OS will run as root by default, assuming passwordless `sudo` works. If this
30
+ does *not* work, you can disable privilege escalation in your `Vagrantfile`:
31
+
32
+ ```ruby
33
+ config.notify_forwarder.run_as_root = false
34
+ ```
35
+
27
36
  ## Supported operating systems
28
37
 
29
38
  To conserve size and dependencies, the plugin downloads binaries for supported platforms. This
@@ -44,3 +53,4 @@ config.notify_forwarder.enable = false
44
53
 
45
54
  * [CharlieC3](https://github.com/CharlieC3)
46
55
  * [hedinfaok](https://github.com/hedinfaok)
56
+ * [seff](https://github.com/seff)
@@ -0,0 +1,18 @@
1
+ module VagrantPlugins
2
+ module VagrantNotifyForwarder
3
+ module Action
4
+ class CheckBootState
5
+ def initialize(app, env)
6
+ @app = app
7
+ end
8
+
9
+ def call(env)
10
+ return unless env[:machine].config.notify_forwarder.enable
11
+ $BOOT_SAVED = env[:machine].state.id == :saved
12
+
13
+ @app.call env
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -31,6 +31,8 @@ module VagrantPlugins
31
31
  def call(env)
32
32
  @app.call env
33
33
 
34
+ return if $BOOT_SAVED
35
+
34
36
  return unless env[:machine].config.notify_forwarder.enable
35
37
 
36
38
  path = ensure_binary_downloaded env
@@ -38,12 +40,18 @@ module VagrantPlugins
38
40
 
39
41
  port = env[:machine].config.notify_forwarder.port
40
42
 
43
+ start_command = "nohup /tmp/notify-forwarder receive -p #{port} &"
44
+
45
+ if env[:machine].config.notify_forwarder.run_as_root
46
+ start_command = "sudo #{start_command}"
47
+ end
48
+
41
49
  env[:machine].communicate.upload(path, "/tmp/notify-forwarder")
42
50
  env[:ui].output("Starting notify-forwarder ...")
43
- env[:machine].communicate.execute("nohup /tmp/notify-forwarder receive -p #{port} &")
51
+ env[:machine].communicate.execute(start_command)
44
52
  env[:ui].detail("Notify-forwarder: guest listening for file change notifications on 0.0.0.0:#{port}.")
45
53
  end
46
54
  end
47
55
  end
48
56
  end
49
- end
57
+ end
@@ -3,16 +3,19 @@ module VagrantPlugins
3
3
  class Config < Vagrant.plugin(2, :config)
4
4
  attr_accessor :port
5
5
  attr_accessor :enable
6
+ attr_accessor :run_as_root
6
7
 
7
8
  def initialize
8
9
  @port = UNSET_VALUE
9
10
  @enable = UNSET_VALUE
11
+ @run_as_root = UNSET_VALUE
10
12
  end
11
13
 
12
14
  def finalize!
13
15
  @port = 29324 if @port == UNSET_VALUE
14
16
  @enable = true if @enable == UNSET_VALUE
17
+ @run_as_root = true if @run_as_root == UNSET_VALUE
15
18
  end
16
19
  end
17
20
  end
18
- end
21
+ end
@@ -1,5 +1,7 @@
1
1
  require 'vagrant'
2
2
 
3
+ $BOOT_SAVED = false
4
+
3
5
  module VagrantPlugins
4
6
  module VagrantNotifyForwarder
5
7
  class Plugin < Vagrant.plugin('2')
@@ -8,15 +10,32 @@ module VagrantPlugins
8
10
 
9
11
  register_boot_hooks = lambda do |hook|
10
12
  require_relative 'action/start_host_forwarder'
11
- require_relative 'action/stop_host_forwarder'
13
+ # require_relative 'action/stop_host_forwarder'
12
14
  require_relative 'action/start_client_forwarder'
15
+ require_relative 'action/check_boot_state'
13
16
 
17
+ hook.before VagrantPlugins::ProviderVirtualBox::Action::Resume,
18
+ VagrantPlugins::VagrantNotifyForwarder::Action::CheckBootState
14
19
  hook.after Vagrant::Action::Builtin::Provision,
15
20
  VagrantPlugins::VagrantNotifyForwarder::Action::StartHostForwarder
16
21
  hook.after VagrantPlugins::VagrantNotifyForwarder::Action::StartHostForwarder,
17
22
  VagrantPlugins::VagrantNotifyForwarder::Action::StartClientForwarder
18
23
  end
19
24
 
25
+ register_suspend_hooks = lambda do |hook|
26
+ require_relative 'action/stop_host_forwarder'
27
+
28
+ hook.before VagrantPlugins::ProviderVirtualBox::Action::Suspend,
29
+ VagrantPlugins::VagrantNotifyForwarder::Action::StopHostForwarder
30
+ end
31
+
32
+ register_resume_hooks = lambda do |hook|
33
+ require_relative 'action/start_host_forwarder'
34
+
35
+ hook.after VagrantPlugins::ProviderVirtualBox::Action::Provision,
36
+ VagrantPlugins::VagrantNotifyForwarder::Action::StartHostForwarder
37
+ end
38
+
20
39
  register_halt_hooks = lambda do |hook|
21
40
  require_relative 'action/stop_host_forwarder'
22
41
 
@@ -39,6 +58,9 @@ module VagrantPlugins
39
58
  action_hook :start_notify_forwarder, :machine_action_up, &register_boot_hooks
40
59
  action_hook :start_notify_forwarder, :machine_action_reload, &register_boot_hooks
41
60
 
61
+ action_hook :stop_notify_forwarder, :machine_action_suspend, &register_suspend_hooks
62
+ action_hook :stop_notify_forwarder, :machine_action_resume, &register_resume_hooks
63
+
42
64
  action_hook :stop_notify_forwarder, :machine_action_halt, &register_halt_hooks
43
65
  action_hook :stop_notify_forwarder, :machine_action_reload, &register_halt_hooks
44
66
 
@@ -46,4 +68,4 @@ module VagrantPlugins
46
68
 
47
69
  end
48
70
  end
49
- end
71
+ end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module VagrantNotifyForwarder
3
- VERSION = "0.4.0"
3
+ VERSION = "0.5.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-notify-forwarder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Magnus Hallin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-06 00:00:00.000000000 Z
11
+ date: 2016-09-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A vagrant plugin that forwards file system events from the host to the
14
14
  guest
@@ -18,12 +18,13 @@ executables: []
18
18
  extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
- - .gitignore
21
+ - ".gitignore"
22
22
  - Gemfile
23
23
  - LICENSE.txt
24
24
  - README.md
25
25
  - Rakefile
26
26
  - lib/vagrant-notify-forwarder.rb
27
+ - lib/vagrant-notify-forwarder/action/check_boot_state.rb
27
28
  - lib/vagrant-notify-forwarder/action/start_client_forwarder.rb
28
29
  - lib/vagrant-notify-forwarder/action/start_host_forwarder.rb
29
30
  - lib/vagrant-notify-forwarder/action/stop_host_forwarder.rb
@@ -42,17 +43,17 @@ require_paths:
42
43
  - lib
43
44
  required_ruby_version: !ruby/object:Gem::Requirement
44
45
  requirements:
45
- - - '>='
46
+ - - ">="
46
47
  - !ruby/object:Gem::Version
47
48
  version: '0'
48
49
  required_rubygems_version: !ruby/object:Gem::Requirement
49
50
  requirements:
50
- - - '>='
51
+ - - ">="
51
52
  - !ruby/object:Gem::Version
52
53
  version: '0'
53
54
  requirements: []
54
55
  rubyforge_project:
55
- rubygems_version: 2.0.14.1
56
+ rubygems_version: 2.5.1
56
57
  signing_key:
57
58
  specification_version: 4
58
59
  summary: A vagrant plugin that forwards file system events from the host to the guest