vagrant-serial 0.0.15 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,10 +6,16 @@ module Vagrant
6
6
  attr_accessor :sockets_path
7
7
 
8
8
  def sockets_path
9
- @sockets_path.nil? ? (@sockets_path = "#{DEFAULT_HOME}/serial") : @sockets_path
9
+ @sockets_path.nil? ? (@sockets_path = "#{Vagrant::Environment::DEFAULT_HOME}/serial") : @sockets_path
10
+ end
11
+
12
+ def set?
13
+ forward_com1 || forward_com2
10
14
  end
11
15
 
12
16
  def validate(env, errors)
17
+ return unless set?
18
+
13
19
  errors.add("Host port for com1 forwarding couldn't be below 1024.") if forward_com1 && forward_com1.to_i < 1024
14
20
  errors.add("Host port for com2 forwarding couldn't be below 1024.") if forward_com2 && forward_com2.to_i < 1024
15
21
  end
@@ -7,14 +7,16 @@ module Vagrant
7
7
  end
8
8
 
9
9
  def call(env)
10
- FileUtils.mkdir_p(env[:vm].config.serial.sockets_path) if !File.directory?(env[:vm].config.serial.sockets_path)
10
+ if env[:vm].config.serial.set?
11
+ FileUtils.mkdir_p(env[:vm].config.serial.sockets_path) if !File.directory?(env[:vm].config.serial.sockets_path)
11
12
 
12
- if env[:vm].config.serial.forward_com1
13
- `/sbin/start-stop-daemon --stop --quiet --pidfile #{env[:vm].config.serial.sockets_path}/socat.#{env[:vm].uuid}-com1.pid --exec /usr/bin/socat && rm #{env[:vm].config.serial.sockets_path}/socat.#{env[:vm].uuid}-com1.pid`
14
- end
13
+ if env[:vm].config.serial.forward_com1
14
+ `/sbin/start-stop-daemon --stop --quiet --pidfile #{env[:vm].config.serial.sockets_path}/socat.#{env[:vm].uuid}-com1.pid --exec /usr/bin/socat && rm #{env[:vm].config.serial.sockets_path}/socat.#{env[:vm].uuid}-com1.pid`
15
+ end
15
16
 
16
- if env[:vm].config.serial.forward_com2
17
- `/sbin/start-stop-daemon --stop --quiet --pidfile #{env[:vm].config.serial.sockets_path}/socat.#{env[:vm].uuid}-com2.pid --exec /usr/bin/socat && rm #{env[:vm].config.serial.sockets_path}/socat.#{env[:vm].uuid}-com2.pid`
17
+ if env[:vm].config.serial.forward_com2
18
+ `/sbin/start-stop-daemon --stop --quiet --pidfile #{env[:vm].config.serial.sockets_path}/socat.#{env[:vm].uuid}-com2.pid --exec /usr/bin/socat && rm #{env[:vm].config.serial.sockets_path}/socat.#{env[:vm].uuid}-com2.pid`
19
+ end
18
20
  end
19
21
 
20
22
  @app.call(env)
@@ -7,16 +7,18 @@ module Vagrant
7
7
  end
8
8
 
9
9
  def call(env)
10
- FileUtils.mkdir_p(env[:vm].config.serial.sockets_path) if !File.directory?(env[:vm].config.serial.sockets_path)
10
+ if env[:vm].config.serial.set?
11
+ FileUtils.mkdir_p(env[:vm].config.serial.sockets_path) if !File.directory?(env[:vm].config.serial.sockets_path)
11
12
 
