vagrant-notify 0.5.1 → 0.5.2

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: 147e8cd55fe84bc3a668961b660d1390ed5d7e34
4
- data.tar.gz: 315a4ec49f89f72c9a73b5ac03df91274ea56289
3
+ metadata.gz: ada78d8b90c45702484b19524bd6dcaa04c34de2
4
+ data.tar.gz: 506699d1e51e71f78b7e1ee673434d2220099bd4
5
5
  SHA512:
6
- metadata.gz: ed87d3c11b85beea60b89d4d6a7982ccd2f5a93ddafe85497914bce996220b15a6921364d1d9d9e966fda3e84641c71e02eeb53454e5a738bfa220950a1dba1a
7
- data.tar.gz: aeb2356140cf699eb676b461ec6e2ba9f972b0f1cded0bce2d1e97988ad8fcaead4fa8d90e584e7fa0f1c7399d724d19f613f5b120781fe8aa2d640a5e36b68c
6
+ metadata.gz: f04ded61ee31fafbae3051584f777e040caffecc3b5d3743f27b7f67c54f57af5b6e776d891b8661fd5245a009dedaeea855fdd93be5a1bbf5572a566d262a9a
7
+ data.tar.gz: 63e64ff01e18fa9b26e904759d19aa2f8551872d9f18d8b1c1350b349a2ffb0e73d533976f99760c3e39da04f80eead0d5f062b16dfa97b9de7f045f0dc652ad
data/CHANGELOG.md CHANGED
@@ -1,7 +1,20 @@
1
+ ## [0.5.2](https://github.com/fgrehm/vagrant-notify/compare/v0.5.1...v0.5.2) (October 7, 2016)
2
+ IMPROVEMENTS
3
+
4
+ - Support for docker, lxc, parrallels, and vmware fusion providers. [[GH-13]](https://github.com/fgrehm/vagrant-notify/issues/13)
5
+ - More reliable notification server status notices.
6
+ - New `bind_ip` configuration option.
7
+
8
+ BUG FIXES
9
+
10
+ - `vagrant destroy` on a running guest will now also stop the notfication server.
11
+
12
+
1
13
  ## [0.5.1](https://github.com/fgrehm/vagrant-notify/compare/v0.5.0...v0.5.1) (July 23, 2016)
2
14
  IMPROVEMENTS
3
- - New config option to disable plugin. [[GH-6]]
4
- - Plugin will automatically be disabled for cloud providers. [[GH-15]]
15
+
16
+ - New config option to disable plugin. [[GH-6]](https://github.com/fgrehm/vagrant-notify/issues/6)
17
+ - Plugin will automatically be disabled for cloud providers. [[GH-15]](https://github.com/fgrehm/vagrant-notify/issues/15)
5
18
  - Solaris 11 and BSD guests are now supported.
6
19
  - Windows snarl wrapper script.
7
20
  - OS X growlnotify 1.2.2 wrapper script.
@@ -16,7 +29,7 @@ IMPROVEMENTS
16
29
 
17
30
  - Notification server runs as a daemon (fork() has been removed so it's compatible with Windows). [[GH-14]]
18
31
  - Windows support (beta) [[GH-14]]
19
- - Notification server is available from localhost.
32
+ - Notification server is only available to localhost.
20
33
  - Notification server information is displayed each time vagrant is started and halted.
21
34
  - New plugin command. Ability to view notification server status, and ability for manual restart. [CLI](https://gist.github.com/alpha01/9b81caca694a2735e658f978c41600b5)
22
35
  - New notify-send example scripts for OS X and Windows
data/Gemfile CHANGED
@@ -12,7 +12,6 @@ end
12
12
 
13
13
  group :development, :test do
14
14
  gem 'vagrant', github: 'mitchellh/vagrant'
15
- gem 'vagrant-lxc', github: 'fgrehm/vagrant-lxc'
16
15
  gem 'rake'
17
16
  gem 'rspec', '~> 2.13.0'
18
17
  gem 'rspec-spies'
data/Gemfile.lock CHANGED
@@ -1,9 +1,3 @@
1
- GIT
2
- remote: git://github.com/fgrehm/vagrant-lxc.git
3
- revision: 4a84d95ff26bf2d887b127765a9ae404899734f9
4
- specs:
5
- vagrant-lxc (0.8.1.dev)
6
-
7
1
  GIT
8
2
  remote: git://github.com/mitchellh/vagrant.git
9
3
  revision: e3734a7a46c39cd73e79538980dd98aeaeca9656
@@ -19,7 +13,7 @@ GIT
19
13
  PATH
20
14
  remote: .
21
15
  specs:
22
- vagrant-notify (0.5.1)
16
+ vagrant-notify (0.5.2)
23
17
 
24
18
  GEM
25
19
  remote: https://rubygems.org/
@@ -87,8 +81,7 @@ DEPENDENCIES
87
81
  rspec (~> 2.13.0)
88
82
  rspec-spies
89
83
  vagrant!
90
- vagrant-lxc!
91
84
  vagrant-notify!
92
85
 
93
86
  BUNDLED WITH
94
- 1.12.2
87
+ 1.13.0
data/README.md CHANGED
@@ -22,7 +22,7 @@ $ vagrant plugin install vagrant-notify
22
22
 
23
23
  Whenever you run `vagrant up`, a Ruby [TCPServer](http://www.ruby-doc.org/stdlib-1.9.3/libdoc/socket/rdoc/TCPServer.html)
24
24
  will fire up on a port within the [usable port range](https://github.com/mitchellh/vagrant/blob/master/config/default.rb#L14)
25
- and a [script](https://github.com/fgrehm/vagrant-notify/blob/master/files/notify-send.erb)
25
+ and a Ruby [script](https://github.com/fgrehm/vagrant-notify/blob/master/files/notify-send.erb)
26
26
  will be copied over to the guest machine to replace the original `notify-send`
27
27
  command.
28
28
 
@@ -36,7 +36,6 @@ notifications like:
36
36
 
37
37
  ![provisioned](http://i.imgur.com/UGhOAzV.png)
38
38
 
39
-
40
39
  ### Linux
41
40
 
42
41
  Since Linux distributions have `notify-send` pre-installed, everything should work out of the box.
@@ -55,24 +54,46 @@ A (too) primitive script integrating with Growl:
55
54
  growlnotify -t "Vagrant VM" -m "$*"
56
55
  ```
57
56
 
58
- Check out our OS X notify-send compatible [scripts](https://github.com/fgrehm/vagrant-notify/tree/master/examples).
57
+ Check out our OS X notify-send compatible [scripts](https://github.com/fgrehm/vagrant-notify/tree/master/examples#os-x).
59
58
 
60
59
  ### Windows (beta)
61
60
 
62
61
  You can use the freeware application [notify-send for Windows](http://vaskovsky.net/notify-send/), make sure the notify-send binary is available on `Path`.
63
62
 
64
- Check out our Windows notify-send compatible [scripts](https://github.com/fgrehm/vagrant-notify/tree/master/examples).
63
+ Check out our Windows notify-send compatible [scripts](https://github.com/fgrehm/vagrant-notify/tree/master/examples#windows).
65
64
 
66
65
  ## Configuration
67
66
 
68
- Notifcation server is enabled by default on all VMs. You can individually disable the plugin by adding the following to your `Vagrantfile`
67
+ Notification server is enabled by default on all guests. You can individually disable the plugin by adding the following to your `Vagrantfile`
69
68
 
70
69
  ```ruby
71
70
  config.notify.enable = false
72
71
  ```
73
72
 
74
73
  _Please note that as of v0.5.1, the notification server will automatically be disabled for any of the following
75
- [cloud providers](lib/vagrant-notify/plugin.rb#L72-74)_
74
+ [cloud providers](lib/vagrant-notify/plugin.rb#L77-L79)._
75
+
76
+ By default, the notification server is binded to [local interfaces](lib/vagrant-notify/plugin.rb#L82-L86). For networking different than your provider's default network configuration, you can use the *bind_ip* configuration option to bind the notification server onto a different local ip address.
77
+
78
+ ```ruby
79
+ config.notify.bind_ip = "192.68.56.20"
80
+ ```
81
+
82
+ **WARNING**
83
+
84
+ _Do **NOT** bind the notification server to an IP accessible over a network! The notification server does not have any authentication and doing so will leave your system vulnerable to remote command execution._
85
+
86
+ ### Providers and Guests
87
+
88
+ vagrant-notify supports the following providers:
89
+
90
+ - VirtualBox
91
+ - Docker
92
+ - [LXC](https://github.com/fgrehm/vagrant-lxc)
93
+ - [Parallels](https://github.com/Parallels/vagrant-parallels)
94
+ - [VMWare Fusion](https://www.vagrantup.com/vmware)
95
+
96
+ vagrant-notify has been tested and known to work with Linux, Solaris 11, FreeBSD, OpenBSD, and NetBSD guests. (notify-send icon forwarding feature is not supported on BSD guests)
76
97
 
77
98
  ## Demo
78
99
 
@@ -83,7 +104,6 @@ _Please note that as of v0.5.1, the notification server will automatically be di
83
104
 
84
105
  ## Known issues
85
106
 
86
- * `vagrant destroy` on a running VM will not stop the notification server.
87
107
  * On rare occasions the notification server may stop receiving notifications if the host is suspended/hibernates. The notification server may need to be manually restarted if that's the case. `vagrant notify --restart`
88
108
 
89
109
 
@@ -11,4 +11,5 @@ Vagrant.configure("2") do |config|
11
11
  config.vm.define :vm1
12
12
  config.vm.define :vm2
13
13
  config.notify.enable = true
14
+ # config.notify.bind_ip = '127.0.0.1'
14
15
  end
@@ -2,8 +2,7 @@
2
2
  # -*- mode: ruby -*-
3
3
  # vi: set ft=ruby :
4
4
 
5
- # This is the wrapper around Ubuntu's notify-send that connects to the host machine
6
- # when sending notifications
5
+ # This is the wrapper around notify-send that connects to the host machine when sending notifications.
7
6
 
8
7
  require 'rubygems'
9
8
  require 'socket'
@@ -24,27 +23,37 @@ OptionParser.new do |opts|
24
23
 
25
24
  end.parse!
26
25
 
27
- if options[:i]
28
- new_filename = options[:i].gsub('/', '-')
29
- FileUtils.cp options[:i], "<%= shared_folder %>/#{new_filename}"
30
- options[:i] = new_filename
26
+ # BSD guests do not support shared folders
27
+ unless RUBY_PLATFORM =~ /freebsd|openbsd|netbsd/
28
+ if options[:i]
29
+ new_filename = options[:i].gsub('/', '-')
30
+ FileUtils.cp options[:i], "<%= shared_folder %>/#{new_filename}"
31
+ options[:i] = new_filename
32
+ end
31
33
  end
32
34
 
33
35
  cmd = options.map do |key, value|
34
36
  "-#{key} '#{value}'"
35
37
  end.join(' ')
36
38
 
37
- # TODO: Need to escape values
39
+ # All single quotes part of the message get removed.
40
+ # TODO: Need to escape values.
38
41
  unless ARGV.empty?
39
42
  cmd << ARGV.map{|a| " '#{a.gsub(/'/, "")}'"}.join(' ')
40
43
  end
41
44
 
42
- if RUBY_PLATFORM =~ /linux/
43
- client_ip = `ip route|awk '/default/ {print $3}'`
44
- elsif RUBY_PLATFORM =~ /solaris|freebsd|openbsd|netbsd/
45
- client_ip = `netstat -r|awk '/default/ {print $2}'`
45
+ # VirtualBox is the only provider that can communicate with 127.0.0.1, others will have to use default private networking
46
+ if "<%= provider_name %>" == "virtualbox"
47
+ if RUBY_PLATFORM =~ /linux/
48
+ client_ip = `ip route|awk '/default/ {print $3}'`
49
+ elsif RUBY_PLATFORM =~ /solaris|freebsd|openbsd|netbsd/
50
+ client_ip = `netstat -r|awk '/default/ {print $2}'`
51
+ end
52
+ else
53
+ client_ip = "<%= client_ip %>"
46
54
  end
47
55
 
56
+
48
57
  TCPSocket.open client_ip, <%= host_port %> do |s|
49
58
  s.send cmd, 0
50
59
  end
@@ -21,11 +21,19 @@ module Vagrant
21
21
  b2.use PrepareData
22
22
  b2.use Call, ServerIsRunning do |env2, b3|
23
23
  if env2[:result]
24
- # TODO: b3.use MessageServerRunning
24
+ env[:machine].ui.success("vagrant-notify-server pid: #{env2[:notify_data][:pid]}")
25
25
  else
26
26
  # TODO: b3.use CheckServerPortCollision
27
27
  b3.use StartServer
28
- # TODO: b3.use BackupCommand
28
+
29
+ b3.use PrepareData
30
+ b3.use Call, ServerIsRunning do |env3, b4|
31
+ if env3[:result]
32
+ env3[:machine].ui.success("vagrant-notify-server pid: #{env3[:notify_data][:pid]}")
33
+ else
34
+ env3[:machine].ui.error("Unable to start notification server using #{env3[:machine].config.notify.bind_ip}")
35
+ end
36
+ end
29
37
  end
30
38
  # Always install the command to make sure we can fix stale ips
31
39
  # on the guest machine
@@ -19,7 +19,8 @@ module Vagrant
19
19
 
20
20
  def compile_command(env, template_file)
21
21
  host_port = env[:notify_data][:port]
22
- template_binding = OpenStruct.new(:host_port => host_port, :shared_folder => '/tmp/vagrant-notify')
22
+ provider_name = env[:machine].provider_name
23
+ template_binding = OpenStruct.new(:host_port => host_port, :shared_folder => '/tmp/vagrant-notify', :provider_name => provider_name, :client_ip => env[:machine].config.notify.bind_ip)
23
24
  command_template = ERB.new(Vagrant::Notify.files_path.join(template_file).read)
24
25
  command = command_template.result(template_binding.instance_eval { binding })
25
26
 
@@ -14,18 +14,20 @@ module Vagrant
14
14
  def call(env)
15
15
  @env = env
16
16
 
17
- port = next_available_port
18
17
  id = env[:machine].id
18
+ provider_name = env[:machine].provider_name
19
19
  dir = File.expand_path('../../', __FILE__)
20
20
 
21
21
  return if env[:machine].config.notify.enable == false
22
22
 
23
+ port = next_available_port(env[:machine].config.notify.bind_ip)
24
+
23
25
  if which('ruby')
24
- env[:notify_data][:pid] = Process.spawn("ruby #{dir}/server.rb #{id} #{port}")
26
+ env[:notify_data][:pid] = Process.spawn("ruby #{dir}/server.rb #{id} #{port} #{env[:machine].config.notify.bind_ip} #{provider_name}")
25
27
  env[:notify_data][:port] = port
26
28
 
27
- env[:machine].ui.success("Started vagrant-notify-server pid: #{env[:notify_data][:pid]}")
28
29
  sleep 5
30
+ Process.detach(env[:notify_data][:pid].to_i)
29
31
  else
30
32
  env[:machine].ui.error("Unable to spawn TCPServer daemon, ruby not found in $PATH")
31
33
  end
@@ -34,7 +36,7 @@ module Vagrant
34
36
 
35
37
  end
36
38
 
37
- def next_available_port
39
+ def next_available_port(bind_ip)
38
40
  # Determine a list of usable ports for us to use
39
41
  usable_ports = Set.new(@env[:machine].config.vm.usable_port_range)
40
42
 
@@ -46,7 +48,7 @@ module Vagrant
46
48
  # Pass two, remove ports used by other processes
47
49
  with_forwarded_ports do |options|
48
50
  host_port = options[:host]
49
- usable_ports.delete(options[:host]) if is_port_open?("127.0.0.1", host_port)
51
+ usable_ports.delete(options[:host]) if is_port_open?(bind_ip, host_port)
50
52
  end
51
53
 
52
54
  # If we have no usable ports then we can't use the plugin
@@ -56,7 +58,7 @@ module Vagrant
56
58
  # will use the first as in:
57
59
  # https://github.com/mitchellh/vagrant/blob/master/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb#L84
58
60
  usable_ports.to_a.sort.reverse.find do |port|
59
- return port unless is_port_open?("127.0.0.1", port)
61
+ return port unless is_port_open?(bind_ip, port)
60
62
  end
61
63
  end
62
64
 
@@ -1,10 +1,11 @@
1
1
  module Vagrant
2
2
  module Notify
3
3
  class Config < Vagrant.plugin(2, :config)
4
- attr_accessor :enable
4
+ attr_accessor :enable, :bind_ip
5
5
 
6
6
  def initialize()
7
- @enable = UNSET_VALUE
7
+ @enable = UNSET_VALUE
8
+ @bind_ip = UNSET_VALUE
8
9
  end
9
10
 
10
11
  def validate(machine)
@@ -19,14 +20,32 @@ module Vagrant
19
20
  if @enable != 0
20
21
  if @enable != false && @enable != true
21
22
  errors << "Unknown option: #{@enable}"
23
+ end
24
+ end
22
25
 
23
- { "notify" => errors }
26
+ if backed_by_supported_provider?(machine)
27
+ if @bind_ip.is_a?(String)
28
+ require "resolv"
29
+ unless @bind_ip =~ Resolv::IPv4::Regex
30
+ errors << "Invalid bind IP address: #{@bind_ip}"
31
+ end
32
+ elsif @bind_ip.is_a?(FalseClass) || @bind_ip.is_a?(Fixnum) || @bind_ip.is_a?(Array) || @bind_ip.is_a?(Hash)
33
+ errors << "Unknown bind IP address: #{@bind_ip}"
34
+ else
35
+ @bind_ip = SUPPORTED_PROVIDERS[machine.provider_name]
24
36
  end
37
+ else
38
+ machine.ui.warn("#{machine.provider_name.to_s} provider is not supported by vagrant-notify. Please feel free to open a new issue https://github.com/fgrehm/vagrant-notify/issues")
39
+
40
+ @enable = false
25
41
  end
42
+
43
+ { "notify" => errors }
26
44
  end
27
45
 
28
46
  def finalize!
29
47
  @enable = 0 if @enable == UNSET_VALUE
48
+ @bind_ip = @bind_ip if @bind_ip == UNSET_VALUE
30
49
  end
31
50
 
32
51
  private
@@ -34,6 +53,9 @@ module Vagrant
34
53
  def backed_by_cloud_provider?(machine)
35
54
  CLOUD_PROVIDERS.include?(machine.provider_name.to_s)
36
55
  end
56
+ def backed_by_supported_provider?(machine)
57
+ SUPPORTED_PROVIDERS.has_key?(machine.provider_name)
58
+ end
37
59
  end
38
60
  end
39
61
  end
@@ -9,16 +9,9 @@ module Vagrant
9
9
  hook.before :run_provisioner, Vagrant::Notify::Action::NotifyProvisioningStatus
10
10
  end
11
11
 
12
- # TODO: This should be generic, we don't want to hard code every single
13
- # possible provider action class that Vagrant might have
14
12
  start_server_hook = lambda do |hook|
15
13
  require_relative './action'
16
- hook.after VagrantPlugins::ProviderVirtualBox::Action::WaitForCommunicator, Vagrant::Notify::Action.action_start_server
17
-
18
- if defined?(Vagrant::LXC)
19
- require 'vagrant-lxc/action'
20
- hook.after Vagrant::LXC::Action::Boot, Vagrant::Notify::Action.action_start_server
21
- end
14
+ hook.after Vagrant::Action::Builtin::WaitForCommunicator, Vagrant::Notify::Action.action_start_server
22
15
  end
23
16
 
24
17
  action_hook 'start-server-after-boot-on-machine-up', :machine_action_up, &start_server_hook
@@ -35,24 +28,37 @@ module Vagrant
35
28
  action_hook 'stop-server-after-halt', :machine_action_halt do |hook|
36
29
  require_relative './action'
37
30
  hook.before Vagrant::Action::Builtin::GracefulHalt, Vagrant::Notify::Action.action_stop_server
38
- end
39
31
 
32
+ # Docker doesn't do a graceful halt
33
+ hook.before VagrantPlugins::DockerProvider::Action::Stop, Vagrant::Notify::Action.action_stop_server
34
+ end
40
35
 
41
- # TODO: This should be generic, we don't want to hard code every single
42
- # possible provider action class that Vagrant might have
43
36
  action_hook 'stop-server-before-destroy', :machine_action_destroy do |hook|
44
37
  require_relative './action'
45
- hook.before VagrantPlugins::ProviderVirtualBox::Action::Destroy, Vagrant::Notify::Action.action_stop_server
46
-
47
- if defined?(Vagrant::LXC)
48
- require 'vagrant-lxc/action'
49
- hook.before Vagrant::LXC::Action::Destroy, Vagrant::Notify::Action.action_stop_server
50
- end
38
+ hook.before Vagrant::Action::Builtin::DestroyConfirm, Vagrant::Notify::Action.action_stop_server
51
39
  end
52
40
 
41
+ # There isn't a Vagrant Action Bulitin module for suspend operations.
42
+ # Suspend class is implemented at the individual provider plugin level, therefore need to list them here.
53
43
  action_hook 'stop-server-after-suspend', :machine_action_suspend do |hook|
54
44
  require_relative './action'
45
+ # Vagrant's default providers: (Docker does not suport suspend)
55
46
  hook.before VagrantPlugins::ProviderVirtualBox::Action::Suspend, Vagrant::Notify::Action.action_stop_server
47
+ hook.before VagrantPlugins::HyperV::Action::SuspendVM, Vagrant::Notify::Action.action_stop_server
48
+
49
+ # Third party provider plugins:
50
+ if defined?(HashiCorp::VagrantVMwarefusion)
51
+ require 'vagrant-parallels/action'
52
+ hook.before HashiCorp::VagrantVMwarefusion::Action::Suspend, Vagrant::Notify::Action.action_stop_server
53
+ end
54
+ if defined?(VagrantPlugins::Parallels)
55
+ require 'vagrant-parallels/action'
56
+ hook.before VagrantPlugins::Parallels::Action::Suspend, Vagrant::Notify::Action.action_stop_server
57
+ end
58
+ if defined?(VagrantPlugins::AppCatalyst)
59
+ require 'vagrant-vmware-appcatalyst/action'
60
+ hook.before VagrantPlugins::AppCatalyst::Action::Suspend, Vagrant::Notify::Action.action_stop_server
61
+ end
56
62
  end
57
63
 
58
64
  command(:notify) do
@@ -67,9 +73,16 @@ module Vagrant
67
73
  end
68
74
  end
69
75
 
70
- # Keep an eye on https://github.com/mitchellh/vagrant/wiki/Available-Vagrant-Plugins#wiki-providers
71
- # for more.
76
+ # Keep an eye on https://github.com/mitchellh/vagrant/wiki/Available-Vagrant-Plugins#wiki-providers for more.
72
77
  CLOUD_PROVIDERS = %w( aws cloudstack digital_ocean hp joyent openstack rackspace
73
78
  softlayer proxmox managed azure brightbox cloudstack vcloud
74
79
  vsphere )
80
+
81
+ # Supported providers and default IPs used to bind the notifcation server too.
82
+ SUPPORTED_PROVIDERS = { :virtualbox => '127.0.0.1',
83
+ :docker => '172.17.0.1',
84
+ :lxc => '10.0.3.1',
85
+ :parallels => '10.211.55.2',
86
+ :vmware_fusion => '192.168.172.1'
87
+ }
75
88
  end
@@ -5,13 +5,17 @@ module Vagrant
5
5
  class Server
6
6
  HTTP_RESPONSE = "Hi! You just reached the vagrant notification server"
7
7
 
8
- def self.run(id, port, machine_name='default', provider='virtualbox')
8
+ def self.run(id, port, bind_ip, machine_name='default', provider='virtualbox')
9
9
  #id = env[:machine].id
10
10
  #machine_name = env[:machine].name
11
11
  #provider = env[:machine].provider_name
12
12
 
13
13
  if __FILE__ == $0
14
- tcp_server = TCPServer.open("127.0.0.1", port)
14
+ begin
15
+ tcp_server = TCPServer.open(bind_ip, port)
16
+ rescue
17
+ exit 1
18
+ end
15
19
  server = self.new(id, machine_name, provider)
16
20
 
17
21
  # Have to wrap this in a begin/rescue block so we can be certain the server is running at all times.
@@ -83,5 +87,6 @@ end
83
87
  # Ghetto
84
88
  id = ARGV[0]
85
89
  port = ARGV[1]
90
+ bind_ip = ARGV[2]
86
91
 
87
- Vagrant::Notify::Server.run(id,port)
92
+ Vagrant::Notify::Server.run(id, port, bind_ip)
@@ -1,5 +1,5 @@
1
1
  module Vagrant
2
2
  module Notify
3
- VERSION = "0.5.1"
3
+ VERSION = "0.5.2"
4
4
  end
5
5
  end
@@ -5,17 +5,19 @@ require 'vagrant-notify/action/install_command'
5
5
 
6
6
  describe Vagrant::Notify::Action::InstallCommand do
7
7
  let(:app) { lambda { |env| } }
8
- let(:config) { mock(notify: stub(enable: true)) }
8
+ let(:config) { mock(notify: stub(enable: true, bind_ip: "127.0.0.1")) }
9
9
  let(:env) { {notify_data: {port: host_port}, machine: machine, tmp_path: tmp_path} }
10
10
  let(:host_port) { 12345 }
11
- let(:machine) { mock(communicate: communicator, config: config) }
11
+ let(:machine) { mock(communicate: communicator, config: config, provider_name: provider_name) }
12
12
  let(:communicator) { mock(upload: true, sudo: true) }
13
13
  let(:host_ip) { '192.168.1.2' }
14
+ let(:provider_name) { 'virtualbox' }
14
15
  let(:tmp_path) { Pathname.new(Dir.mktmpdir) }
15
16
  let(:tmp_cmd_path) { tmp_path.join('vagrant-notify-send') }
16
17
  let(:guest_tmp_path) { '/tmp/notify-send' }
17
18
  let(:guest_path) { '/usr/bin/notify-send' }
18
19
  let(:stubbed_template) { ERB.new('<%= host_port %>') }
20
+ let(:stubbed_template2) { ERB.new('<%= provider_name %>') }
19
21
 
20
22
  subject { described_class.new(app, env) }
21
23
 
@@ -5,14 +5,15 @@ require 'vagrant-notify/action/start_server'
5
5
  require 'vagrant-notify/server'
6
6
 
7
7
  describe Vagrant::Notify::Action::StartServer do
8
- let(:app) { lambda { |env| } }
9
- let(:config) { mock(notify: stub(enable: true)) }
10
- let(:ui) { mock(success: true)}
11
- let(:id) { '425e799c-1293-4939-bo39-263lcc7457e8' }
12
- let(:machine) { mock(state: stub(id: :stopped), ui: ui, id: id, config: config) }
13
- let(:env) { {notify_data: {}, machine: machine} }
14
- let(:pid) { '42' }
15
- let(:port) { '1234' }
8
+ let(:app) { lambda { |env| } }
9
+ let(:config) { mock(notify: stub(enable: true, bind_ip: "127.0.0.1")) }
10
+ let(:ui) { mock(success: true)}
11
+ let(:id) { '425e799c-1293-4939-bo39-263lcc7457e8' }
12
+ let(:provider_name) { 'virtualbox' }
13
+ let(:machine) { mock(state: stub(id: :stopped), ui: ui, id: id, config: config, provider_name: provider_name) }
14
+ let(:env) { {notify_data: {}, machine: machine} }
15
+ let(:pid) { '42' }
16
+ let(:port) { '1234' }
16
17
 
17
18
  subject { described_class.new(app, env) }
18
19
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-notify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabio Rehm
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-07-23 00:00:00.000000000 Z
12
+ date: 2016-10-08 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A Vagrant plugin that forwards `notify-send` from guest to host machine
15
15
  and notifies provisioning status