openc3 5.0.11 → 5.1.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of openc3 might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Guardfile +3 -0
- data/LICENSE.txt +7 -5
- data/README.md +11 -9
- data/Rakefile +3 -0
- data/bin/cstol_converter +3 -0
- data/bin/openc3cli +29 -18
- data/bin/rubysloc +3 -0
- data/data/config/screen.yaml +10 -2
- data/data/config/target.yaml +1 -1
- data/data/config/widgets.yaml +6 -6
- data/ext/mkrf_conf.rb +3 -0
- data/ext/openc3/ext/array/array.c +3 -0
- data/ext/openc3/ext/buffered_file/buffered_file.c +3 -0
- data/ext/openc3/ext/config_parser/config_parser.c +3 -0
- data/ext/openc3/ext/crc/crc.c +3 -0
- data/ext/openc3/ext/openc3_io/openc3_io.c +3 -0
- data/ext/openc3/ext/packet/packet.c +3 -0
- data/ext/openc3/ext/platform/platform.c +3 -0
- data/ext/openc3/ext/polynomial_conversion/polynomial_conversion.c +3 -0
- data/ext/openc3/ext/string/string.c +3 -0
- data/ext/openc3/ext/structure/structure.c +3 -0
- data/ext/openc3/ext/tabbed_plots_config/tabbed_plots_config.c +3 -0
- data/ext/openc3/ext/telemetry/telemetry.c +3 -0
- data/lib/cosmos.rb +3 -0
- data/lib/cosmosc2.rb +3 -0
- data/lib/openc3/accessors/accessor.rb +3 -0
- data/lib/openc3/accessors/binary_accessor.rb +3 -0
- data/lib/openc3/accessors/cbor_accessor.rb +3 -0
- data/lib/openc3/accessors/html_accessor.rb +3 -0
- data/lib/openc3/accessors/json_accessor.rb +4 -1
- data/lib/openc3/accessors/xml_accessor.rb +3 -0
- data/lib/openc3/accessors.rb +3 -0
- data/lib/openc3/api/api.rb +3 -0
- data/lib/openc3/api/authorized_api.rb +3 -0
- data/lib/openc3/api/cmd_api.rb +6 -3
- data/lib/openc3/api/config_api.rb +3 -0
- data/lib/openc3/api/interface_api.rb +6 -2
- data/lib/openc3/api/limits_api.rb +54 -61
- data/lib/openc3/api/router_api.rb +6 -3
- data/lib/openc3/api/settings_api.rb +3 -0
- data/lib/openc3/api/target_api.rb +3 -0
- data/lib/openc3/api/tlm_api.rb +27 -32
- data/lib/openc3/bridge/bridge.rb +3 -0
- data/lib/openc3/bridge/bridge_config.rb +3 -0
- data/lib/openc3/bridge/bridge_interface_thread.rb +3 -0
- data/lib/openc3/bridge/bridge_router_thread.rb +3 -0
- data/lib/openc3/ccsds/ccsds_packet.rb +3 -0
- data/lib/openc3/ccsds/ccsds_parser.rb +3 -0
- data/lib/openc3/config/config_parser.rb +3 -0
- data/lib/openc3/config/meta_config_parser.rb +3 -0
- data/lib/openc3/conversions/conversion.rb +3 -0
- data/lib/openc3/conversions/generic_conversion.rb +3 -0
- data/lib/openc3/conversions/packet_time_formatted_conversion.rb +3 -0
- data/lib/openc3/conversions/packet_time_seconds_conversion.rb +3 -0
- data/lib/openc3/conversions/polynomial_conversion.rb +3 -0
- data/lib/openc3/conversions/processor_conversion.rb +3 -0
- data/lib/openc3/conversions/received_count_conversion.rb +3 -0
- data/lib/openc3/conversions/received_time_formatted_conversion.rb +3 -0
- data/lib/openc3/conversions/received_time_seconds_conversion.rb +3 -0
- data/lib/openc3/conversions/segmented_polynomial_conversion.rb +3 -0
- data/lib/openc3/conversions/unix_time_conversion.rb +3 -0
- data/lib/openc3/conversions/unix_time_formatted_conversion.rb +3 -0
- data/lib/openc3/conversions/unix_time_seconds_conversion.rb +3 -0
- data/lib/openc3/conversions.rb +3 -0
- data/lib/openc3/core_ext/array.rb +3 -0
- data/lib/openc3/core_ext/binding.rb +3 -0
- data/lib/openc3/core_ext/class.rb +3 -0
- data/lib/openc3/core_ext/exception.rb +3 -0
- data/lib/openc3/core_ext/file.rb +3 -0
- data/lib/openc3/core_ext/hash.rb +3 -0
- data/lib/openc3/core_ext/io.rb +3 -0
- data/lib/openc3/core_ext/kernel.rb +3 -0
- data/lib/openc3/core_ext/math.rb +3 -0
- data/lib/openc3/core_ext/matrix.rb +3 -0
- data/lib/openc3/core_ext/objectspace.rb +3 -0
- data/lib/openc3/core_ext/openc3_io.rb +3 -0
- data/lib/openc3/core_ext/range.rb +3 -0
- data/lib/openc3/core_ext/socket.rb +3 -0
- data/lib/openc3/core_ext/string.rb +3 -0
- data/lib/openc3/core_ext/stringio.rb +3 -0
- data/lib/openc3/core_ext/tempfile.rb +3 -0
- data/lib/openc3/core_ext/time.rb +3 -0
- data/lib/openc3/core_ext.rb +3 -0
- data/lib/openc3/interfaces/interface.rb +3 -0
- data/lib/openc3/interfaces/linc_interface.rb +3 -0
- data/lib/openc3/interfaces/protocols/burst_protocol.rb +3 -0
- data/lib/openc3/interfaces/protocols/crc_protocol.rb +3 -0
- data/lib/openc3/interfaces/protocols/fixed_protocol.rb +3 -0
- data/lib/openc3/interfaces/protocols/ignore_packet_protocol.rb +3 -0
- data/lib/openc3/interfaces/protocols/length_protocol.rb +3 -0
- data/lib/openc3/interfaces/protocols/override_protocol.rb +3 -0
- data/lib/openc3/interfaces/protocols/preidentified_protocol.rb +3 -0
- data/lib/openc3/interfaces/protocols/protocol.rb +3 -0
- data/lib/openc3/interfaces/protocols/template_protocol.rb +3 -0
- data/lib/openc3/interfaces/protocols/terminated_protocol.rb +3 -0
- data/lib/openc3/interfaces/serial_interface.rb +3 -0
- data/lib/openc3/interfaces/simulated_target_interface.rb +3 -0
- data/lib/openc3/interfaces/stream_interface.rb +3 -0
- data/lib/openc3/interfaces/tcpip_client_interface.rb +3 -0
- data/lib/openc3/interfaces/tcpip_server_interface.rb +3 -0
- data/lib/openc3/interfaces/udp_interface.rb +3 -0
- data/lib/openc3/interfaces.rb +3 -0
- data/lib/openc3/io/buffered_file.rb +3 -0
- data/lib/openc3/io/io_multiplexer.rb +8 -0
- data/lib/openc3/io/json_api_object.rb +5 -2
- data/lib/openc3/io/json_drb.rb +3 -0
- data/lib/openc3/io/json_drb_object.rb +5 -2
- data/lib/openc3/io/json_drb_rack.rb +3 -0
- data/lib/openc3/io/json_rpc.rb +8 -3
- data/lib/openc3/io/openc3_snmp.rb +3 -0
- data/lib/openc3/io/posix_serial_driver.rb +3 -0
- data/lib/openc3/io/raw_logger.rb +3 -0
- data/lib/openc3/io/raw_logger_pair.rb +3 -0
- data/lib/openc3/io/serial_driver.rb +3 -0
- data/lib/openc3/io/stderr.rb +3 -0
- data/lib/openc3/io/stdout.rb +3 -0
- data/lib/openc3/io/udp_sockets.rb +3 -0
- data/lib/openc3/io/win32_serial_driver.rb +3 -0
- data/lib/openc3/logs/buffered_packet_log_reader.rb +65 -0
- data/lib/openc3/logs/buffered_packet_log_writer.rb +120 -0
- data/lib/openc3/logs/log_writer.rb +95 -40
- data/lib/openc3/logs/packet_log_constants.rb +9 -0
- data/lib/openc3/logs/packet_log_reader.rb +34 -3
- data/lib/openc3/logs/packet_log_writer.rb +85 -18
- data/lib/openc3/logs/text_log_writer.rb +9 -5
- data/lib/openc3/logs.rb +8 -2
- data/lib/openc3/microservices/cleanup_microservice.rb +18 -18
- data/lib/openc3/microservices/decom_microservice.rb +30 -24
- data/lib/openc3/microservices/interface_microservice.rb +136 -91
- data/lib/openc3/microservices/log_microservice.rb +35 -13
- data/lib/openc3/microservices/microservice.rb +16 -14
- data/lib/openc3/microservices/plugin_microservice.rb +3 -1
- data/lib/openc3/microservices/reaction_microservice.rb +4 -1
- data/lib/openc3/microservices/reducer_microservice.rb +332 -149
- data/lib/openc3/microservices/router_microservice.rb +3 -0
- data/lib/openc3/microservices/text_log_microservice.rb +22 -7
- data/lib/openc3/microservices/timeline_microservice.rb +4 -1
- data/lib/openc3/microservices/trigger_group_microservice.rb +3 -0
- data/lib/openc3/models/activity_model.rb +3 -0
- data/lib/openc3/models/auth_model.rb +3 -0
- data/lib/openc3/models/cvt_model.rb +14 -5
- data/lib/openc3/models/environment_model.rb +3 -0
- data/lib/openc3/models/gem_model.rb +30 -51
- data/lib/openc3/models/info_model.rb +3 -0
- data/lib/openc3/models/interface_model.rb +3 -0
- data/lib/openc3/models/interface_status_model.rb +4 -1
- data/lib/openc3/models/metadata_model.rb +3 -0
- data/lib/openc3/models/metric_model.rb +3 -0
- data/lib/openc3/models/microservice_model.rb +9 -6
- data/lib/openc3/models/microservice_status_model.rb +4 -1
- data/lib/openc3/models/model.rb +3 -0
- data/lib/openc3/models/note_model.rb +3 -0
- data/lib/openc3/models/notification_model.rb +3 -0
- data/lib/openc3/models/ping_model.rb +3 -0
- data/lib/openc3/models/plugin_model.rb +20 -14
- data/lib/openc3/models/process_status_model.rb +4 -1
- data/lib/openc3/models/reaction_model.rb +3 -0
- data/lib/openc3/models/reducer_model.rb +31 -24
- data/lib/openc3/models/router_model.rb +3 -0
- data/lib/openc3/models/router_status_model.rb +3 -0
- data/lib/openc3/models/scope_model.rb +3 -4
- data/lib/openc3/models/settings_model.rb +3 -0
- data/lib/openc3/models/sorted_model.rb +3 -0
- data/lib/openc3/models/target_model.rb +61 -94
- data/lib/openc3/models/timeline_model.rb +4 -1
- data/lib/openc3/models/tool_config_model.rb +3 -0
- data/lib/openc3/models/tool_model.rb +11 -9
- data/lib/openc3/models/trigger_group_model.rb +3 -0
- data/lib/openc3/models/trigger_model.rb +3 -0
- data/lib/openc3/models/widget_model.rb +18 -11
- data/lib/openc3/operators/microservice_operator.rb +3 -0
- data/lib/openc3/operators/operator.rb +105 -34
- data/lib/openc3/packets/commands.rb +3 -0
- data/lib/openc3/packets/json_packet.rb +87 -14
- data/lib/openc3/packets/limits.rb +4 -1
- data/lib/openc3/packets/limits_response.rb +3 -0
- data/lib/openc3/packets/packet.rb +5 -1
- data/lib/openc3/packets/packet_config.rb +3 -0
- data/lib/openc3/packets/packet_item.rb +9 -3
- data/lib/openc3/packets/packet_item_limits.rb +3 -0
- data/lib/openc3/packets/parsers/format_string_parser.rb +3 -0
- data/lib/openc3/packets/parsers/limits_parser.rb +3 -0
- data/lib/openc3/packets/parsers/limits_response_parser.rb +3 -0
- data/lib/openc3/packets/parsers/packet_item_parser.rb +3 -0
- data/lib/openc3/packets/parsers/packet_parser.rb +3 -0
- data/lib/openc3/packets/parsers/processor_parser.rb +3 -0
- data/lib/openc3/packets/parsers/state_parser.rb +3 -0
- data/lib/openc3/packets/parsers/xtce_converter.rb +3 -0
- data/lib/openc3/packets/parsers/xtce_parser.rb +3 -0
- data/lib/openc3/packets/structure.rb +3 -0
- data/lib/openc3/packets/structure_item.rb +3 -0
- data/lib/openc3/packets/telemetry.rb +3 -0
- data/lib/openc3/processors/processor.rb +3 -0
- data/lib/openc3/processors/statistics_processor.rb +3 -0
- data/lib/openc3/processors/watermark_processor.rb +3 -0
- data/lib/openc3/processors.rb +3 -0
- data/lib/openc3/script/api_shared.rb +35 -6
- data/lib/openc3/script/calendar.rb +3 -0
- data/lib/openc3/script/commands.rb +3 -0
- data/lib/openc3/script/exceptions.rb +3 -0
- data/lib/openc3/script/extract.rb +3 -0
- data/lib/openc3/script/limits.rb +3 -24
- data/lib/openc3/script/script.rb +11 -7
- data/lib/openc3/script/script_runner.rb +3 -0
- data/lib/openc3/script/storage.rb +33 -16
- data/lib/openc3/script/suite.rb +3 -0
- data/lib/openc3/script/suite_results.rb +3 -0
- data/lib/openc3/script/suite_runner.rb +3 -0
- data/lib/openc3/script/telemetry.rb +43 -0
- data/lib/openc3/script.rb +3 -0
- data/lib/openc3/streams/serial_stream.rb +3 -0
- data/lib/openc3/streams/stream.rb +3 -0
- data/lib/openc3/streams/tcpip_client_stream.rb +3 -0
- data/lib/openc3/streams/tcpip_socket_stream.rb +3 -0
- data/lib/openc3/system/system.rb +23 -10
- data/lib/openc3/system/system_config.rb +3 -0
- data/lib/openc3/system/target.rb +3 -0
- data/lib/openc3/system.rb +3 -0
- data/lib/openc3/tools/cmd_tlm_server/api.rb +3 -0
- data/lib/openc3/tools/cmd_tlm_server/cmd_tlm_server_config.rb +3 -0
- data/lib/openc3/tools/cmd_tlm_server/interface_thread.rb +3 -0
- data/lib/openc3/tools/table_manager/table.rb +3 -0
- data/lib/openc3/tools/table_manager/table_config.rb +3 -0
- data/lib/openc3/tools/table_manager/table_item.rb +3 -0
- data/lib/openc3/tools/table_manager/table_item_parser.rb +3 -0
- data/lib/openc3/tools/table_manager/table_manager_core.rb +3 -0
- data/lib/openc3/tools/table_manager/table_parser.rb +3 -0
- data/lib/openc3/tools/test_runner/test.rb +3 -0
- data/lib/openc3/top_level.rb +3 -0
- data/lib/openc3/topics/autonomic_topic.rb +3 -0
- data/lib/openc3/topics/calendar_topic.rb +3 -0
- data/lib/openc3/topics/command_decom_topic.rb +4 -1
- data/lib/openc3/topics/command_topic.rb +6 -1
- data/lib/openc3/topics/config_topic.rb +3 -0
- data/lib/openc3/topics/interface_topic.rb +9 -2
- data/lib/openc3/topics/limits_event_topic.rb +144 -10
- data/lib/openc3/topics/notifications_topic.rb +3 -0
- data/lib/openc3/topics/router_topic.rb +10 -3
- data/lib/openc3/topics/telemetry_decom_topic.rb +26 -20
- data/lib/openc3/topics/telemetry_reduced_topics.rb +92 -0
- data/lib/openc3/topics/telemetry_topic.rb +5 -2
- data/lib/openc3/topics/timeline_topic.rb +3 -0
- data/lib/openc3/topics/topic.rb +3 -0
- data/lib/openc3/utilities/authentication.rb +3 -0
- data/lib/openc3/utilities/authorization.rb +3 -0
- data/lib/openc3/utilities/aws_bucket.rb +199 -0
- data/lib/openc3/utilities/bucket.rb +82 -0
- data/lib/openc3/utilities/bucket_file_cache.rb +264 -0
- data/lib/openc3/utilities/bucket_utilities.rb +109 -0
- data/lib/openc3/utilities/crc.rb +3 -0
- data/lib/openc3/utilities/csv.rb +3 -0
- data/lib/openc3/utilities/local_bucket.rb +28 -0
- data/lib/openc3/utilities/local_mode.rb +47 -61
- data/lib/openc3/utilities/logger.rb +7 -1
- data/lib/openc3/utilities/message_log.rb +7 -4
- data/lib/openc3/utilities/metric.rb +4 -1
- data/lib/openc3/utilities/open_telemetry.rb +96 -0
- data/lib/openc3/utilities/process_manager.rb +3 -0
- data/lib/openc3/utilities/quaternion.rb +3 -0
- data/lib/openc3/utilities/ruby_lex_utils.rb +3 -0
- data/lib/openc3/utilities/s3_autoload.rb +3 -3
- data/lib/openc3/utilities/simulated_target.rb +3 -0
- data/lib/openc3/utilities/sleeper.rb +3 -0
- data/lib/openc3/utilities/store.rb +3 -0
- data/lib/openc3/utilities/store_autoload.rb +30 -23
- data/lib/openc3/utilities/target_file.rb +70 -83
- data/lib/openc3/utilities/zip.rb +3 -0
- data/lib/openc3/utilities.rb +3 -0
- data/lib/openc3/version.rb +6 -6
- data/lib/openc3/win32/excel.rb +3 -0
- data/lib/openc3/win32/win32.rb +3 -0
- data/lib/openc3/win32/win32_main.rb +3 -0
- data/lib/openc3.rb +3 -0
- data/tasks/gemfile_stats.rake +3 -0
- data/tasks/spec.rake +3 -0
- data/templates/plugin-template/plugin.gemspec +1 -1
- metadata +112 -6
- data/lib/openc3/utilities/s3.rb +0 -220
- data/lib/openc3/utilities/s3_file_cache.rb +0 -274
@@ -16,6 +16,9 @@
|
|
16
16
|
# Modified by OpenC3, Inc.
|
17
17
|
# All changes Copyright 2022, OpenC3, Inc.
|
18
18
|
# All Rights Reserved
|
19
|
+
#
|
20
|
+
# This file may also be used under the terms of a commercial license
|
21
|
+
# if purchased from OpenC3, Inc.
|
19
22
|
|
20
23
|
# https://www.rubydoc.info/gems/redis/Redis/Commands/SortedSets
|
21
24
|
# https://redis.io/docs/manual/data-types/data-types-tutorial/#sorted-sets
|
@@ -16,6 +16,9 @@
|
|
16
16
|
# Modified by OpenC3, Inc.
|
17
17
|
# All changes Copyright 2022, OpenC3, Inc.
|
18
18
|
# All Rights Reserved
|
19
|
+
#
|
20
|
+
# This file may also be used under the terms of a commercial license
|
21
|
+
# if purchased from OpenC3, Inc.
|
19
22
|
|
20
23
|
require 'openc3/top_level'
|
21
24
|
require 'openc3/models/model'
|
@@ -25,7 +28,7 @@ require 'openc3/topics/limits_event_topic'
|
|
25
28
|
require 'openc3/topics/config_topic'
|
26
29
|
require 'openc3/system'
|
27
30
|
require 'openc3/utilities/local_mode'
|
28
|
-
require 'openc3/utilities/
|
31
|
+
require 'openc3/utilities/bucket'
|
29
32
|
require 'openc3/utilities/zip'
|
30
33
|
require 'fileutils'
|
31
34
|
require 'tmpdir'
|
@@ -94,29 +97,13 @@ module OpenC3
|
|
94
97
|
targets[target_name]['modified'] = true if targets[target_name]
|
95
98
|
end
|
96
99
|
else
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
# The trailing slash is important!
|
104
|
-
prefix: "#{scope}/targets_modified/",
|
105
|
-
delimiter: '/',
|
106
|
-
continuation_token: token
|
107
|
-
})
|
108
|
-
resp.common_prefixes.each do |item|
|
109
|
-
# Results look like DEFAULT/targets_modified/INST/
|
110
|
-
# so split on '/' and pull out the last value
|
111
|
-
target_name = item.prefix.split('/')[-1]
|
112
|
-
# A target could have been deleted without removing the modified files
|
113
|
-
# Thus we have to check for the existance of the target_name key
|
114
|
-
if targets.has_key?(target_name)
|
115
|
-
targets[target_name]['modified'] = true
|
116
|
-
end
|
100
|
+
modified_targets = Bucket.getClient().list_directories(bucket: ENV['OPENC3_CONFIG_BUCKET'], path: "DEFAULT/targets_modified/")
|
101
|
+
modified_targets.each do |target_name|
|
102
|
+
# A target could have been deleted without removing the modified files
|
103
|
+
# Thus we have to check for the existance of the target_name key
|
104
|
+
if targets.has_key?(target_name)
|
105
|
+
targets[target_name]['modified'] = true
|
117
106
|
end
|
118
|
-
break unless resp.is_truncated
|
119
|
-
token = resp.next_continuation_token
|
120
107
|
end
|
121
108
|
end
|
122
109
|
# Sort (which turns hash to array) and return hash
|
@@ -131,23 +118,15 @@ module OpenC3
|
|
131
118
|
if ENV['OPENC3_LOCAL_MODE']
|
132
119
|
modified = OpenC3::LocalMode.modified_files(target_name, scope: scope)
|
133
120
|
else
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
})
|
144
|
-
resp.contents.each do |item|
|
145
|
-
# Results look like DEFAULT/targets_modified/INST/procedures/new.rb
|
146
|
-
# so split on '/' and ignore the first two values
|
147
|
-
modified << item.key.split('/')[2..-1].join('/')
|
148
|
-
end
|
149
|
-
break unless resp.is_truncated
|
150
|
-
token = resp.next_continuation_token
|
121
|
+
resp = Bucket.getClient().list_objects(
|
122
|
+
bucket: ENV['OPENC3_CONFIG_BUCKET'],
|
123
|
+
# The trailing slash is important!
|
124
|
+
prefix: "#{scope}/targets_modified/#{target_name}/",
|
125
|
+
)
|
126
|
+
resp.each do |item|
|
127
|
+
# Results look like DEFAULT/targets_modified/INST/procedures/new.rb
|
128
|
+
# so split on '/' and ignore the first two values
|
129
|
+
modified << item.key.split('/')[2..-1].join('/')
|
151
130
|
end
|
152
131
|
end
|
153
132
|
# Sort to enable a consistent listing of the modified files
|
@@ -158,23 +137,15 @@ module OpenC3
|
|
158
137
|
if ENV['OPENC3_LOCAL_MODE']
|
159
138
|
OpenC3::LocalMode.delete_modified(target_name, scope: scope)
|
160
139
|
end
|
161
|
-
|
140
|
+
bucket = Bucket.getClient()
|
162
141
|
# Delete the remote files as well
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
prefix: "#{scope}/targets_modified/#{target_name}/",
|
171
|
-
continuation_token: token
|
172
|
-
})
|
173
|
-
resp.contents.each do |item|
|
174
|
-
rubys3_client.delete_object(bucket: 'config', key: item.key)
|
175
|
-
end
|
176
|
-
break unless resp.is_truncated
|
177
|
-
token = resp.next_continuation_token
|
142
|
+
resp = bucket.list_objects(
|
143
|
+
bucket: ENV['OPENC3_CONFIG_BUCKET'],
|
144
|
+
# The trailing slash is important!
|
145
|
+
prefix: "#{scope}/targets_modified/#{target_name}/",
|
146
|
+
)
|
147
|
+
resp.each do |item|
|
148
|
+
bucket.delete_object(bucket: ENV['OPENC3_CONFIG_BUCKET'], key: item.key)
|
178
149
|
end
|
179
150
|
end
|
180
151
|
|
@@ -187,28 +158,21 @@ module OpenC3
|
|
187
158
|
if ENV['OPENC3_LOCAL_MODE']
|
188
159
|
OpenC3::LocalMode.zip_target(target_name, zip, scope: scope)
|
189
160
|
else
|
190
|
-
|
191
|
-
token = nil
|
161
|
+
bucket = Bucket.getClient()
|
192
162
|
# The trailing slash is important!
|
193
163
|
prefix = "#{scope}/targets_modified/#{target_name}/"
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
FileUtils.mkdir_p(File.dirname(local_path))
|
207
|
-
rubys3_client.get_object(bucket: 'config', key: item.key, response_target: local_path)
|
208
|
-
zip.add(base_path, local_path)
|
209
|
-
end
|
210
|
-
break unless resp.is_truncated
|
211
|
-
token = resp.next_continuation_token
|
164
|
+
resp = bucket.list_objects(
|
165
|
+
bucket: ENV['OPENC3_CONFIG_BUCKET'],
|
166
|
+
prefix: prefix,
|
167
|
+
)
|
168
|
+
resp.each do |item|
|
169
|
+
# item.key looks like DEFAULT/targets_modified/INST/screens/blah.txt
|
170
|
+
base_path = item.key.sub(prefix, '') # remove prefix
|
171
|
+
local_path = File.join(tmp_dir, base_path)
|
172
|
+
# Ensure dir structure exists, get_object fails if not
|
173
|
+
FileUtils.mkdir_p(File.dirname(local_path))
|
174
|
+
bucket.get_object(bucket: ENV['OPENC3_CONFIG_BUCKET'], key: item.key, path: local_path)
|
175
|
+
zip.add(base_path, local_path)
|
212
176
|
end
|
213
177
|
end
|
214
178
|
zip.close
|
@@ -384,6 +348,7 @@ module OpenC3
|
|
384
348
|
@reduced_day_log_retain_time = reduced_day_log_retain_time
|
385
349
|
@cleanup_poll_time = cleanup_poll_time
|
386
350
|
@needs_dependencies = needs_dependencies
|
351
|
+
@bucket = Bucket.getClient()
|
387
352
|
end
|
388
353
|
|
389
354
|
def as_json(*a)
|
@@ -506,7 +471,6 @@ module OpenC3
|
|
506
471
|
end
|
507
472
|
|
508
473
|
def deploy(gem_path, variables, validate_only: false)
|
509
|
-
rubys3_client = Aws::S3::Client.new
|
510
474
|
variables["target_name"] = @name
|
511
475
|
start_path = "/targets/#{@folder_name}/"
|
512
476
|
temp_dir = Dir.mktmpdir
|
@@ -534,7 +498,7 @@ module OpenC3
|
|
534
498
|
FileUtils.mkdir_p(File.dirname(local_path))
|
535
499
|
File.open(local_path, 'wb') { |file| file.write(data) }
|
536
500
|
found = true
|
537
|
-
|
501
|
+
@bucket.put_object(bucket: ENV['OPENC3_CONFIG_BUCKET'], key: key, body: data) unless validate_only
|
538
502
|
end
|
539
503
|
raise "No target files found at #{target_path}" unless found
|
540
504
|
|
@@ -546,7 +510,7 @@ module OpenC3
|
|
546
510
|
system.packet_config.to_xtce(variables["xtce_output"])
|
547
511
|
end
|
548
512
|
unless validate_only
|
549
|
-
build_target_archive(
|
513
|
+
build_target_archive(temp_dir, target_folder)
|
550
514
|
system = update_store(system)
|
551
515
|
deploy_microservices(gem_path, variables, system)
|
552
516
|
ConfigTopic.write({ kind: 'created', type: 'target', name: @name, plugin: @plugin }, scope: @scope)
|
@@ -557,10 +521,9 @@ module OpenC3
|
|
557
521
|
end
|
558
522
|
|
559
523
|
def undeploy
|
560
|
-
rubys3_client = Aws::S3::Client.new
|
561
524
|
prefix = "#{@scope}/targets/#{@name}/"
|
562
|
-
|
563
|
-
|
525
|
+
@bucket.list_objects(bucket: ENV['OPENC3_CONFIG_BUCKET'], prefix: prefix).each do |object|
|
526
|
+
@bucket.delete_object(bucket: ENV['OPENC3_CONFIG_BUCKET'], key: object.key)
|
564
527
|
end
|
565
528
|
|
566
529
|
self.class.get_model(name: @name, scope: @scope).limits_groups.each do |group|
|
@@ -573,9 +536,12 @@ module OpenC3
|
|
573
536
|
self.class.packets(@name, scope: @scope).each do |packet|
|
574
537
|
Topic.del("#{@scope}__TELEMETRY__{#{@name}}__#{packet['packet_name']}")
|
575
538
|
Topic.del("#{@scope}__DECOM__{#{@name}}__#{packet['packet_name']}")
|
539
|
+
Topic.del("#{@scope}__REDUCED_MINUTE__{#{@name}}__#{packet['packet_name']}")
|
540
|
+
Topic.del("#{@scope}__REDUCED_HOUR__{#{@name}}__#{packet['packet_name']}")
|
541
|
+
Topic.del("#{@scope}__REDUCED_DAY__{#{@name}}__#{packet['packet_name']}")
|
576
542
|
CvtModel.del(target_name: @name, packet_name: packet['packet_name'], scope: @scope)
|
577
|
-
LimitsEventTopic.delete(@name, packet['packet_name'], scope: @scope)
|
578
543
|
end
|
544
|
+
LimitsEventTopic.delete(@name, scope: @scope)
|
579
545
|
Store.del("#{@scope}__openc3tlm__#{@name}")
|
580
546
|
Store.del("#{@scope}__openc3cmd__#{@name}")
|
581
547
|
|
@@ -618,14 +584,14 @@ module OpenC3
|
|
618
584
|
end
|
619
585
|
end
|
620
586
|
|
621
|
-
def build_target_archive(
|
587
|
+
def build_target_archive(temp_dir, target_folder)
|
622
588
|
target_files = []
|
623
589
|
Find.find(target_folder) { |file| target_files << file }
|
624
590
|
target_files.sort!
|
625
591
|
hash = OpenC3.hash_files(target_files, nil, 'SHA256').hexdigest
|
626
592
|
File.open(File.join(target_folder, 'target_id.txt'), 'wb') { |file| file.write(hash) }
|
627
593
|
key = "#{@scope}/targets/#{@name}/target_id.txt"
|
628
|
-
|
594
|
+
@bucket.put_object(bucket: ENV['OPENC3_CONFIG_BUCKET'], key: key, body: hash)
|
629
595
|
|
630
596
|
# Create target archive zip file
|
631
597
|
prefix = File.dirname(target_folder) + '/'
|
@@ -642,14 +608,14 @@ module OpenC3
|
|
642
608
|
end
|
643
609
|
end
|
644
610
|
|
645
|
-
# Write Target Archive to
|
611
|
+
# Write Target Archive to bucket
|
646
612
|
File.open(output_file, 'rb') do |file|
|
647
|
-
|
648
|
-
|
613
|
+
bucket_key = key = "#{@scope}/target_archives/#{@name}/#{@name}_current.zip"
|
614
|
+
@bucket.put_object(bucket: ENV['OPENC3_CONFIG_BUCKET'], key: bucket_key, body: file)
|
649
615
|
end
|
650
616
|
File.open(output_file, 'rb') do |file|
|
651
|
-
|
652
|
-
|
617
|
+
bucket_key = key = "#{@scope}/target_archives/#{@name}/#{@name}_#{hash}.zip"
|
618
|
+
@bucket.put_object(bucket: ENV['OPENC3_CONFIG_BUCKET'], key: bucket_key, body: file)
|
653
619
|
end
|
654
620
|
end
|
655
621
|
|
@@ -722,6 +688,7 @@ module OpenC3
|
|
722
688
|
decom_command_topic_list = []
|
723
689
|
packet_topic_list = []
|
724
690
|
decom_topic_list = []
|
691
|
+
reduced_topic_list = []
|
725
692
|
begin
|
726
693
|
system.commands.packets(@name).each do |packet_name, packet|
|
727
694
|
command_topic_list << "#{@scope}__COMMAND__{#{@name}}__#{packet_name}"
|
@@ -734,6 +701,9 @@ module OpenC3
|
|
734
701
|
system.telemetry.packets(@name).each do |packet_name, packet|
|
735
702
|
packet_topic_list << "#{@scope}__TELEMETRY__{#{@name}}__#{packet_name}"
|
736
703
|
decom_topic_list << "#{@scope}__DECOM__{#{@name}}__#{packet_name}"
|
704
|
+
reduced_topic_list << "#{@scope}__REDUCED_MINUTE__{#{@name}}__#{packet_name}"
|
705
|
+
reduced_topic_list << "#{@scope}__REDUCED_HOUR__{#{@name}}__#{packet_name}"
|
706
|
+
reduced_topic_list << "#{@scope}__REDUCED_DAY__{#{@name}}__#{packet_name}"
|
737
707
|
end
|
738
708
|
rescue
|
739
709
|
# No telemetry packets for this target
|
@@ -743,6 +713,7 @@ module OpenC3
|
|
743
713
|
Topic.initialize_streams(decom_command_topic_list)
|
744
714
|
Topic.initialize_streams(packet_topic_list)
|
745
715
|
Topic.initialize_streams(decom_topic_list)
|
716
|
+
Topic.initialize_streams(reduced_topic_list)
|
746
717
|
|
747
718
|
unless command_topic_list.empty?
|
748
719
|
# CommandLog Microservice
|
@@ -759,7 +730,6 @@ module OpenC3
|
|
759
730
|
["CYCLE_SIZE", @cmd_log_cycle_size]
|
760
731
|
],
|
761
732
|
topics: command_topic_list,
|
762
|
-
target_names: [@name],
|
763
733
|
plugin: @plugin,
|
764
734
|
needs_dependencies: @needs_dependencies,
|
765
735
|
scope: @scope
|
@@ -782,7 +752,6 @@ module OpenC3
|
|
782
752
|
["CYCLE_SIZE", @cmd_decom_log_cycle_size]
|
783
753
|
],
|
784
754
|
topics: decom_command_topic_list,
|
785
|
-
target_names: [@name],
|
786
755
|
plugin: @plugin,
|
787
756
|
needs_dependencies: @needs_dependencies,
|
788
757
|
scope: @scope
|
@@ -807,7 +776,6 @@ module OpenC3
|
|
807
776
|
["CYCLE_SIZE", @tlm_log_cycle_size]
|
808
777
|
],
|
809
778
|
topics: packet_topic_list,
|
810
|
-
target_names: [@name],
|
811
779
|
plugin: @plugin,
|
812
780
|
needs_dependencies: @needs_dependencies,
|
813
781
|
scope: @scope
|
@@ -830,7 +798,6 @@ module OpenC3
|
|
830
798
|
["CYCLE_SIZE", @tlm_decom_log_cycle_size]
|
831
799
|
],
|
832
800
|
topics: decom_topic_list,
|
833
|
-
target_names: [@name],
|
834
801
|
plugin: @plugin,
|
835
802
|
needs_dependencies: @needs_dependencies,
|
836
803
|
scope: @scope
|
@@ -16,6 +16,9 @@
|
|
16
16
|
# Modified by OpenC3, Inc.
|
17
17
|
# All changes Copyright 2022, OpenC3, Inc.
|
18
18
|
# All Rights Reserved
|
19
|
+
#
|
20
|
+
# This file may also be used under the terms of a commercial license
|
21
|
+
# if purchased from OpenC3, Inc.
|
19
22
|
|
20
23
|
require 'openc3/models/model'
|
21
24
|
require 'openc3/models/activity_model'
|
@@ -66,7 +69,7 @@ module OpenC3
|
|
66
69
|
|
67
70
|
# @return [TimelineModel] Model generated from the passed JSON
|
68
71
|
def self.from_json(json, name:, scope:)
|
69
|
-
json = JSON.parse(json) if String === json
|
72
|
+
json = JSON.parse(json, :allow_nan => true, :create_additions => true) if String === json
|
70
73
|
raise "json data is nil" if json.nil?
|
71
74
|
|
72
75
|
json.transform_keys!(&:to_sym)
|
@@ -16,6 +16,9 @@
|
|
16
16
|
# Modified by OpenC3, Inc.
|
17
17
|
# All changes Copyright 2022, OpenC3, Inc.
|
18
18
|
# All Rights Reserved
|
19
|
+
#
|
20
|
+
# This file may also be used under the terms of a commercial license
|
21
|
+
# if purchased from OpenC3, Inc.
|
19
22
|
|
20
23
|
module OpenC3
|
21
24
|
class ToolConfigModel
|
@@ -16,10 +16,14 @@
|
|
16
16
|
# Modified by OpenC3, Inc.
|
17
17
|
# All changes Copyright 2022, OpenC3, Inc.
|
18
18
|
# All Rights Reserved
|
19
|
+
#
|
20
|
+
# This file may also be used under the terms of a commercial license
|
21
|
+
# if purchased from OpenC3, Inc.
|
19
22
|
|
20
23
|
require 'openc3/models/model'
|
21
24
|
require 'openc3/models/scope_model'
|
22
|
-
require 'openc3/utilities/
|
25
|
+
require 'openc3/utilities/bucket'
|
26
|
+
require 'openc3/utilities/bucket_utilities'
|
23
27
|
require 'rack'
|
24
28
|
|
25
29
|
module OpenC3
|
@@ -215,9 +219,6 @@ module OpenC3
|
|
215
219
|
def deploy(gem_path, variables, validate_only: false)
|
216
220
|
return unless @folder_name
|
217
221
|
|
218
|
-
# Ensure tools bucket exists
|
219
|
-
OpenC3::S3Utilities.ensure_public_bucket('tools') unless validate_only
|
220
|
-
|
221
222
|
variables["tool_name"] = @name
|
222
223
|
start_path = "/tools/#{@folder_name}/"
|
223
224
|
Dir.glob(gem_path + start_path + "**/*") do |filename|
|
@@ -231,8 +232,9 @@ module OpenC3
|
|
231
232
|
data = File.read(filename, mode: "rb")
|
232
233
|
data = ERB.new(data, trim_mode: "-").result(binding.set_variables(variables)) if data.is_printable?
|
233
234
|
unless validate_only
|
234
|
-
|
235
|
-
|
235
|
+
client = Bucket.getClient()
|
236
|
+
cache_control = BucketUtilities.get_cache_control(filename)
|
237
|
+
client.put_object(bucket: ENV['OPENC3_TOOLS_BUCKET'], content_type: content_type, cache_control: cache_control, key: key, body: data)
|
236
238
|
ConfigTopic.write({ kind: 'created', type: 'tool', name: @folder_name, plugin: @plugin }, scope: @scope)
|
237
239
|
end
|
238
240
|
end
|
@@ -240,10 +242,10 @@ module OpenC3
|
|
240
242
|
|
241
243
|
def undeploy
|
242
244
|
if @folder_name and @folder_name.to_s.length > 0
|
243
|
-
|
245
|
+
bucket = Bucket.getClient
|
244
246
|
prefix = "#{@folder_name}/"
|
245
|
-
|
246
|
-
|
247
|
+
bucket.list_objects(bucket: ENV['OPENC3_TOOLS_BUCKET'], prefix: prefix).each do |object|
|
248
|
+
bucket.delete_object(bucket: ENV['OPENC3_TOOLS_BUCKET'], key: object.key)
|
247
249
|
ConfigTopic.write({ kind: 'deleted', type: 'tool', name: @folder_name, plugin: @plugin }, scope: @scope)
|
248
250
|
end
|
249
251
|
end
|
@@ -16,6 +16,9 @@
|
|
16
16
|
# Modified by OpenC3, Inc.
|
17
17
|
# All changes Copyright 2022, OpenC3, Inc.
|
18
18
|
# All Rights Reserved
|
19
|
+
#
|
20
|
+
# This file may also be used under the terms of a commercial license
|
21
|
+
# if purchased from OpenC3, Inc.
|
19
22
|
|
20
23
|
require 'openc3/models/model'
|
21
24
|
require 'openc3/models/microservice_model'
|
@@ -16,6 +16,9 @@
|
|
16
16
|
# Modified by OpenC3, Inc.
|
17
17
|
# All changes Copyright 2022, OpenC3, Inc.
|
18
18
|
# All Rights Reserved
|
19
|
+
#
|
20
|
+
# This file may also be used under the terms of a commercial license
|
21
|
+
# if purchased from OpenC3, Inc.
|
19
22
|
|
20
23
|
require 'openc3/models/model'
|
21
24
|
require 'openc3/models/microservice_model'
|
@@ -16,11 +16,15 @@
|
|
16
16
|
# Modified by OpenC3, Inc.
|
17
17
|
# All changes Copyright 2022, OpenC3, Inc.
|
18
18
|
# All Rights Reserved
|
19
|
+
#
|
20
|
+
# This file may also be used under the terms of a commercial license
|
21
|
+
# if purchased from OpenC3, Inc.
|
19
22
|
|
20
23
|
require 'openc3/top_level'
|
21
24
|
require 'openc3/models/model'
|
22
25
|
require 'openc3/models/scope_model'
|
23
|
-
require 'openc3/utilities/
|
26
|
+
require 'openc3/utilities/bucket'
|
27
|
+
require 'openc3/utilities/bucket_utilities'
|
24
28
|
|
25
29
|
module OpenC3
|
26
30
|
class WidgetModel < Model
|
@@ -29,7 +33,7 @@ module OpenC3
|
|
29
33
|
attr_accessor :name
|
30
34
|
attr_accessor :full_name
|
31
35
|
attr_accessor :filename
|
32
|
-
attr_accessor :
|
36
|
+
attr_accessor :bucket_key
|
33
37
|
attr_accessor :needs_dependencies
|
34
38
|
|
35
39
|
# NOTE: The following three class methods are used by the ModelController
|
@@ -86,7 +90,7 @@ module OpenC3
|
|
86
90
|
super("#{scope}__#{PRIMARY_KEY}", name: name, plugin: plugin, updated_at: updated_at, scope: scope)
|
87
91
|
@full_name = @name.capitalize + 'Widget'
|
88
92
|
@filename = @full_name + '.umd.min.js'
|
89
|
-
@
|
93
|
+
@bucket_key = 'widgets/' + @full_name + '/' + @filename
|
90
94
|
@needs_dependencies = needs_dependencies
|
91
95
|
end
|
92
96
|
|
@@ -110,7 +114,11 @@ module OpenC3
|
|
110
114
|
|
111
115
|
def deploy(gem_path, variables, validate_only: false)
|
112
116
|
# Ensure tools bucket exists
|
113
|
-
|
117
|
+
bucket = nil
|
118
|
+
unless validate_only
|
119
|
+
bucket = Bucket.getClient()
|
120
|
+
bucket.ensure_public(ENV['OPENC3_TOOLS_BUCKET'])
|
121
|
+
end
|
114
122
|
|
115
123
|
filename = gem_path + "/tools/widgets/" + @full_name + '/' + @filename
|
116
124
|
|
@@ -120,19 +128,18 @@ module OpenC3
|
|
120
128
|
data = ERB.new(data, trim_mode: "-").result(binding.set_variables(variables)) if data.is_printable?
|
121
129
|
end
|
122
130
|
unless validate_only
|
123
|
-
cache_control =
|
131
|
+
cache_control = BucketUtilities.get_cache_control(@filename)
|
124
132
|
# TODO: support widgets that aren't just a single js file (and its associated map file)
|
125
|
-
|
126
|
-
rubys3_client.put_object(bucket: 'tools', content_type: 'application/javascript', cache_control: cache_control, key: @s3_key, body: data)
|
133
|
+
bucket.put_object(bucket: ENV['OPENC3_TOOLS_BUCKET'], content_type: 'application/javascript', cache_control: cache_control, key: @bucket_key, body: data)
|
127
134
|
data = File.read(filename + '.map', mode: "rb")
|
128
|
-
|
135
|
+
bucket.put_object(bucket: ENV['OPENC3_TOOLS_BUCKET'], content_type: 'application/json', cache_control: cache_control, key: @bucket_key + '.map', body: data)
|
129
136
|
end
|
130
137
|
end
|
131
138
|
|
132
139
|
def undeploy
|
133
|
-
|
134
|
-
|
135
|
-
|
140
|
+
bucket = Bucket.getClient()
|
141
|
+
bucket.delete_object(bucket: ENV['OPENC3_TOOLS_BUCKET'], key: @bucket_key)
|
142
|
+
bucket.delete_object(bucket: ENV['OPENC3_TOOLS_BUCKET'], key: @bucket_key + '.map')
|
136
143
|
end
|
137
144
|
end
|
138
145
|
end
|
@@ -16,6 +16,9 @@
|
|
16
16
|
# Modified by OpenC3, Inc.
|
17
17
|
# All changes Copyright 2022, OpenC3, Inc.
|
18
18
|
# All Rights Reserved
|
19
|
+
#
|
20
|
+
# This file may also be used under the terms of a commercial license
|
21
|
+
# if purchased from OpenC3, Inc.
|
19
22
|
|
20
23
|
require 'openc3'
|
21
24
|
require 'openc3/models/microservice_model'
|