canals 0.8.6 → 0.8.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/canals/cli/helpers.rb +5 -0
- data/lib/canals/core.rb +7 -2
- data/lib/canals/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2179ce68e3cee069eb408e8c56e62f1d337d4d1d
|
4
|
+
data.tar.gz: 4ab74cae9daa9230751e6d97268047eee0a8ee60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 734ff1e2b875610c63750e3fcc41d2249bd962ea126ac1b8b0348949fe053879c9e5f54409727fd3816cd3a0d2fa32008f2b947d32cb066bbdcc4690f898bce7
|
7
|
+
data.tar.gz: 7c21330f7e538c8d12f73c52f0cd21814b6e5686bfa8f0ca47aa826da35962d41048a4a38b2e5bc52d8f8fe1612ff506dae394e31ff6f5a2092f12a05a7a4ed0
|
data/lib/canals/cli/helpers.rb
CHANGED
@@ -16,6 +16,11 @@ module Canals
|
|
16
16
|
tunnel = Canals.repository.get(name)
|
17
17
|
say "Created tunnel #{name.inspect} with pid #{pid}. You can access it using '#{tunnel.bind_address}:#{tunnel.local_port}'"
|
18
18
|
pid
|
19
|
+
rescue Canals::Exception => e
|
20
|
+
tunnel = Canals.repository.get(name)
|
21
|
+
isalive = Canals.isalive? tunnel
|
22
|
+
say "Unable to create tunnel #{name.inspect}#{isalive ? ', A tunnel for ' + name.inspect + ' Already exists.' : ''}", :red
|
23
|
+
0
|
19
24
|
end
|
20
25
|
|
21
26
|
def trestart(name)
|
data/lib/canals/core.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
require 'open3'
|
2
2
|
|
3
3
|
module Canals
|
4
|
+
|
5
|
+
class Exception < ::RuntimeError; end
|
6
|
+
|
4
7
|
class << self
|
5
8
|
|
6
9
|
def create_tunnel(tunnel_opts)
|
@@ -11,7 +14,8 @@ module Canals
|
|
11
14
|
if tunnel_opts.instance_of? String
|
12
15
|
tunnel_opts = Canals.repository.get(tunnel_opts)
|
13
16
|
end
|
14
|
-
tunnel_start(tunnel_opts)
|
17
|
+
exit_code = tunnel_start(tunnel_opts)
|
18
|
+
raise Canals::Exception, "could not start tunnel" unless exit_code.success?
|
15
19
|
pid = tunnel_pid(tunnel_opts)
|
16
20
|
Canals.session.add({name: tunnel_opts.name, pid: pid, socket: socket_file(tunnel_opts)})
|
17
21
|
pid.to_i
|
@@ -45,8 +49,9 @@ module Canals
|
|
45
49
|
|
46
50
|
def tunnel_start(tunnel_opts)
|
47
51
|
FileUtils.mkdir_p("/tmp/canals")
|
48
|
-
cmd = "ssh -M -S #{socket_file(tunnel_opts)} -fnNT -L #{tunnel_opts.bind_address}:#{tunnel_opts.local_port}:#{tunnel_opts.remote_host}:#{tunnel_opts.remote_port} #{tunnel_opts.proxy}"
|
52
|
+
cmd = "ssh -M -S #{socket_file(tunnel_opts)} -o 'ExitOnForwardFailure yes' -fnNT -L #{tunnel_opts.bind_address}:#{tunnel_opts.local_port}:#{tunnel_opts.remote_host}:#{tunnel_opts.remote_port} #{tunnel_opts.proxy}"
|
49
53
|
system(cmd)
|
54
|
+
$?
|
50
55
|
end
|
51
56
|
|
52
57
|
def tunnel_check(tunnel_opts)
|
data/lib/canals/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: canals
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ido Abramovich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|