Skip to content

Commit db3eabf

Browse files
committed
Fixes #30731 - Make smart-proxy use SdNotify library
1 parent a644146 commit db3eabf

File tree

5 files changed

+4
-103
lines changed

5 files changed

+4
-103
lines changed

lib/launcher.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
require 'proxy/log'
2-
require 'proxy/sd_notify'
32
require 'proxy/settings'
43
require 'proxy/signal_handler'
54
require 'proxy/log_buffer/trace_decorator'
5+
require 'sd_notify'
66

77
CIPHERS = ['ECDHE-RSA-AES128-GCM-SHA256', 'ECDHE-RSA-AES256-GCM-SHA384',
88
'AES128-GCM-SHA256', 'AES256-GCM-SHA384', 'AES128-SHA256',
@@ -212,7 +212,7 @@ def install_webrick_callback!(*apps)
212212

213213
def launched(apps)
214214
logger.info("Smart proxy has launched on #{apps.size} socket(s), waiting for requests")
215-
Proxy::SdNotify.new.tap { |sd| sd.ready if sd.active? }
215+
SdNotify.ready
216216
end
217217
end
218218
end

lib/proxy/sd_notify.rb

Lines changed: 0 additions & 30 deletions
This file was deleted.

smart_proxy.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Gem::Specification.new do |s|
1616
s.add_dependency 'json'
1717
s.add_dependency 'logging'
1818
s.add_dependency 'rack', '>= 1.3'
19+
s.add_dependency 'sd_notify', '~> 0.1'
1920
s.add_dependency 'sinatra'
2021
s.description = <<~EOF
2122
Foreman Proxy is used via The Foreman Project, it allows Foreman to manage

test/launcher_test.rb

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,7 @@ def test_install_webrick_callback
5252

5353
def test_launched_with_sdnotify
5454
@launcher.logger.expects(:info).with(includes('2 socket(s)'))
55-
sd_notify = mock('SdNotify')
56-
sd_notify.expects(:active?).returns(true)
57-
sd_notify.expects(:ready)
58-
Proxy::SdNotify.expects(:new).returns(sd_notify)
59-
@launcher.launched([:app1, :app2])
60-
end
61-
62-
def test_launched_with_sdnotify_inactive
63-
@launcher.logger.expects(:info).with(includes('2 socket(s)'))
64-
sd_notify = mock('SdNotify')
65-
sd_notify.expects(:active?).returns(false)
66-
sd_notify.expects(:ready).never
67-
Proxy::SdNotify.expects(:new).returns(sd_notify)
55+
::SdNotify.expects(:ready)
6856
@launcher.launched([:app1, :app2])
6957
end
7058
end

test/sd_notify_test.rb

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)