12
- if env[:vm].config.serial.forward_com1
13
- command = ["modifyvm", env[:vm].uuid, "--uart1", "0x3F8", "4", "--uartmode1", "server", "#{env[:vm].config.serial.sockets_path}/#{env[:vm].uuid}-com1"]
14
- env[:vm].driver.execute_command(command)
15
- end
13
+ if env[:vm].config.serial.forward_com1
14
+ command = ["modifyvm", env[:vm].uuid, "--uart1", "0x3F8", "4", "--uartmode1", "server", "#{env[:vm].config.serial.sockets_path}/#{env[:vm].uuid}-com1"]
15
+ env[:vm].driver.execute_command(command)
16
+ end
16
17
 
17
- if env[:vm].config.serial.forward_com2
18
- command = ["modifyvm", env[:vm].uuid, "--uart2", "0x2F8", "3", "--uartmode2", "server", "#{env[:vm].config.serial.sockets_path}/#{env[:vm].uuid}-com2"]
19
- env[:vm].driver.execute_command(command)
18
+ if env[:vm].config.serial.forward_com2
19
+ command = ["modifyvm", env[:vm].uuid, "--uart2", "0x2F8", "3", "--uartmode2", "server", "#{env[:vm].config.serial.sockets_path}/#{env[:vm].uuid}-com2"]
20
+ env[:vm].driver.execute_command(command)
21
+ end
20
22
  end
21
23
 
22
24
  @app.call(env)
@@ -7,14 +7,16 @@ module Vagrant
7
7
  end
8
8
 
9
9
  def call(env)
10
- FileUtils.mkdir_p(env[:vm].config.serial.sockets_path) if !File.directory?(env[:vm].config.serial.sockets_path)
10
+ if env[:vm].config.serial.set?
11
+ FileUtils.mkdir_p(env[:vm].config.serial.sockets_path) if !File.directory?(env[:vm].config.serial.sockets_path)
11
12
 
12
- if env[:vm].config.serial.forward_com1
13
- `/sbin/start-stop-daemon --quiet --start --pidfile #{env[:vm].config.serial.sockets_path}/socat.#{env[:vm].uuid}-com1.pid --background --make-pidfile --exec /usr/bin/socat -- tcp-l:#{env[:vm].config.serial.forward_com1},reuseaddr,fork UNIX-CONNECT:#{env[:vm].config.serial.sockets_path}/#{env[:vm].uuid}-com1`
14
- end
13
+ if env[:vm].config.serial.forward_com1
14
+ `/sbin/start-stop-daemon --quiet --start --pidfile #{env[:vm].config.serial.sockets_path}/socat.#{env[:vm].uuid}-com1.pid --background --make-pidfile --exec /usr/bin/socat -- tcp-l:#{env[:vm].config.serial.forward_com1},reuseaddr,fork UNIX-CONNECT:#{env[:vm].config.serial.sockets_path}/#{env[:vm].uuid}-com1`
15
+ end
15
16
 
16
- if env[:vm].config.serial.forward_com2
17
- `/sbin/start-stop-daemon --quiet --start --pidfile #{env[:vm].config.serial.sockets_path}/socat.#{env[:vm].uuid}-com2.pid --background --make-pidfile --exec /usr/bin/socat -- tcp-l:#{env[:vm].config.serial.forward_com2},reuseaddr,fork UNIX-CONNECT:#{env[:vm].config.serial.sockets_path}/#{env[:vm].uuid}-com2`
17
+ if env[:vm].config.serial.forward_com2
18
+ `/sbin/start-stop-daemon --quiet --start --pidfile #{env[:vm].config.serial.sockets_path}/socat.#{env[:vm].uuid}-com2.pid --background --make-pidfile --exec /usr/bin/socat -- tcp-l:#{env[:vm].config.serial.forward_com2},reuseaddr,fork UNIX-CONNECT:#{env[:vm].config.serial.sockets_path}/#{env[:vm].uuid}-com2`
19
+ end
18
20
  end
19
21
 
20
22
  @app.call(env)
@@ -1,5 +1,5 @@
1
1
  module Vagrant
2
2
  module Serial
3
- VERSION = "0.0.15"
3
+ VERSION = "0.0.16"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-serial
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: