openc3 5.20.0 → 6.0.0
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/bin/openc3cli +12 -120
- data/data/config/command_modifiers.yaml +13 -1
- data/data/config/interface_modifiers.yaml +21 -4
- data/data/config/item_modifiers.yaml +1 -1
- data/data/config/microservice.yaml +15 -2
- data/data/config/param_item_modifiers.yaml +1 -1
- data/data/config/parameter_modifiers.yaml +1 -1
- data/data/config/table_manager.yaml +2 -2
- data/data/config/target.yaml +11 -0
- data/data/config/telemetry_modifiers.yaml +17 -1
- data/data/config/tool.yaml +12 -0
- data/data/config/widgets.yaml +13 -17
- data/lib/openc3/accessors/form_accessor.rb +4 -3
- data/lib/openc3/accessors/html_accessor.rb +3 -3
- data/lib/openc3/accessors/http_accessor.rb +13 -13
- data/lib/openc3/accessors/xml_accessor.rb +16 -4
- data/lib/openc3/api/target_api.rb +0 -30
- data/lib/openc3/config/config_parser.rb +6 -3
- data/lib/openc3/core_ext/array.rb +0 -16
- data/lib/openc3/core_ext.rb +0 -1
- data/lib/openc3/interfaces/file_interface.rb +198 -0
- data/lib/openc3/interfaces/http_client_interface.rb +71 -39
- data/lib/openc3/interfaces/http_server_interface.rb +0 -7
- data/lib/openc3/interfaces/interface.rb +2 -0
- data/lib/openc3/interfaces/mqtt_interface.rb +32 -15
- data/lib/openc3/interfaces/mqtt_stream_interface.rb +19 -4
- data/lib/openc3/interfaces/protocols/crc_protocol.rb +7 -0
- data/lib/openc3/interfaces/serial_interface.rb +1 -0
- data/lib/openc3/interfaces.rb +2 -4
- data/lib/openc3/microservices/multi_microservice.rb +3 -3
- data/lib/openc3/migrations/20241208080000_no_critical_cmd.rb +31 -0
- data/lib/openc3/migrations/20241208080001_no_trigger_group.rb +46 -0
- data/lib/openc3/models/interface_model.rb +9 -3
- data/lib/openc3/models/microservice_model.rb +8 -1
- data/lib/openc3/models/plugin_model.rb +6 -1
- data/lib/openc3/models/python_package_model.rb +6 -1
- data/lib/openc3/models/reaction_model.rb +14 -10
- data/lib/openc3/models/scope_model.rb +60 -42
- data/lib/openc3/models/target_model.rb +17 -1
- data/lib/openc3/models/timeline_model.rb +17 -5
- data/lib/openc3/models/tool_model.rb +15 -3
- data/lib/openc3/models/trigger_group_model.rb +6 -3
- data/lib/openc3/operators/microservice_operator.rb +8 -0
- data/lib/openc3/packets/commands.rb +17 -6
- data/lib/openc3/packets/limits.rb +0 -12
- data/lib/openc3/packets/packet.rb +1 -1
- data/lib/openc3/packets/packet_item.rb +30 -36
- data/lib/openc3/packets/structure_item.rb +2 -2
- data/lib/openc3/script/script.rb +0 -10
- data/lib/openc3/script/web_socket_api.rb +2 -2
- data/lib/openc3/streams/mqtt_stream.rb +41 -33
- data/lib/openc3/streams/serial_stream.rb +27 -27
- data/lib/openc3/streams/stream.rb +17 -17
- data/lib/openc3/streams/tcpip_client_stream.rb +1 -1
- data/lib/openc3/streams/tcpip_socket_stream.rb +19 -19
- data/lib/openc3/system/system.rb +1 -1
- data/lib/openc3/system.rb +2 -3
- data/lib/openc3/tools/table_manager/table.rb +2 -2
- data/lib/openc3/tools/table_manager/table_parser.rb +1 -1
- data/lib/openc3/top_level.rb +0 -5
- data/lib/openc3/topics/command_decom_topic.rb +0 -7
- data/lib/openc3/utilities/bucket_utilities.rb +1 -1
- data/lib/openc3/utilities/cli_generator.rb +0 -1
- data/lib/openc3/version.rb +6 -6
- data/templates/plugin/README.md +1 -1
- data/templates/target/targets/TARGET/lib/target.rb +1 -1
- data/templates/tool_angular/package.json +8 -8
- data/templates/tool_angular/src/app/app.component.html +4 -13
- data/templates/tool_angular/src/app/app.component.scss +5 -13
- data/templates/tool_angular/src/app/app.component.ts +5 -4
- data/templates/tool_angular/src/app/custom-overlay-container.ts +2 -2
- data/templates/tool_angular/src/app/openc3-api.d.ts +1 -1
- data/templates/tool_angular/src/main.single-spa.ts +1 -1
- data/templates/tool_react/package.json +1 -0
- data/templates/tool_react/src/root.component.js +1 -1
- data/templates/tool_svelte/package.json +11 -9
- data/templates/tool_svelte/rollup.config.js +2 -0
- data/templates/tool_svelte/src/App.svelte +2 -2
- data/templates/tool_vue/eslint.config.mjs +68 -0
- data/templates/tool_vue/jsconfig.json +1 -1
- data/templates/tool_vue/package.json +26 -43
- data/templates/tool_vue/src/App.vue +3 -5
- data/templates/tool_vue/src/main.js +12 -23
- data/templates/tool_vue/src/router.js +19 -18
- data/templates/tool_vue/src/tools/tool_name/tool_name.vue +2 -2
- data/templates/tool_vue/vite.config.js +52 -0
- data/templates/widget/package.json +19 -26
- data/templates/widget/src/Widget.vue +13 -15
- data/templates/widget/vite.config.js +26 -0
- metadata +10 -41
- data/lib/openc3/core_ext/hash.rb +0 -40
- data/lib/openc3/core_ext/httpclient.rb +0 -11
- data/lib/openc3/interfaces/linc_interface.rb +0 -480
- data/lib/openc3/interfaces/protocols/override_protocol.rb +0 -4
- data/lib/openc3/microservices/critical_cmd_microservice.rb +0 -74
- data/lib/openc3/microservices/reaction_microservice.rb +0 -607
- data/lib/openc3/microservices/timeline_microservice.rb +0 -398
- data/lib/openc3/microservices/trigger_group_microservice.rb +0 -698
- data/lib/openc3/migrations/20230615000000_autonomic.rb +0 -86
- data/lib/openc3/migrations/20240915000000_activity_uuid.rb +0 -28
- data/lib/openc3/migrations/20241016000000_scope_critical_cmd.rb +0 -24
- data/lib/openc3/system/system_config.rb +0 -413
- data/templates/tool_svelte/src/services/api.js +0 -92
- data/templates/tool_svelte/src/services/axios.js +0 -85
- data/templates/tool_svelte/src/services/cable.js +0 -65
- data/templates/tool_svelte/src/services/config-parser.js +0 -198
- data/templates/tool_svelte/src/services/openc3-api.js +0 -606
- data/templates/tool_vue/.eslintrc.js +0 -43
- data/templates/tool_vue/babel.config.json +0 -11
- data/templates/tool_vue/vue.config.js +0 -38
- data/templates/widget/.eslintrc.js +0 -43
- data/templates/widget/babel.config.json +0 -11
- data/templates/widget/vue.config.js +0 -28
- /data/templates/tool_vue/{.prettierrc.js → .prettierrc.cjs} +0 -0
- /data/templates/widget/{.prettierrc.js → .prettierrc.cjs} +0 -0
|
@@ -16,14 +16,20 @@
|
|
|
16
16
|
# This file may also be used under the terms of a commercial license
|
|
17
17
|
# if purchased from OpenC3, Inc.
|
|
18
18
|
|
|
19
|
+
# You can quickly setup an unauthenticated MQTT server in Docker with
|
|
20
|
+
# docker run -it -p 1883:1883 eclipse-mosquitto:2.0.15 mosquitto -c /mosquitto-no-auth.conf
|
|
21
|
+
# You can also test against encrypted and authenticated servers at https://test.mosquitto.org/
|
|
22
|
+
|
|
19
23
|
require 'openc3/interfaces/stream_interface'
|
|
20
24
|
require 'openc3/streams/mqtt_stream'
|
|
25
|
+
require 'openc3/config/config_parser'
|
|
21
26
|
|
|
22
27
|
module OpenC3
|
|
23
28
|
class MqttStreamInterface < StreamInterface
|
|
24
29
|
# @param hostname [String] MQTT server to connect to
|
|
25
30
|
# @param port [Integer] MQTT port
|
|
26
|
-
# @param
|
|
31
|
+
# @param write_topic [String] MQTT publish topic
|
|
32
|
+
# @param read_topic [String] MQTT receive topic
|
|
27
33
|
def initialize(hostname, port = 1883, ssl = false, write_topic = nil, read_topic = nil, protocol_type = nil, *protocol_args)
|
|
28
34
|
super(protocol_type, protocol_args)
|
|
29
35
|
@hostname = hostname
|
|
@@ -31,6 +37,7 @@ module OpenC3
|
|
|
31
37
|
@ssl = ConfigParser.handle_true_false(ssl)
|
|
32
38
|
@write_topic = ConfigParser.handle_nil(write_topic)
|
|
33
39
|
@read_topic = ConfigParser.handle_nil(read_topic)
|
|
40
|
+
@ack_timeout = 5.0
|
|
34
41
|
@username = nil
|
|
35
42
|
@password = nil
|
|
36
43
|
@cert = nil
|
|
@@ -47,7 +54,7 @@ module OpenC3
|
|
|
47
54
|
|
|
48
55
|
# Creates a new {SerialStream} using the parameters passed in the constructor
|
|
49
56
|
def connect
|
|
50
|
-
@stream = MqttStream.new(@hostname, @port, @ssl, @write_topic, @read_topic)
|
|
57
|
+
@stream = MqttStream.new(@hostname, @port, @ssl, @write_topic, @read_topic, @ack_timeout)
|
|
51
58
|
@stream.username = @username if @username
|
|
52
59
|
@stream.password = @password if @password
|
|
53
60
|
@stream.cert = @cert if @cert
|
|
@@ -66,14 +73,22 @@ module OpenC3
|
|
|
66
73
|
def set_option(option_name, option_values)
|
|
67
74
|
super(option_name, option_values)
|
|
68
75
|
case option_name.upcase
|
|
76
|
+
when 'ACK_TIMEOUT'
|
|
77
|
+
@ack_timeout = Float(option_values[0])
|
|
69
78
|
when 'USERNAME'
|
|
70
79
|
@username = option_values[0]
|
|
71
80
|
when 'PASSWORD'
|
|
72
81
|
@password = option_values[0]
|
|
73
82
|
when 'CERT'
|
|
74
|
-
|
|
83
|
+
# CERT must be given as a file
|
|
84
|
+
@cert = Tempfile.new('cert')
|
|
85
|
+
@cert.write(option_values[0])
|
|
86
|
+
@cert.close
|
|
75
87
|
when 'KEY'
|
|
76
|
-
|
|
88
|
+
# KEY must be given as a file
|
|
89
|
+
@key = Tempfile.new('key')
|
|
90
|
+
@key.write(option_values[0])
|
|
91
|
+
@key.close
|
|
77
92
|
when 'CA_FILE'
|
|
78
93
|
# CA_FILE must be given as a file
|
|
79
94
|
@ca_file = Tempfile.new('ca_file')
|
|
@@ -121,6 +121,13 @@ module OpenC3
|
|
|
121
121
|
|
|
122
122
|
@bit_size = bit_size.to_i
|
|
123
123
|
case @bit_size
|
|
124
|
+
when 8
|
|
125
|
+
@pack = (@endianness == :BIG_ENDIAN) ? 'n' : 'v'
|
|
126
|
+
if args.empty?
|
|
127
|
+
@crc = Crc8.new
|
|
128
|
+
else
|
|
129
|
+
@crc = Crc8.new(*args)
|
|
130
|
+
end
|
|
124
131
|
when 16
|
|
125
132
|
@pack = (@endianness == :BIG_ENDIAN) ? 'n' : 'v'
|
|
126
133
|
if args.empty?
|
|
@@ -98,6 +98,7 @@ module OpenC3
|
|
|
98
98
|
|
|
99
99
|
# Supported Options
|
|
100
100
|
# FLOW_CONTROL - Flow control method NONE or RTSCTS. Defaults to NONE
|
|
101
|
+
# DATA_BITS - Number of data bits 5, 6, 7, or 8. Defaults to 8
|
|
101
102
|
def set_option(option_name, option_values)
|
|
102
103
|
super(option_name, option_values)
|
|
103
104
|
case option_name.upcase
|
data/lib/openc3/interfaces.rb
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
# GNU Affero General Public License for more details.
|
|
15
15
|
|
|
16
16
|
# Modified by OpenC3, Inc.
|
|
17
|
-
# All changes Copyright
|
|
17
|
+
# All changes Copyright 2024, OpenC3, Inc.
|
|
18
18
|
# All Rights Reserved
|
|
19
19
|
#
|
|
20
20
|
# This file may also be used under the terms of a commercial license
|
|
@@ -25,15 +25,13 @@ module OpenC3
|
|
|
25
25
|
autoload(:HttpClientInterface, 'openc3/interfaces/http_client_interface.rb')
|
|
26
26
|
autoload(:HttpServerInterface, 'openc3/interfaces/http_server_interface.rb')
|
|
27
27
|
autoload(:MqttInterface, 'openc3/interfaces/mqtt_interface.rb')
|
|
28
|
+
autoload(:MqttStreamInterface, 'openc3/interfaces/mqtt_stream_interface.rb')
|
|
28
29
|
autoload(:StreamInterface, 'openc3/interfaces/stream_interface.rb')
|
|
29
30
|
autoload(:SerialInterface, 'openc3/interfaces/serial_interface.rb')
|
|
30
31
|
autoload(:SimulatedTargetInterface, 'openc3/interfaces/simulated_target_interface.rb')
|
|
31
32
|
autoload(:TcpipClientInterface, 'openc3/interfaces/tcpip_client_interface.rb')
|
|
32
33
|
autoload(:TcpipServerInterface, 'openc3/interfaces/tcpip_server_interface.rb')
|
|
33
34
|
autoload(:UdpInterface, 'openc3/interfaces/udp_interface.rb')
|
|
34
|
-
autoload(:LincInterface, 'openc3/interfaces/linc_interface.rb')
|
|
35
|
-
autoload(:LincHandshakeCommand, 'openc3/interfaces/linc_interface.rb')
|
|
36
|
-
autoload(:LincHandshake, 'openc3/interfaces/linc_interface.rb')
|
|
37
35
|
|
|
38
36
|
autoload(:Protocol, 'openc3/interfaces/protocols/protocol.rb')
|
|
39
37
|
autoload(:BurstProtocol, 'openc3/interfaces/protocols/burst_protocol.rb')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# encoding: ascii-8bit
|
|
2
2
|
|
|
3
|
-
# Copyright
|
|
3
|
+
# Copyright 2024 OpenC3 Inc.
|
|
4
4
|
# All Rights Reserved.
|
|
5
5
|
#
|
|
6
6
|
# This program is free software; you can modify and/or redistribute it
|
|
@@ -36,8 +36,8 @@ module OpenC3
|
|
|
36
36
|
end
|
|
37
37
|
end
|
|
38
38
|
raise "Could not determine class filename from '#{cmd_line}'" unless filename
|
|
39
|
-
OpenC3.set_working_dir(
|
|
40
|
-
|
|
39
|
+
OpenC3.set_working_dir(microservice_model.work_dir) do
|
|
40
|
+
require File.join(microservice_model.work_dir, filename)
|
|
41
41
|
end
|
|
42
42
|
klass = filename.filename_to_class_name.to_class
|
|
43
43
|
klass.run(microservice_model.name)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require 'openc3/utilities/migration'
|
|
2
|
+
require 'openc3/models/scope_model'
|
|
3
|
+
require 'openc3/models/microservice_model'
|
|
4
|
+
|
|
5
|
+
module OpenC3
|
|
6
|
+
class NoCriticalCmd < Migration
|
|
7
|
+
begin
|
|
8
|
+
require 'openc3-enterprise/models/cmd_authority_model'
|
|
9
|
+
require 'openc3-enterprise/models/critical_cmd_model'
|
|
10
|
+
BASE = false
|
|
11
|
+
rescue LoadError
|
|
12
|
+
BASE = true
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.run
|
|
16
|
+
ScopeModel.get_all_models(scope: nil).each do |scope, scope_model|
|
|
17
|
+
model = MicroserviceModel.get_model(name: "#{scope}__CRITICALCMD__#{scope}", scope: scope)
|
|
18
|
+
if BASE # Only remove the critical command model if we're not enterprise
|
|
19
|
+
model.destroy if model
|
|
20
|
+
else
|
|
21
|
+
model.work_dir = '/openc3-enterprise/lib/openc3-enterprise/microservices'
|
|
22
|
+
model.update
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
unless ENV['OPENC3_NO_MIGRATE']
|
|
30
|
+
OpenC3::NoCriticalCmd.run
|
|
31
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
require 'openc3/utilities/migration'
|
|
2
|
+
require 'openc3/models/scope_model'
|
|
3
|
+
require 'openc3/models/microservice_model'
|
|
4
|
+
|
|
5
|
+
module OpenC3
|
|
6
|
+
class NoTriggerGroups < Migration
|
|
7
|
+
begin
|
|
8
|
+
require 'openc3-enterprise/models/cmd_authority_model'
|
|
9
|
+
require 'openc3-enterprise/models/critical_cmd_model'
|
|
10
|
+
BASE = false
|
|
11
|
+
rescue LoadError
|
|
12
|
+
BASE = true
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.run
|
|
16
|
+
MicroserviceModel.get_all_models(scope: 'DEFAULT').each do |microservice_name, microservice_model|
|
|
17
|
+
if microservice_name =~ /__TRIGGER_GROUP__/
|
|
18
|
+
if BASE
|
|
19
|
+
# Only remove the trigger group microservice if we're not enterprise
|
|
20
|
+
microservice_model.destroy
|
|
21
|
+
else
|
|
22
|
+
# Need to update working dir for Enterprise
|
|
23
|
+
microservice_model.work_dir = '/openc3-enterprise/lib/openc3-enterprise/microservices'
|
|
24
|
+
microservice_model.update
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
if microservice_name =~ /__OPENC3__REACTION/
|
|
29
|
+
# Need to update working dir for Enterprise
|
|
30
|
+
microservice_model.work_dir = '/openc3-enterprise/lib/openc3-enterprise/microservices'
|
|
31
|
+
microservice_model.update
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
if microservice_name =~ /__TIMELINE__/
|
|
35
|
+
# Need to update working dir for Enterprise
|
|
36
|
+
microservice_model.work_dir = '/openc3-enterprise/lib/openc3-enterprise/microservices'
|
|
37
|
+
microservice_model.update
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
unless ENV['OPENC3_NO_MIGRATE']
|
|
45
|
+
OpenC3::NoTriggerGroups.run
|
|
46
|
+
end
|
|
@@ -50,6 +50,7 @@ module OpenC3
|
|
|
50
50
|
attr_accessor :work_dir
|
|
51
51
|
attr_accessor :ports
|
|
52
52
|
attr_accessor :prefix
|
|
53
|
+
attr_accessor :shard
|
|
53
54
|
|
|
54
55
|
# NOTE: The following three class methods are used by the ModelController
|
|
55
56
|
# and are reimplemented to enable various Model class methods to work
|
|
@@ -121,6 +122,7 @@ module OpenC3
|
|
|
121
122
|
env: {},
|
|
122
123
|
container: nil,
|
|
123
124
|
prefix: nil,
|
|
125
|
+
shard: 0,
|
|
124
126
|
scope:
|
|
125
127
|
)
|
|
126
128
|
if self.class._get_type == 'INTERFACE'
|
|
@@ -158,6 +160,7 @@ module OpenC3
|
|
|
158
160
|
@env = env
|
|
159
161
|
@container = container
|
|
160
162
|
@prefix = prefix
|
|
163
|
+
@shard = shard.to_i # to_i to handle nil
|
|
161
164
|
@secrets = secrets
|
|
162
165
|
end
|
|
163
166
|
|
|
@@ -222,6 +225,7 @@ module OpenC3
|
|
|
222
225
|
'env' => @env,
|
|
223
226
|
'container' => @container,
|
|
224
227
|
'prefix' => @prefix,
|
|
228
|
+
'shard' => @shard,
|
|
225
229
|
'updated_at' => @updated_at
|
|
226
230
|
}
|
|
227
231
|
end
|
|
@@ -297,9 +301,7 @@ module OpenC3
|
|
|
297
301
|
# Option Name, Secret Name
|
|
298
302
|
@secret_options << [parameters[3], parameters[1]]
|
|
299
303
|
end
|
|
300
|
-
|
|
301
|
-
@secrets[-1] << parameters[4]
|
|
302
|
-
end
|
|
304
|
+
@secrets[-1] << ConfigParser.handle_nil(parameters[4])
|
|
303
305
|
|
|
304
306
|
when 'ENV'
|
|
305
307
|
parser.verify_num_parameters(2, 2, "#{keyword} <Key> <Value>")
|
|
@@ -341,6 +343,9 @@ module OpenC3
|
|
|
341
343
|
parser.verify_num_parameters(1, 1, "#{keyword} <Route Prefix>")
|
|
342
344
|
@prefix = parameters[0]
|
|
343
345
|
|
|
346
|
+
when 'SHARD'
|
|
347
|
+
parser.verify_num_parameters(1, 1, "#{keyword} <Shard Number Starting from 0>")
|
|
348
|
+
@shard = Integer(parameters[0])
|
|
344
349
|
else
|
|
345
350
|
raise ConfigParser::Error.new(parser, "Unknown keyword and parameters for Interface/Router: #{keyword} #{parameters.join(" ")}")
|
|
346
351
|
|
|
@@ -365,6 +370,7 @@ module OpenC3
|
|
|
365
370
|
needs_dependencies: @needs_dependencies,
|
|
366
371
|
secrets: @secrets,
|
|
367
372
|
prefix: @prefix,
|
|
373
|
+
shard: @shard,
|
|
368
374
|
scope: @scope
|
|
369
375
|
)
|
|
370
376
|
unless validate_only
|
|
@@ -44,6 +44,7 @@ module OpenC3
|
|
|
44
44
|
attr_accessor :prefix
|
|
45
45
|
attr_accessor :disable_erb
|
|
46
46
|
attr_accessor :ignore_changes
|
|
47
|
+
attr_accessor :shard
|
|
47
48
|
|
|
48
49
|
# NOTE: The following three class methods are used by the ModelController
|
|
49
50
|
# and are reimplemented to enable various Model class methods to work
|
|
@@ -105,6 +106,7 @@ module OpenC3
|
|
|
105
106
|
prefix: nil,
|
|
106
107
|
disable_erb: nil,
|
|
107
108
|
ignore_changes: nil,
|
|
109
|
+
shard: 0,
|
|
108
110
|
scope:
|
|
109
111
|
)
|
|
110
112
|
parts = name.split("__")
|
|
@@ -131,6 +133,7 @@ module OpenC3
|
|
|
131
133
|
@prefix = prefix
|
|
132
134
|
@disable_erb = disable_erb
|
|
133
135
|
@ignore_changes = ignore_changes
|
|
136
|
+
@shard = shard.to_i # to_i to handle nil
|
|
134
137
|
@bucket = Bucket.getClient()
|
|
135
138
|
end
|
|
136
139
|
|
|
@@ -153,7 +156,8 @@ module OpenC3
|
|
|
153
156
|
'secrets' => @secrets.as_json(*a),
|
|
154
157
|
'prefix' => @prefix,
|
|
155
158
|
'disable_erb' => @disable_erb,
|
|
156
|
-
'ignore_changes' => @ignore_changes
|
|
159
|
+
'ignore_changes' => @ignore_changes,
|
|
160
|
+
'shard' => @shard,
|
|
157
161
|
}
|
|
158
162
|
end
|
|
159
163
|
|
|
@@ -215,6 +219,9 @@ module OpenC3
|
|
|
215
219
|
if parameters
|
|
216
220
|
@disable_erb.concat(parameters)
|
|
217
221
|
end
|
|
222
|
+
when 'SHARD'
|
|
223
|
+
parser.verify_num_parameters(1, 1, "#{keyword} <Shard Number Starting from 0>")
|
|
224
|
+
@shard = Integer(parameters[0])
|
|
218
225
|
else
|
|
219
226
|
raise ConfigParser::Error.new(parser, "Unknown keyword and parameters for Microservice: #{keyword} #{parameters.join(" ")}")
|
|
220
227
|
end
|
|
@@ -200,7 +200,12 @@ module OpenC3
|
|
|
200
200
|
end
|
|
201
201
|
unless validate_only
|
|
202
202
|
Logger.info "Installing python packages from requirements.txt with pypi_url=#{pypi_url}"
|
|
203
|
-
|
|
203
|
+
if ENV['PIP_ENABLE_TRUSTED_HOST'].nil?
|
|
204
|
+
pip_args = "--no-warn-script-location -i #{pypi_url} -r #{File.join(gem_path, 'requirements.txt')}"
|
|
205
|
+
else
|
|
206
|
+
pip_args = "--no-warn-script-location -i #{pypi_url} --trusted-host #{URI.parse(pypi_url).host} -r #{File.join(gem_path, 'requirements.txt')}"
|
|
207
|
+
end
|
|
208
|
+
puts `/openc3/bin/pipinstall #{pip_args}`
|
|
204
209
|
end
|
|
205
210
|
needs_dependencies = true
|
|
206
211
|
end
|
|
@@ -92,7 +92,12 @@ module OpenC3
|
|
|
92
92
|
end
|
|
93
93
|
end
|
|
94
94
|
Logger.info "Installing python package: #{name_or_path}"
|
|
95
|
-
|
|
95
|
+
if ENV['PIP_ENABLE_TRUSTED_HOST'].nil?
|
|
96
|
+
pip_args = ["--no-warn-script-location", "-i", pypi_url, package_file_path]
|
|
97
|
+
else
|
|
98
|
+
pip_args = ["--no-warn-script-location", "-i", pypi_url, "--trusted-host", URI.parse(pypi_url).host, package_file_path]
|
|
99
|
+
end
|
|
100
|
+
result = OpenC3::ProcessManager.instance.spawn(["/openc3/bin/pipinstall"] + pip_args, "package_install", package_filename, Time.now + 3600.0, scope: scope)
|
|
96
101
|
return result.name
|
|
97
102
|
end
|
|
98
103
|
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
# GNU Affero General Public License for more details.
|
|
15
15
|
|
|
16
16
|
# Modified by OpenC3, Inc.
|
|
17
|
-
# All changes Copyright
|
|
17
|
+
# All changes Copyright 2024, OpenC3, Inc.
|
|
18
18
|
# All Rights Reserved
|
|
19
19
|
#
|
|
20
20
|
# This file may also be used under the terms of a commercial license
|
|
@@ -81,8 +81,8 @@ module OpenC3
|
|
|
81
81
|
model.undeploy()
|
|
82
82
|
end
|
|
83
83
|
|
|
84
|
-
attr_reader :name, :scope, :snooze, :triggers, :actions, :enabled, :
|
|
85
|
-
attr_accessor :username
|
|
84
|
+
attr_reader :name, :scope, :snooze, :triggers, :actions, :enabled, :trigger_level, :snoozed_until
|
|
85
|
+
attr_accessor :username, :shard
|
|
86
86
|
|
|
87
87
|
def initialize(
|
|
88
88
|
name:,
|
|
@@ -90,27 +90,29 @@ module OpenC3
|
|
|
90
90
|
snooze:,
|
|
91
91
|
actions:,
|
|
92
92
|
triggers:,
|
|
93
|
-
|
|
93
|
+
trigger_level:,
|
|
94
94
|
enabled: true,
|
|
95
95
|
snoozed_until: nil,
|
|
96
96
|
username: nil,
|
|
97
|
+
shard: 0,
|
|
97
98
|
updated_at: nil
|
|
98
99
|
)
|
|
99
100
|
super("#{scope}#{PRIMARY_KEY}", name: name, scope: scope)
|
|
100
101
|
@microservice_name = "#{scope}__OPENC3__REACTION"
|
|
101
102
|
@enabled = enabled
|
|
102
103
|
@snoozed_until = snoozed_until
|
|
103
|
-
@
|
|
104
|
+
@trigger_level = validate_level(trigger_level)
|
|
104
105
|
@snooze = validate_snooze(snooze)
|
|
105
106
|
@actions = validate_actions(actions)
|
|
106
107
|
@triggers = validate_triggers(triggers)
|
|
107
108
|
@username = username
|
|
109
|
+
@shard = shard.to_i # to_i to handle nil
|
|
108
110
|
@updated_at = updated_at
|
|
109
111
|
end
|
|
110
112
|
|
|
111
113
|
# Modifiers for the reaction_controller update action
|
|
112
|
-
def
|
|
113
|
-
@
|
|
114
|
+
def trigger_level=(trigger_level)
|
|
115
|
+
@trigger_level = validate_level(trigger_level)
|
|
114
116
|
end
|
|
115
117
|
def snooze=(snooze)
|
|
116
118
|
@snooze = validate_snooze(snooze)
|
|
@@ -127,7 +129,7 @@ module OpenC3
|
|
|
127
129
|
when 'EDGE', 'LEVEL'
|
|
128
130
|
return level
|
|
129
131
|
else
|
|
130
|
-
raise ReactionInputError.new "invalid
|
|
132
|
+
raise ReactionInputError.new "invalid trigger level, must be EDGE or LEVEL: #{level}"
|
|
131
133
|
end
|
|
132
134
|
end
|
|
133
135
|
|
|
@@ -257,12 +259,13 @@ module OpenC3
|
|
|
257
259
|
'name' => @name,
|
|
258
260
|
'scope' => @scope,
|
|
259
261
|
'enabled' => @enabled,
|
|
260
|
-
'
|
|
262
|
+
'trigger_level' => @trigger_level,
|
|
261
263
|
'snooze' => @snooze,
|
|
262
264
|
'snoozed_until' => @snoozed_until,
|
|
263
265
|
'triggers' => @triggers,
|
|
264
266
|
'actions' => @actions,
|
|
265
267
|
'username' => @username,
|
|
268
|
+
'shard' => @shard,
|
|
266
269
|
'updated_at' => @updated_at
|
|
267
270
|
}
|
|
268
271
|
end
|
|
@@ -290,11 +293,12 @@ module OpenC3
|
|
|
290
293
|
name: @microservice_name,
|
|
291
294
|
folder_name: nil,
|
|
292
295
|
cmd: ['ruby', 'reaction_microservice.rb', @microservice_name],
|
|
293
|
-
work_dir: '/openc3/lib/openc3/microservices',
|
|
296
|
+
work_dir: '/openc3-enterprise/lib/openc3-enterprise/microservices',
|
|
294
297
|
options: [],
|
|
295
298
|
topics: topics,
|
|
296
299
|
target_names: [],
|
|
297
300
|
plugin: nil,
|
|
301
|
+
shard: @shard,
|
|
298
302
|
scope: @scope
|
|
299
303
|
)
|
|
300
304
|
microservice.create
|