synapse 0.14.4 → 0.14.5
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.
- checksums.yaml +4 -4
- data/lib/synapse/config_generator/file_output.rb +2 -1
- data/lib/synapse/version.rb +1 -1
- data/spec/lib/synapse/file_output_spec.rb +16 -3
- 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: 591cea7bfd006aec1c360b1608922c2f8bb4cfb7
|
4
|
+
data.tar.gz: 3fc33d1a16e730badca18998865c308c425a8925
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12ae9ce7e0b50e89f4238f2014c93e15d3aab24f2485f2ef11d463905c4a781ca908189c76566a69768f8f52536f3cd829e95f9a2687ee9261d001f933e895f4
|
7
|
+
data.tar.gz: 7ce91f1ba73195adeb8e17a251f0e04809718035f8bf2d1b7697d3779971fa8f6241a20dde29cdffea7c1957f4e96c161b9c384317bfe24188c4347cd3fc790f
|
@@ -68,7 +68,8 @@ class Synapse::ConfigGenerator
|
|
68
68
|
# Cleanup old services that Synapse no longer manages
|
69
69
|
FileUtils.cd(opts['output_directory']) do
|
70
70
|
present_files = Dir.glob('*.json')
|
71
|
-
|
71
|
+
managed_watchers = current_watchers.reject {|watcher| watcher.config_for_generator[name]['disabled']}
|
72
|
+
managed_files = managed_watchers.collect {|watcher| "#{watcher.name}.json"}
|
72
73
|
files_to_purge = present_files.select {|svc| not managed_files.include?(svc)}
|
73
74
|
log.info "synapse: purging unknown service files #{files_to_purge}" if files_to_purge.length > 0
|
74
75
|
FileUtils.rm(files_to_purge)
|
data/lib/synapse/version.rb
CHANGED
@@ -36,6 +36,18 @@ describe Synapse::ConfigGenerator::FileOutput do
|
|
36
36
|
mockWatcher
|
37
37
|
end
|
38
38
|
|
39
|
+
let(:mockwatcher_disabled) do
|
40
|
+
mockWatcher = double(Synapse::ServiceWatcher)
|
41
|
+
allow(mockWatcher).to receive(:name).and_return('disabled_service')
|
42
|
+
backends = [{ 'host' => 'somehost', 'port' => 1234}]
|
43
|
+
allow(mockWatcher).to receive(:backends).and_return(backends)
|
44
|
+
allow(mockWatcher).to receive(:config_for_generator).and_return(
|
45
|
+
{'file_output' => {'disabled' => true}}
|
46
|
+
)
|
47
|
+
allow(mockWatcher).to receive(:revision).and_return(0)
|
48
|
+
mockWatcher
|
49
|
+
end
|
50
|
+
|
39
51
|
it 'updates the config' do
|
40
52
|
expect(subject).to receive(:write_backends_to_file)
|
41
53
|
subject.update_config([mockwatcher_1])
|
@@ -48,13 +60,14 @@ describe Synapse::ConfigGenerator::FileOutput do
|
|
48
60
|
end
|
49
61
|
|
50
62
|
it 'manages correct files' do
|
51
|
-
subject.update_config([mockwatcher_1, mockwatcher_2])
|
63
|
+
subject.update_config([mockwatcher_1, mockwatcher_2, mockwatcher_disabled])
|
52
64
|
FileUtils.cd(config['file_output']['output_directory']) do
|
53
65
|
expect(Dir.glob('*.json').sort).to eql(['example_service.json', 'foobar_service.json'])
|
54
66
|
end
|
55
67
|
# Should clean up after itself
|
56
|
-
subject.update_config([mockwatcher_1])
|
57
68
|
FileUtils.cd(config['file_output']['output_directory']) do
|
69
|
+
FileUtils.touch('disabled_service.json')
|
70
|
+
subject.update_config([mockwatcher_1, mockwatcher_disabled])
|
58
71
|
expect(Dir.glob('*.json')).to eql(['example_service.json'])
|
59
72
|
end
|
60
73
|
# Should clean up after itself
|
@@ -67,7 +80,7 @@ describe Synapse::ConfigGenerator::FileOutput do
|
|
67
80
|
it 'writes correct content' do
|
68
81
|
subject.update_config([mockwatcher_1])
|
69
82
|
data_path = File.join(config['file_output']['output_directory'],
|
70
|
-
|
83
|
+
'example_service.json')
|
71
84
|
old_backends = JSON.load(File.read(data_path))
|
72
85
|
expect(old_backends.length).to eql(1)
|
73
86
|
expect(old_backends.first['host']).to eql('somehost')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: synapse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.14.
|
4
|
+
version: 0.14.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Rhoads
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-04-
|
13
|
+
date: 2017-04-14 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: aws-sdk
|