spsclient_m2m 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/spsclient_m2m.rb +51 -32
- metadata +22 -22
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3215e94778d97380fb91eaadbc0ba55cd630593
|
4
|
+
data.tar.gz: 585c29648c9724beef8b8a7629103f4c72d7e4f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46c19b009809ffa210f8d1380c92a3e246d8097ae2b62c292d0c24b69bc584293bf38691f4082007fcea5ef97c1e9e39781c6a69ffbea1f59d71304fb69c1aa8
|
7
|
+
data.tar.gz: c496a5a4ced246539875c2b879f77a5c2eca5df2440818b9b9e0fd0748352d5cd68030eb0241d231f81d7c23fccbc2712ee2651b466fb46e7c2f6378ebda6925
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/spsclient_m2m.rb
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
# file: spsclient_m2m.rb
|
4
4
|
|
5
5
|
|
6
|
-
require 'logger'
|
7
6
|
require 'polyrex'
|
8
7
|
require 'spstrigger_execute'
|
9
8
|
require 'sps-sub'
|
@@ -11,44 +10,55 @@ require 'sps-sub'
|
|
11
10
|
|
12
11
|
class SPSClientM2M
|
13
12
|
|
14
|
-
def initialize(rsc, reg, keywords, px_url,
|
13
|
+
def initialize(rsc, reg, keywords, px_url, log: nil, \
|
15
14
|
sps_host: 'sps', sps_port: '59000', topic: '#',
|
16
15
|
reload_keyword: /^reload$/)
|
17
16
|
|
18
|
-
@rsc = rsc
|
19
|
-
|
20
|
-
|
21
|
-
@sps_address = "%s:%s" % [sps_host, sps_port]
|
22
|
-
@topic = topic
|
17
|
+
@rsc, @log, @topic = rsc, log, topic
|
18
|
+
|
19
|
+
log.info 'SPSCLientM2M/initialize: active' if log
|
23
20
|
|
24
|
-
@
|
21
|
+
@sps_address = "%s:%s" % [sps_host, sps_port]
|
22
|
+
@sps = SPSSub.new host: sps_host, port: sps_port, log: log
|
25
23
|
|
26
24
|
px = Polyrex.new px_url
|
27
25
|
|
28
|
-
|
29
|
-
@
|
26
|
+
log.info 'SPSCLientM2M/initialize: before @ste' if log
|
27
|
+
@ste = SPSTriggerExecute.new keywords, reg, px, log: log
|
28
|
+
log.info 'SPSCLientM2M/initialize: after @ste' if log
|
29
|
+
@keywords, @reload_keyword, @reg = keywords, reload_keyword, reg
|
30
30
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def run()
|
34
34
|
|
35
|
-
|
36
|
-
ste = @ste
|
37
|
-
keywords = @keywords
|
35
|
+
log.info 'SPSCLientM2M/run: active' if log
|
38
36
|
|
39
|
-
@
|
37
|
+
rsc, ste, keywords, reg, reload_keyword = @rsc, @ste, @keywords, @reg,
|
38
|
+
@reload_keyword
|
40
39
|
|
41
|
-
|
40
|
+
@sps.subscribe(topic: @topic) do |raw_message, topic|
|
41
|
+
|
42
|
+
log.info 'SPSCLientM2M/run: received something' if log
|
43
|
+
|
44
|
+
if reg and topic == 'system/clock' then
|
45
|
+
reg.set_key 'hkey_services/spsclient_m2m/last_seen',
|
46
|
+
"#%s#" % Time.now.to_s
|
47
|
+
end
|
48
|
+
|
49
|
+
if raw_message.strip =~ reload_keyword then
|
50
|
+
|
51
|
+
log.info 'SPSClientM2M/run: reloading' if log
|
52
|
+
ste = SPSTriggerExecute.new keywords, reg=nil, px=nil, log: log
|
42
53
|
|
43
|
-
puts 'reloading'
|
44
|
-
ste = SPSTriggerExecute.new keywords, reg=nil, px=nil, logfile: 'ste.log'
|
45
54
|
end
|
46
55
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
56
|
+
if log then
|
57
|
+
log.info "SPSClientM2M/run: received %s: %s" % [topic, raw_message]
|
58
|
+
end
|
59
|
+
|
60
|
+
a = ste.mae topic: topic, message: raw_message
|
61
|
+
log.info 'SPSClientM2M/run: a: ' + a.inspect if log
|
52
62
|
|
53
63
|
# obj is the DRb object, r is the result from find_match,
|
54
64
|
# a is the Dynarex lookup array
|
@@ -63,12 +73,18 @@ class SPSClientM2M
|
|
63
73
|
package_path = x.shift
|
64
74
|
package = package_path[/([^\/]+)\.rsf$/,1]
|
65
75
|
|
66
|
-
log
|
67
|
-
|
76
|
+
if log then
|
77
|
+
log.info "SPSClientM2M/run: job: %s path: %s package: %s" % \
|
78
|
+
[job, package_path, package]
|
79
|
+
end
|
80
|
+
|
68
81
|
rsc.run_job package, job, {}, args=x, package_path: package_path
|
69
82
|
},
|
70
83
|
sps: ->(x, rsc){ @sps.notice x },
|
71
|
-
ste: ->(x, rsc){
|
84
|
+
ste: ->(x, rsc){
|
85
|
+
log.info 'SPSClientM2M/run: before ste run' if log
|
86
|
+
ste.run x
|
87
|
+
}
|
72
88
|
}
|
73
89
|
|
74
90
|
end
|
@@ -80,11 +96,13 @@ class SPSClientM2M
|
|
80
96
|
Thread.new do
|
81
97
|
|
82
98
|
begin
|
99
|
+
|
83
100
|
h[type].call x, rsc
|
84
101
|
rescue
|
85
|
-
|
86
|
-
|
87
|
-
log
|
102
|
+
|
103
|
+
err_msg = 'SPSClientM2M/run/error: ' + ($!).inspect
|
104
|
+
log ? log.debug(err_msg) : puts(err_msg)
|
105
|
+
|
88
106
|
end
|
89
107
|
|
90
108
|
end # /thread
|
@@ -96,10 +114,11 @@ class SPSClientM2M
|
|
96
114
|
end
|
97
115
|
|
98
116
|
end
|
99
|
-
|
117
|
+
|
100
118
|
private
|
101
119
|
|
102
|
-
def log(
|
103
|
-
@log
|
120
|
+
def log()
|
121
|
+
@log
|
104
122
|
end
|
105
|
-
|
123
|
+
|
124
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spsclient_m2m
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -12,26 +12,26 @@ cert_chain:
|
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
|
14
14
|
YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
|
15
|
-
|
15
|
+
8ixkARkWAmV1MB4XDTE3MTAyOTEwMjY1NVoXDTE4MTAyOTEwMjY1NVowSDESMBAG
|
16
16
|
A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
|
17
17
|
EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
18
|
+
ggEBALk1PKr5eDSSMvprWKGzDShs3AezUuY8dAR1KFuqvlh7qgb6mFhrMS98A92C
|
19
|
+
lJ1V3cf13jiVmxHCn/U9kQsBWqBpBWqnSQJn4eZfN5XqVjPSiL9l+jLiawInI5Zz
|
20
|
+
eRQFYiVMJexRzPucufk4YB05WGhOjLiHZ3/JicbxHIujkdv3oTh09XnmzvjNn75i
|
21
|
+
6uBuPVoPrEAzxRdc3nTAE4e7UdBuwHlctuytfjFGNK6+ZglwSqhx/xB5H4Mz8ueN
|
22
|
+
WYgbRtvvLHV4D2FxMkxTnSR4tnixG2ftD1i/Y4fGnNKVBC1MbJaR9jFyRT44p4Cf
|
23
|
+
VfHaf9g5UAO81wt+O0WMWzQTkbsCAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
|
24
|
+
DwQEAwIEsDAdBgNVHQ4EFgQUDU7oTCjxZxmATPTztkx719h58D4wJgYDVR0RBB8w
|
25
25
|
HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
26
|
+
c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAAAgXVhPr
|
27
|
+
b+7OF5FlfBUOU2RMYyw4F9Ti4LKhu14SArIrVfdo6jCVy2GPWS/xjkb9ObRaKqny
|
28
|
+
ForrpEshHHTmnHKHrh9mCk4axZHNRkDsjeLOoXSRcJOOvLpLhN2ynp5gFeBGHDo3
|
29
|
+
FrmY/HMIPMGvTRuO1/I/74YIDU+Y0HJrbeh7btmPu+okxKT2qjjMClCoc2IVFWbe
|
30
|
+
VKWtMHdDKH9Lr1X7T6iMMX7Om6P0MLfcEhdTUIv+hXCaj5hzE+S/9FAHqu18S+/w
|
31
|
+
dBXn9TUi+xrV99j23F6po2HBGSFZdaNVFl9d+1zL8TzksvvfSxoxQWf3cCHRxQxa
|
32
|
+
dPHfn+8RHWvT5A==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2017-
|
34
|
+
date: 2017-10-29 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: polyrex
|
@@ -62,7 +62,7 @@ dependencies:
|
|
62
62
|
version: '0.4'
|
63
63
|
- - ">="
|
64
64
|
- !ruby/object:Gem::Version
|
65
|
-
version: 0.4.
|
65
|
+
version: 0.4.7
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
68
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -72,7 +72,7 @@ dependencies:
|
|
72
72
|
version: '0.4'
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.4.
|
75
|
+
version: 0.4.7
|
76
76
|
- !ruby/object:Gem::Dependency
|
77
77
|
name: sps-sub
|
78
78
|
requirement: !ruby/object:Gem::Requirement
|
@@ -82,7 +82,7 @@ dependencies:
|
|
82
82
|
version: '0.3'
|
83
83
|
- - ">="
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version: 0.3.
|
85
|
+
version: 0.3.6
|
86
86
|
type: :runtime
|
87
87
|
prerelease: false
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -92,7 +92,7 @@ dependencies:
|
|
92
92
|
version: '0.3'
|
93
93
|
- - ">="
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: 0.3.
|
95
|
+
version: 0.3.6
|
96
96
|
description:
|
97
97
|
email: james@jamesrobertson.eu
|
98
98
|
executables: []
|
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
120
|
version: '0'
|
121
121
|
requirements: []
|
122
122
|
rubyforge_project:
|
123
|
-
rubygems_version: 2.6.
|
123
|
+
rubygems_version: 2.6.13
|
124
124
|
signing_key:
|
125
125
|
specification_version: 4
|
126
126
|
summary: The SPSClient_M2M gem is designed to run as a service with the RSF_Services
|
metadata.gz.sig
CHANGED
Binary file
|