rubysdk 0.0.1.pre2 → 0.0.1.pre3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rubysdk.rb +8 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea5938a9b099b67aeb5149413a472d157b152e9c592cbc2c525ba19a7ccafcbe
|
4
|
+
data.tar.gz: a3494af531353b4571b26b1bfbd5e037015ea9ad9ccc34a632a2c490bb68cc58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d65bda402f49c51ddb493b9808320e44f07f2455ed316b0378cd52a5fc5fe29ccf6834c2a073b8602dbed8c5c06b3bfeed4ba30163c2eeb7c122e12d47e4bad
|
7
|
+
data.tar.gz: e5c77d6ad58a0a1365b9042d8202421a4e7406891ccd2ce94a2d9607d9bc08e0f532162a655939a19614ab713558db1f91129f310337fdcdb06a6a2bdb08f703
|
data/lib/rubysdk.rb
CHANGED
@@ -28,7 +28,7 @@ module RubySDK
|
|
28
28
|
cjob = cached_job unless cached_job.unique_id == job.unique_id
|
29
29
|
end
|
30
30
|
if cjob == nil
|
31
|
-
JobResult.new(failed: true,
|
31
|
+
Proto::JobResult.new(failed: true,
|
32
32
|
exit_pipeline: true,
|
33
33
|
message: "job not found in plugin " + job.title)
|
34
34
|
return
|
@@ -43,7 +43,7 @@ module RubySDK
|
|
43
43
|
end
|
44
44
|
|
45
45
|
# Execute job
|
46
|
-
job_result = JobResult.new
|
46
|
+
job_result = Proto::JobResult.new
|
47
47
|
begin
|
48
48
|
job.handler.call(args)
|
49
49
|
rescue => e
|
@@ -62,8 +62,6 @@ module RubySDK
|
|
62
62
|
# Serve caches the given jobs and starts the gRPC server.
|
63
63
|
# This function should be last called in the plugin main function.
|
64
64
|
def Serve(jobs)
|
65
|
-
include Interface
|
66
|
-
|
67
65
|
# Cache the jobs for later processing.
|
68
66
|
# We have to transform given jobs into suitable proto models.
|
69
67
|
cached_jobs = []
|
@@ -71,7 +69,7 @@ module RubySDK
|
|
71
69
|
# Transform manual interaction
|
72
70
|
manual_interaction = nil
|
73
71
|
if job.interaction != nil
|
74
|
-
manual_interaction = ManualInteraction.new(description: job.interaction.desc,
|
72
|
+
manual_interaction = Interface::ManualInteraction.new(description: job.interaction.desc,
|
75
73
|
type: job.interaction.type,
|
76
74
|
value: job.interaction.value)
|
77
75
|
end
|
@@ -114,7 +112,7 @@ module RubySDK
|
|
114
112
|
end
|
115
113
|
|
116
114
|
# Create wrapper object
|
117
|
-
wrapper_job = JobsWrapper.new(handler: job.handler,
|
115
|
+
wrapper_job = Interface::JobsWrapper.new(handler: job.handler,
|
118
116
|
job: proto_job)
|
119
117
|
cached_jobs.push wrapper_job
|
120
118
|
end
|
@@ -122,11 +120,11 @@ module RubySDK
|
|
122
120
|
# Check if two jobs have the same title which is restricted.
|
123
121
|
#dup_map = {}
|
124
122
|
cached_jobs.each do |job|
|
125
|
-
|
123
|
+
dup_map[job.job.unique_id] = (map[job.job.unique_id] || 0) + 1
|
126
124
|
|
127
|
-
|
128
|
-
|
129
|
-
|
125
|
+
if dup_map[job.job.unique_id] > 1
|
126
|
+
raise "duplicate job with the title #{job.title} found which is not allowed"
|
127
|
+
end
|
130
128
|
end
|
131
129
|
|
132
130
|
# Get certificates path from env variables.
|