ts-admin 0.2.0 → 0.2.1

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: a38d80d69b3c2bbae9e237d74acf92504366ce6a
4
- data.tar.gz: e84f8bf4205e3ed0120aeeb2534f8501c53cccea
3
+ metadata.gz: 2fba606ded7a3826b1ea2cbddda05bcc19ca2b7a
4
+ data.tar.gz: 26a47753ba7cec3e7d728240abd0390472b4a519
5
5
  SHA512:
6
- metadata.gz: 443bd6c4b09851e653eaf1fa7d097c39c03d08b792e22b5a7b765b8ebc71b4248f6221c2a3332d6ec66e024dc035d85c78027f67b711cdc39b42a65489f4c6b0
7
- data.tar.gz: f6700bed37709a9d606bbcfd7be7720969f07ebbf0a93f4ac641f3f1a690b73632160fd56c2f3fe5f8124ee7e8821d520c043de0b5b42b2150eefaae580f75c9
6
+ metadata.gz: 7a69c6c728475b1ae22528aefeee9b5e4e60d15b1aa5a31592c53c71234a3819e54a156ec746146f1ff8fa1465345a57e72353b672f8bcd3b845c3544dc63b9e
7
+ data.tar.gz: e46c5591f92b31f669be887730da8cd0ec9ec13daad649dad8d80ab7b5cc7baf299006e18c58ea3109a7defbc88788a5906b832653f27a57f01ee833cc337f2b
@@ -46,6 +46,17 @@ class Controller < Ramaze::Controller
46
46
  @_traffic_server ||= ::TSAdmin::TrafficServer.new(APP_CONFIG['traffic_server'])
47
47
  end
48
48
 
49
+ def restart_traffic_server
50
+ @@restart_scheduled = true
51
+ @@restart_thread = Thread.new do
52
+ while @@restart_scheduled
53
+ @@restart_scheduled = false
54
+ traffic_server.restart
55
+ end
56
+ @@restart_thread = nil
57
+ end if !defined?(@@restart_thread) || @@restart_thread.nil?
58
+ end
59
+
49
60
  end
50
61
 
51
62
  # Here you can require all your other controllers. Note that if you have multiple
@@ -4,7 +4,7 @@ class MainController < Controller
4
4
  return unless login_required
5
5
 
6
6
  external_ip_fallback = '<span class="none">none</span>'
7
- @external_ip = (APP_CONFIG['info']['external_ip2'] || external_ip_fallback) rescue external_ip_fallback
7
+ @external_ip = (APP_CONFIG['info']['external_ip'] || external_ip_fallback) rescue external_ip_fallback
8
8
  end
9
9
 
10
10
  end
@@ -16,7 +16,7 @@ class RemapController < Controller
16
16
  @to = request[:to]
17
17
  if traffic_server.add_remap(@type, @from, @to)
18
18
  traffic_server.save
19
- traffic_server.restart
19
+ restart_traffic_server
20
20
  flash[:info] = "Remap entry added"
21
21
  call(r('/'))
22
22
  else
@@ -39,7 +39,7 @@ class RemapController < Controller
39
39
  @to = request[:to]
40
40
  if traffic_server.edit_remap(@id, @from, @to)
41
41
  traffic_server.save
42
- traffic_server.restart
42
+ restart_traffic_server
43
43
  flash[:info] = "Remap entry updated"
44
44
  call(r('/'))
45
45
  else
@@ -61,7 +61,7 @@ class RemapController < Controller
61
61
 
62
62
  traffic_server.delete_remap(request[:id])
63
63
  traffic_server.save
64
- traffic_server.restart
64
+ restart_traffic_server
65
65
 
66
66
  flash[:info] = "Remap entry removed"
67
67
 
@@ -71,10 +71,12 @@ module TSAdmin
71
71
  own_config = ''
72
72
  own_config << "#{marker_begin}\n"
73
73
  redirects.each do |redirect|
74
- own_config << "redirect #{redirect[:from]} #{redirect[:to]} #{redirect[:options] if redirect[:options]}\n"
74
+ options = redirect[:options] ? '' : ''
75
+ own_config << "redirect #{redirect[:from]} #{redirect[:to]} #{options}\n"
75
76
  end
76
77
  maps.each do |map|
77
- own_config << "map #{map[:from]} #{map[:to]} #{map[:options] if map[:options]}\n"
78
+ options = map[:options] ? '' : ''
79
+ own_config << "map #{map[:from]} #{map[:to]} #{options}\n"
78
80
  end
79
81
  own_config << "#{marker_end}\n"
80
82
 
@@ -1,3 +1,3 @@
1
1
  module TSAdmin
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ts-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Schwab