openc3 7.2.1 → 7.4.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/Gemfile +1 -1
- data/Guardfile +0 -0
- data/LICENSE.md +0 -0
- data/README.md +0 -0
- data/Rakefile +0 -0
- data/bin/openc3cli +235 -6
- data/bin/pipinstall +5 -4
- data/bin/pipuninstall +5 -1
- data/bin/uvinstall +156 -0
- data/data/config/_array_params.yaml +0 -0
- data/data/config/_canvas_values.yaml +0 -0
- data/data/config/_graph_params.yaml +0 -0
- data/data/config/_id_items.yaml +0 -0
- data/data/config/_id_params.yaml +0 -0
- data/data/config/_interfaces.yaml +0 -0
- data/data/config/_items.yaml +0 -0
- data/data/config/_params.yaml +0 -0
- data/data/config/command.yaml +0 -0
- data/data/config/command_modifiers.yaml +2 -0
- data/data/config/command_telemetry.yaml +0 -0
- data/data/config/conversions.yaml +0 -0
- data/data/config/graph_settings.yaml +0 -0
- data/data/config/interface_modifiers.yaml +103 -1
- data/data/config/item_modifiers.yaml +2 -1
- data/data/config/microservice.yaml +9 -2
- data/data/config/param_item_modifiers.yaml +0 -0
- data/data/config/parameter_modifiers.yaml +0 -0
- data/data/config/plugins.yaml +0 -0
- data/data/config/processors.yaml +0 -0
- data/data/config/protocols.yaml +0 -0
- data/data/config/screen.yaml +2 -1
- data/data/config/settings.yaml +0 -0
- data/data/config/table_manager.yaml +0 -0
- data/data/config/table_parameter_modifiers.yaml +0 -0
- data/data/config/target.yaml +21 -0
- data/data/config/target_config.yaml +0 -0
- data/data/config/telemetry.yaml +0 -0
- data/data/config/telemetry_modifiers.yaml +2 -0
- data/data/config/tool.yaml +3 -1
- data/data/config/unknown.yaml +0 -0
- data/data/config/widgets.yaml +22 -3
- data/data/xtce_schemas/SpaceSystem_20180204.xsd +5918 -0
- data/data/xtce_schemas/xml.xsd +116 -0
- data/ext/openc3/ext/array/array.c +0 -0
- data/ext/openc3/ext/array/extconf.rb +0 -0
- data/ext/openc3/ext/buffered_file/buffered_file.c +0 -0
- data/ext/openc3/ext/buffered_file/extconf.rb +0 -0
- data/ext/openc3/ext/burst_protocol/burst_protocol.c +6 -0
- data/ext/openc3/ext/burst_protocol/extconf.rb +0 -0
- data/ext/openc3/ext/config_parser/config_parser.c +0 -0
- data/ext/openc3/ext/config_parser/extconf.rb +0 -0
- data/ext/openc3/ext/crc/crc.c +0 -0
- data/ext/openc3/ext/crc/extconf.rb +0 -0
- data/ext/openc3/ext/openc3_io/extconf.rb +0 -0
- data/ext/openc3/ext/openc3_io/openc3_io.c +0 -0
- data/ext/openc3/ext/packet/extconf.rb +0 -0
- data/ext/openc3/ext/packet/packet.c +0 -0
- data/ext/openc3/ext/platform/extconf.rb +0 -0
- data/ext/openc3/ext/platform/platform.c +4 -1
- data/ext/openc3/ext/polynomial_conversion/extconf.rb +0 -0
- data/ext/openc3/ext/polynomial_conversion/polynomial_conversion.c +0 -0
- data/ext/openc3/ext/string/extconf.rb +0 -0
- data/ext/openc3/ext/string/string.c +0 -0
- data/ext/openc3/ext/structure/structure.c +49 -17
- data/ext/openc3/ext/tabbed_plots_config/extconf.rb +0 -0
- data/ext/openc3/ext/tabbed_plots_config/tabbed_plots_config.c +0 -0
- data/ext/openc3/ext/telemetry/extconf.rb +0 -0
- data/ext/openc3/ext/telemetry/telemetry.c +1 -1
- data/lib/cosmos.rb +0 -0
- data/lib/cosmosc2.rb +0 -0
- data/lib/openc3/accessors/accessor.rb +0 -0
- data/lib/openc3/accessors/binary_accessor.rb +63 -9
- data/lib/openc3/accessors/cbor_accessor.rb +0 -0
- data/lib/openc3/accessors/form_accessor.rb +0 -0
- data/lib/openc3/accessors/html_accessor.rb +0 -0
- data/lib/openc3/accessors/http_accessor.rb +0 -0
- data/lib/openc3/accessors/json_accessor.rb +0 -0
- data/lib/openc3/accessors/template_accessor.rb +2 -2
- data/lib/openc3/accessors/xml_accessor.rb +0 -0
- data/lib/openc3/accessors.rb +0 -0
- data/lib/openc3/api/README.md +0 -0
- data/lib/openc3/api/api.rb +0 -0
- data/lib/openc3/api/authorized_api.rb +0 -0
- data/lib/openc3/api/calendar_api.rb +0 -0
- data/lib/openc3/api/cmd_api.rb +1 -1
- data/lib/openc3/api/config_api.rb +0 -0
- data/lib/openc3/api/interface_api.rb +2 -2
- data/lib/openc3/api/limits_api.rb +27 -13
- data/lib/openc3/api/metrics_api.rb +1 -1
- data/lib/openc3/api/offline_access_api.rb +1 -1
- data/lib/openc3/api/router_api.rb +3 -3
- data/lib/openc3/api/settings_api.rb +22 -18
- data/lib/openc3/api/stash_api.rb +1 -1
- data/lib/openc3/api/target_api.rb +0 -0
- data/lib/openc3/api/tlm_api.rb +5 -4
- data/lib/openc3/bridge/bridge.rb +0 -0
- data/lib/openc3/bridge/bridge_config.rb +0 -0
- data/lib/openc3/bridge/bridge_interface_thread.rb +0 -0
- data/lib/openc3/bridge/bridge_router_thread.rb +0 -0
- data/lib/openc3/ccsds/ccsds_packet.rb +0 -0
- data/lib/openc3/ccsds/ccsds_parser.rb +0 -0
- data/lib/openc3/config/config_parser.rb +78 -17
- data/lib/openc3/config/meta_config_parser.rb +0 -0
- data/lib/openc3/conversions/bit_reverse_conversion.rb +0 -0
- data/lib/openc3/conversions/conversion.rb +0 -0
- data/lib/openc3/conversions/generic_conversion.rb +0 -0
- data/lib/openc3/conversions/ip_read_conversion.rb +0 -0
- data/lib/openc3/conversions/ip_write_conversion.rb +0 -0
- data/lib/openc3/conversions/object_read_conversion.rb +0 -0
- data/lib/openc3/conversions/object_write_conversion.rb +0 -0
- data/lib/openc3/conversions/packet_time_formatted_conversion.rb +0 -0
- data/lib/openc3/conversions/packet_time_seconds_conversion.rb +0 -0
- data/lib/openc3/conversions/polynomial_conversion.rb +0 -0
- data/lib/openc3/conversions/processor_conversion.rb +0 -0
- data/lib/openc3/conversions/received_count_conversion.rb +0 -0
- data/lib/openc3/conversions/received_time_formatted_conversion.rb +0 -0
- data/lib/openc3/conversions/received_time_seconds_conversion.rb +0 -0
- data/lib/openc3/conversions/segmented_polynomial_conversion.rb +0 -0
- data/lib/openc3/conversions/unix_time_conversion.rb +0 -0
- data/lib/openc3/conversions/unix_time_formatted_conversion.rb +0 -0
- data/lib/openc3/conversions/unix_time_seconds_conversion.rb +0 -0
- data/lib/openc3/conversions.rb +0 -0
- data/lib/openc3/core_ext/array.rb +0 -0
- data/lib/openc3/core_ext/binding.rb +0 -0
- data/lib/openc3/core_ext/class.rb +0 -0
- data/lib/openc3/core_ext/exception.rb +0 -0
- data/lib/openc3/core_ext/faraday.rb +0 -0
- data/lib/openc3/core_ext/file.rb +0 -0
- data/lib/openc3/core_ext/io.rb +0 -0
- data/lib/openc3/core_ext/kernel.rb +0 -0
- data/lib/openc3/core_ext/math.rb +0 -0
- data/lib/openc3/core_ext/matrix.rb +0 -0
- data/lib/openc3/core_ext/objectspace.rb +0 -0
- data/lib/openc3/core_ext/openc3_io.rb +0 -0
- data/lib/openc3/core_ext/range.rb +0 -0
- data/lib/openc3/core_ext/socket.rb +0 -0
- data/lib/openc3/core_ext/string.rb +0 -0
- data/lib/openc3/core_ext/stringio.rb +0 -0
- data/lib/openc3/core_ext/tempfile.rb +0 -0
- data/lib/openc3/core_ext/time.rb +0 -0
- data/lib/openc3/core_ext.rb +0 -0
- data/lib/openc3/ext/.keep +0 -0
- data/lib/openc3/interfaces/file_interface.rb +0 -0
- data/lib/openc3/interfaces/http_client_interface.rb +1 -1
- data/lib/openc3/interfaces/http_server_interface.rb +0 -0
- data/lib/openc3/interfaces/interface.rb +5 -4
- data/lib/openc3/interfaces/mqtt_interface.rb +0 -0
- data/lib/openc3/interfaces/mqtt_stream_interface.rb +2 -0
- data/lib/openc3/interfaces/protocols/burst_protocol.rb +27 -0
- data/lib/openc3/interfaces/protocols/cmd_response_protocol.rb +0 -0
- data/lib/openc3/interfaces/protocols/cobs_protocol.rb +0 -0
- data/lib/openc3/interfaces/protocols/crc_protocol.rb +0 -0
- data/lib/openc3/interfaces/protocols/fixed_protocol.rb +0 -0
- data/lib/openc3/interfaces/protocols/ignore_packet_protocol.rb +0 -0
- data/lib/openc3/interfaces/protocols/length_protocol.rb +7 -0
- data/lib/openc3/interfaces/protocols/preidentified_protocol.rb +7 -0
- data/lib/openc3/interfaces/protocols/protocol.rb +4 -4
- data/lib/openc3/interfaces/protocols/slip_protocol.rb +0 -0
- data/lib/openc3/interfaces/protocols/template_protocol.rb +2 -2
- data/lib/openc3/interfaces/protocols/terminated_protocol.rb +0 -0
- data/lib/openc3/interfaces/serial_interface.rb +2 -0
- data/lib/openc3/interfaces/simulated_target_interface.rb +0 -0
- data/lib/openc3/interfaces/stream_interface.rb +0 -0
- data/lib/openc3/interfaces/tcpip_client_interface.rb +2 -0
- data/lib/openc3/interfaces/tcpip_server_interface.rb +0 -0
- data/lib/openc3/interfaces/udp_interface.rb +16 -5
- data/lib/openc3/interfaces.rb +0 -0
- data/lib/openc3/io/buffered_file.rb +0 -0
- data/lib/openc3/io/io_multiplexer.rb +0 -0
- data/lib/openc3/io/json_api.rb +3 -2
- data/lib/openc3/io/json_api_object.rb +0 -0
- data/lib/openc3/io/json_drb.rb +44 -12
- data/lib/openc3/io/json_drb_object.rb +0 -0
- data/lib/openc3/io/json_drb_rack.rb +0 -0
- data/lib/openc3/io/json_rpc.rb +0 -2
- data/lib/openc3/io/posix_serial_driver.rb +0 -0
- data/lib/openc3/io/serial_driver.rb +0 -0
- data/lib/openc3/io/stderr.rb +0 -0
- data/lib/openc3/io/stdout.rb +0 -0
- data/lib/openc3/io/udp_sockets.rb +38 -8
- data/lib/openc3/io/win32_serial_driver.rb +1 -0
- data/lib/openc3/logs/buffered_packet_log_reader.rb +0 -0
- data/lib/openc3/logs/buffered_packet_log_writer.rb +0 -0
- data/lib/openc3/logs/log_writer.rb +43 -7
- data/lib/openc3/logs/packet_log_constants.rb +0 -0
- data/lib/openc3/logs/packet_log_reader.rb +23 -2
- data/lib/openc3/logs/packet_log_writer.rb +6 -2
- data/lib/openc3/logs/stream_log.rb +1 -1
- data/lib/openc3/logs/stream_log_pair.rb +0 -0
- data/lib/openc3/logs/text_log_writer.rb +0 -0
- data/lib/openc3/logs.rb +0 -0
- data/lib/openc3/microservices/cleanup_microservice.rb +0 -0
- data/lib/openc3/microservices/decom_common.rb +0 -0
- data/lib/openc3/microservices/decom_microservice.rb +0 -0
- data/lib/openc3/microservices/interface_decom_common.rb +2 -1
- data/lib/openc3/microservices/interface_microservice.rb +73 -26
- data/lib/openc3/microservices/log_microservice.rb +0 -0
- data/lib/openc3/microservices/microservice.rb +3 -3
- data/lib/openc3/microservices/multi_microservice.rb +1 -1
- data/lib/openc3/microservices/periodic_microservice.rb +2 -2
- data/lib/openc3/microservices/plugin_microservice.rb +0 -0
- data/lib/openc3/microservices/queue_microservice.rb +0 -0
- data/lib/openc3/microservices/router_microservice.rb +0 -0
- data/lib/openc3/microservices/scope_cleanup_microservice.rb +0 -0
- data/lib/openc3/microservices/text_log_microservice.rb +0 -0
- data/lib/openc3/migrations/20220420190000_log_stuff.rb +0 -0
- data/lib/openc3/migrations/20221202214600_add_target_names.rb +0 -0
- data/lib/openc3/migrations/20221210174900_convert_to_multi.rb +0 -0
- data/lib/openc3/migrations/20230915000002_no_scope_log_messages.rb +0 -0
- data/lib/openc3/migrations/20231022000000_tlm_viewer_config.rb +0 -0
- data/lib/openc3/migrations/20241208080000_no_critical_cmd.rb +0 -0
- data/lib/openc3/migrations/20241208080001_no_trigger_group.rb +0 -0
- data/lib/openc3/migrations/20250108060000_news_feed.rb +0 -0
- data/lib/openc3/migrations/20250402000000_periodic_only_default.rb +0 -0
- data/lib/openc3/migrations/20260203000000_remove_store_id.rb +0 -0
- data/lib/openc3/migrations/20260204000000_remove_decom_reducer.rb +0 -0
- data/lib/openc3/migrations/20260701000000_updated_at_to_int.rb +0 -0
- data/lib/openc3/migrations/20260704000000_default_bridge.rb +38 -0
- data/lib/openc3/migrations/20260731000000_system_health_json.rb +52 -0
- data/lib/openc3/models/activity_model.rb +0 -0
- data/lib/openc3/models/auth_model.rb +35 -7
- data/lib/openc3/models/bridge_model.rb +133 -0
- data/lib/openc3/models/config_keyword_model.rb +63 -0
- data/lib/openc3/models/cvt_model.rb +5 -5
- data/lib/openc3/models/db_sharded_model.rb +0 -0
- data/lib/openc3/models/environment_model.rb +0 -0
- data/lib/openc3/models/gem_model.rb +13 -10
- data/lib/openc3/models/host_interface_microservice_model.rb +114 -0
- data/lib/openc3/models/info_model.rb +0 -0
- data/lib/openc3/models/interface_model.rb +179 -20
- data/lib/openc3/models/interface_status_model.rb +0 -0
- data/lib/openc3/models/metadata_model.rb +0 -0
- data/lib/openc3/models/metric_model.rb +0 -0
- data/lib/openc3/models/microservice_model.rb +26 -18
- data/lib/openc3/models/microservice_status_model.rb +0 -0
- data/lib/openc3/models/migration_model.rb +0 -0
- data/lib/openc3/models/model.rb +0 -0
- data/lib/openc3/models/news_model.rb +0 -0
- data/lib/openc3/models/note_model.rb +0 -0
- data/lib/openc3/models/offline_access_model.rb +0 -0
- data/lib/openc3/models/ping_model.rb +0 -0
- data/lib/openc3/models/plugin_model.rb +211 -50
- data/lib/openc3/models/plugin_store_model.rb +0 -0
- data/lib/openc3/models/process_status_model.rb +0 -0
- data/lib/openc3/models/python_package_model.rb +211 -15
- data/lib/openc3/models/queue_model.rb +0 -0
- data/lib/openc3/models/reaction_model.rb +0 -0
- data/lib/openc3/models/reingest_job_model.rb +0 -0
- data/lib/openc3/models/router_model.rb +0 -0
- data/lib/openc3/models/router_status_model.rb +0 -0
- data/lib/openc3/models/scope_model.rb +85 -56
- data/lib/openc3/models/script_engine_model.rb +0 -0
- data/lib/openc3/models/script_status_model.rb +0 -0
- data/lib/openc3/models/secret_model.rb +0 -0
- data/lib/openc3/models/setting_model.rb +546 -3
- data/lib/openc3/models/sorted_model.rb +0 -0
- data/lib/openc3/models/stash_model.rb +0 -0
- data/lib/openc3/models/target_model.rb +210 -31
- data/lib/openc3/models/timeline_model.rb +0 -0
- data/lib/openc3/models/tool_config_model.rb +0 -0
- data/lib/openc3/models/tool_model.rb +34 -20
- data/lib/openc3/models/trigger_group_model.rb +0 -0
- data/lib/openc3/models/trigger_model.rb +20 -0
- data/lib/openc3/models/widget_model.rb +0 -0
- data/lib/openc3/operators/microservice_operator.rb +79 -8
- data/lib/openc3/operators/operator.rb +4 -4
- data/lib/openc3/packets/binary_accessor.rb +0 -0
- data/lib/openc3/packets/command_validator.rb +0 -0
- data/lib/openc3/packets/commands.rb +4 -4
- data/lib/openc3/packets/json_packet.rb +0 -0
- data/lib/openc3/packets/limits.rb +15 -7
- data/lib/openc3/packets/limits_response.rb +0 -0
- data/lib/openc3/packets/packet.rb +5 -1
- data/lib/openc3/packets/packet_config.rb +0 -0
- data/lib/openc3/packets/packet_item.rb +0 -0
- data/lib/openc3/packets/packet_item_limits.rb +0 -0
- data/lib/openc3/packets/parsers/format_string_parser.rb +0 -0
- data/lib/openc3/packets/parsers/limits_parser.rb +0 -0
- data/lib/openc3/packets/parsers/limits_response_parser.rb +0 -0
- data/lib/openc3/packets/parsers/packet_item_parser.rb +0 -0
- data/lib/openc3/packets/parsers/packet_parser.rb +0 -0
- data/lib/openc3/packets/parsers/processor_parser.rb +0 -0
- data/lib/openc3/packets/parsers/state_parser.rb +1 -1
- data/lib/openc3/packets/parsers/xtce_converter.rb +183 -103
- data/lib/openc3/packets/parsers/xtce_parser.rb +71 -23
- data/lib/openc3/packets/structure.rb +9 -3
- data/lib/openc3/packets/structure_item.rb +0 -0
- data/lib/openc3/packets/telemetry.rb +3 -3
- data/lib/openc3/processors/processor.rb +2 -0
- data/lib/openc3/processors/statistics_processor.rb +0 -0
- data/lib/openc3/processors/watermark_processor.rb +0 -0
- data/lib/openc3/processors.rb +0 -0
- data/lib/openc3/script/api_shared.rb +0 -0
- data/lib/openc3/script/autonomic.rb +12 -12
- data/lib/openc3/script/calendar.rb +0 -0
- data/lib/openc3/script/commands.rb +1 -1
- data/lib/openc3/script/critical_cmd.rb +0 -0
- data/lib/openc3/script/exceptions.rb +0 -0
- data/lib/openc3/script/extract.rb +20 -25
- data/lib/openc3/script/limits.rb +0 -0
- data/lib/openc3/script/metadata.rb +0 -0
- data/lib/openc3/script/packages.rb +0 -0
- data/lib/openc3/script/plugins.rb +0 -0
- data/lib/openc3/script/queue.rb +0 -0
- data/lib/openc3/script/screen.rb +0 -0
- data/lib/openc3/script/script.rb +2 -2
- data/lib/openc3/script/script_runner.rb +0 -0
- data/lib/openc3/script/storage.rb +4 -4
- data/lib/openc3/script/suite.rb +0 -0
- data/lib/openc3/script/suite_results.rb +0 -0
- data/lib/openc3/script/suite_runner.rb +26 -0
- data/lib/openc3/script/tables.rb +0 -0
- data/lib/openc3/script/telemetry.rb +9 -3
- data/lib/openc3/script/web_socket_api.rb +247 -134
- data/lib/openc3/script.rb +0 -0
- data/lib/openc3/script_engines/script_engine.rb +0 -0
- data/lib/openc3/streams/mqtt_stream.rb +0 -0
- data/lib/openc3/streams/serial_stream.rb +0 -0
- data/lib/openc3/streams/stream.rb +0 -0
- data/lib/openc3/streams/tcpip_client_stream.rb +0 -0
- data/lib/openc3/streams/tcpip_socket_stream.rb +0 -0
- data/lib/openc3/streams/web_socket_client_stream.rb +0 -0
- data/lib/openc3/subpacketizers/subpacketizer.rb +0 -0
- data/lib/openc3/system/system.rb +0 -0
- data/lib/openc3/system/target.rb +0 -0
- data/lib/openc3/system.rb +0 -0
- data/lib/openc3/tools/cmd_tlm_server/api.rb +0 -0
- data/lib/openc3/tools/cmd_tlm_server/interface_thread.rb +7 -0
- data/lib/openc3/tools/table_manager/table.rb +0 -0
- data/lib/openc3/tools/table_manager/table_config.rb +0 -0
- data/lib/openc3/tools/table_manager/table_item.rb +0 -0
- data/lib/openc3/tools/table_manager/table_item_parser.rb +0 -0
- data/lib/openc3/tools/table_manager/table_manager_core.rb +0 -0
- data/lib/openc3/tools/table_manager/table_parser.rb +0 -0
- data/lib/openc3/tools/test_runner/test.rb +0 -0
- data/lib/openc3/top_level.rb +1 -1
- data/lib/openc3/topics/autonomic_topic.rb +0 -0
- data/lib/openc3/topics/calendar_topic.rb +0 -0
- data/lib/openc3/topics/command_decom_topic.rb +16 -1
- data/lib/openc3/topics/command_topic.rb +0 -0
- data/lib/openc3/topics/config_topic.rb +0 -0
- data/lib/openc3/topics/decom_interface_topic.rb +2 -1
- data/lib/openc3/topics/interface_topic.rb +8 -2
- data/lib/openc3/topics/limits_event_topic.rb +1 -1
- data/lib/openc3/topics/notebook_topic.rb +0 -0
- data/lib/openc3/topics/queue_topic.rb +0 -0
- data/lib/openc3/topics/router_topic.rb +6 -1
- data/lib/openc3/topics/system_events_topic.rb +0 -0
- data/lib/openc3/topics/telemetry_decom_topic.rb +0 -0
- data/lib/openc3/topics/telemetry_topic.rb +0 -0
- data/lib/openc3/topics/timeline_topic.rb +0 -0
- data/lib/openc3/topics/topic.rb +0 -0
- data/lib/openc3/utilities/authentication.rb +4 -4
- data/lib/openc3/utilities/authorization.rb +0 -0
- data/lib/openc3/utilities/aws_bucket.rb +12 -4
- data/lib/openc3/utilities/bucket.rb +1 -1
- data/lib/openc3/utilities/bucket_file_cache.rb +55 -22
- data/lib/openc3/utilities/bucket_require.rb +0 -0
- data/lib/openc3/utilities/bucket_utilities.rb +3 -4
- data/lib/openc3/utilities/cli_generator.rb +0 -0
- data/lib/openc3/utilities/cmd_log.rb +0 -0
- data/lib/openc3/utilities/config_overlay.rb +75 -0
- data/lib/openc3/utilities/cosmos_rails_formatter.rb +0 -0
- data/lib/openc3/utilities/crc.rb +59 -32
- data/lib/openc3/utilities/csv.rb +5 -5
- data/lib/openc3/utilities/ctrf.rb +0 -0
- data/lib/openc3/utilities/env_helper.rb +0 -0
- data/lib/openc3/utilities/local_bucket.rb +0 -0
- data/lib/openc3/utilities/local_mode.rb +36 -7
- data/lib/openc3/utilities/logger.rb +30 -8
- data/lib/openc3/utilities/message_log.rb +0 -0
- data/lib/openc3/utilities/metric.rb +0 -0
- data/lib/openc3/utilities/migration.rb +0 -0
- data/lib/openc3/utilities/open_telemetry.rb +0 -0
- data/lib/openc3/utilities/process_manager.rb +0 -0
- data/lib/openc3/utilities/pypi_url.rb +0 -0
- data/lib/openc3/utilities/python_proxy.rb +0 -0
- data/lib/openc3/utilities/python_venv.rb +135 -0
- data/lib/openc3/utilities/quaternion.rb +0 -0
- data/lib/openc3/utilities/questdb_client.rb +0 -0
- data/lib/openc3/utilities/redis_secrets.rb +0 -0
- data/lib/openc3/utilities/reingest_job.rb +0 -0
- data/lib/openc3/utilities/ruby_lex_utils.rb +5 -1
- data/lib/openc3/utilities/rubygems_url.rb +39 -0
- data/lib/openc3/utilities/running_script.rb +119 -95
- data/lib/openc3/utilities/s3_autoload.rb +5 -5
- data/lib/openc3/utilities/script.rb +52 -12
- data/lib/openc3/utilities/secrets.rb +48 -3
- data/lib/openc3/utilities/simulated_target.rb +0 -0
- data/lib/openc3/utilities/sleeper.rb +0 -0
- data/lib/openc3/utilities/store.rb +0 -0
- data/lib/openc3/utilities/store_autoload.rb +2 -2
- data/lib/openc3/utilities/store_queued.rb +0 -0
- data/lib/openc3/utilities/target_file.rb +18 -1
- data/lib/openc3/utilities/thread_manager.rb +0 -0
- data/lib/openc3/utilities/throttle.rb +0 -0
- data/lib/openc3/utilities/zip.rb +0 -0
- data/lib/openc3/utilities.rb +0 -0
- data/lib/openc3/version.rb +6 -6
- data/lib/openc3/win32/excel.rb +0 -0
- data/lib/openc3/win32/win32.rb +0 -0
- data/lib/openc3/win32/win32_main.rb +0 -0
- data/lib/openc3.rb +2 -2
- data/tasks/gemfile_stats.rake +0 -0
- data/tasks/spec.rake +0 -0
- data/templates/command_validator/command_validator.py +0 -0
- data/templates/command_validator/command_validator.rb +0 -0
- data/templates/conversion/conversion.py +0 -0
- data/templates/conversion/conversion.rb +0 -0
- data/templates/limits_response/response.py +0 -0
- data/templates/limits_response/response.rb +0 -0
- data/templates/microservice/microservices/TEMPLATE/microservice.py +0 -0
- data/templates/microservice/microservices/TEMPLATE/microservice.rb +0 -0
- data/templates/plugin/.gitignore +0 -0
- data/templates/plugin/LICENSE.md +0 -0
- data/templates/plugin/README.md +0 -0
- data/templates/plugin/Rakefile +0 -0
- data/templates/plugin/plugin.gemspec +1 -1
- data/templates/plugin/plugin.txt +0 -0
- data/templates/processor/processor.py +1 -1
- data/templates/processor/processor.rb +0 -0
- data/templates/target/targets/TARGET/cmd_tlm/cmd.txt +0 -0
- data/templates/target/targets/TARGET/cmd_tlm/tlm.txt +0 -0
- data/templates/target/targets/TARGET/lib/target.py +0 -0
- data/templates/target/targets/TARGET/lib/target.rb +0 -0
- data/templates/target/targets/TARGET/procedures/procedure.py +0 -0
- data/templates/target/targets/TARGET/procedures/procedure.rb +0 -0
- data/templates/target/targets/TARGET/public/README.txt +0 -0
- data/templates/target/targets/TARGET/screens/status.txt +0 -0
- data/templates/target/targets/TARGET/target.txt +0 -0
- data/templates/tool_angular/.editorconfig +0 -0
- data/templates/tool_angular/.gitignore +0 -0
- data/templates/tool_angular/.vscode/extensions.json +0 -0
- data/templates/tool_angular/.vscode/launch.json +0 -0
- data/templates/tool_angular/.vscode/tasks.json +0 -0
- data/templates/tool_angular/angular.json +0 -0
- data/templates/tool_angular/extra-webpack.config.js +0 -0
- data/templates/tool_angular/package.json +2 -2
- data/templates/tool_angular/src/app/app-routing.module.ts +0 -0
- data/templates/tool_angular/src/app/app.component.html +0 -0
- data/templates/tool_angular/src/app/app.component.scss +0 -0
- data/templates/tool_angular/src/app/app.component.spec.ts +0 -0
- data/templates/tool_angular/src/app/app.component.ts +0 -0
- data/templates/tool_angular/src/app/app.module.ts +0 -0
- data/templates/tool_angular/src/app/custom-overlay-container.ts +0 -0
- data/templates/tool_angular/src/app/empty-route/empty-route.component.ts +0 -0
- data/templates/tool_angular/src/app/openc3-api.d.ts +0 -0
- data/templates/tool_angular/src/assets/.gitkeep +0 -0
- data/templates/tool_angular/src/environments/environment.prod.ts +0 -0
- data/templates/tool_angular/src/environments/environment.ts +0 -0
- data/templates/tool_angular/src/favicon.ico +0 -0
- data/templates/tool_angular/src/index.html +0 -0
- data/templates/tool_angular/src/main.single-spa.ts +0 -0
- data/templates/tool_angular/src/single-spa/asset-url.ts +0 -0
- data/templates/tool_angular/src/single-spa/single-spa-props.ts +0 -0
- data/templates/tool_angular/src/styles.scss +0 -0
- data/templates/tool_angular/tsconfig.app.json +0 -0
- data/templates/tool_angular/tsconfig.json +0 -0
- data/templates/tool_angular/tsconfig.spec.json +0 -0
- data/templates/tool_react/.eslintrc +0 -0
- data/templates/tool_react/.gitignore +0 -0
- data/templates/tool_react/.prettierignore +0 -0
- data/templates/tool_react/babel.config.json +0 -0
- data/templates/tool_react/jest.config.js +0 -0
- data/templates/tool_react/package.json +1 -1
- data/templates/tool_react/src/openc3-tool_name.js +0 -0
- data/templates/tool_react/src/root.component.js +0 -0
- data/templates/tool_react/src/root.component.test.js +0 -0
- data/templates/tool_react/webpack.config.js +0 -0
- data/templates/tool_svelte/.gitignore +0 -0
- data/templates/tool_svelte/.prettierignore +0 -0
- data/templates/tool_svelte/.prettierrc.js +0 -0
- data/templates/tool_svelte/babel.config.js +0 -0
- data/templates/tool_svelte/build/smui.css +0 -0
- data/templates/tool_svelte/jest.config.js +0 -0
- data/templates/tool_svelte/package.json +1 -1
- data/templates/tool_svelte/rollup.config.js +0 -0
- data/templates/tool_svelte/src/App.svelte +0 -0
- data/templates/tool_svelte/src/App.test.js +0 -0
- data/templates/tool_svelte/src/theme/_smui-theme.scss +0 -0
- data/templates/tool_svelte/src/tool_name.js +0 -0
- data/templates/tool_vue/.env.standalone +0 -0
- data/templates/tool_vue/.gitignore +0 -0
- data/templates/tool_vue/.prettierrc.cjs +0 -0
- data/templates/tool_vue/eslint.config.mjs +0 -0
- data/templates/tool_vue/jsconfig.json +0 -0
- data/templates/tool_vue/package.json +3 -3
- data/templates/tool_vue/src/App.vue +0 -0
- data/templates/tool_vue/src/main.js +0 -0
- data/templates/tool_vue/src/router.js +0 -0
- data/templates/tool_vue/src/tools/tool_name/tool_name.vue +0 -0
- data/templates/tool_vue/vite.config.js +1 -1
- data/templates/widget/.prettierrc.cjs +0 -0
- data/templates/widget/LICENSE.md +0 -0
- data/templates/widget/Rakefile +0 -0
- data/templates/widget/package.json +2 -2
- data/templates/widget/src/Widget.vue +0 -0
- data/templates/widget/vite.config.js +0 -0
- metadata +40 -11
- data/templates/tool_vue/.nycrc +0 -3
- data/templates/widget/.nycrc +0 -3
|
@@ -99,7 +99,7 @@ module OpenC3
|
|
|
99
99
|
|
|
100
100
|
Dir.each_child(path) do |filename|
|
|
101
101
|
full_path = "#{path}/#{filename}"
|
|
102
|
-
|
|
102
|
+
unless File.directory?(full_path)
|
|
103
103
|
if File.extname(filename) == '.gem'
|
|
104
104
|
gems << full_path
|
|
105
105
|
elsif filename == 'plugin_instance.json'
|
|
@@ -283,7 +283,7 @@ module OpenC3
|
|
|
283
283
|
return if DEFAULT_PLUGINS.include?(gem_name)
|
|
284
284
|
puts "Updating local plugin files: #{full_folder_path}"
|
|
285
285
|
FileUtils.mkdir_p(full_folder_path)
|
|
286
|
-
gems
|
|
286
|
+
gems = scan_plugin_dir(full_folder_path).first
|
|
287
287
|
gems.each do |gem|
|
|
288
288
|
File.delete(gem)
|
|
289
289
|
end
|
|
@@ -377,7 +377,7 @@ module OpenC3
|
|
|
377
377
|
end
|
|
378
378
|
end
|
|
379
379
|
|
|
380
|
-
def self.put_target_file(path, io_or_string, scope:)
|
|
380
|
+
def self.put_target_file(path, io_or_string, scope:) # NOSONAR - scope: is part of the caller-facing signature
|
|
381
381
|
full_folder_path = "#{OPENC3_LOCAL_MODE_PATH}/#{path}"
|
|
382
382
|
return unless File.expand_path(full_folder_path).start_with?(OPENC3_LOCAL_MODE_PATH)
|
|
383
383
|
FileUtils.mkdir_p(File.dirname(full_folder_path))
|
|
@@ -468,16 +468,42 @@ module OpenC3
|
|
|
468
468
|
end
|
|
469
469
|
|
|
470
470
|
def self.sync_settings()
|
|
471
|
+
# The files are authoritative here, unlike the OPENC3_SETTING_* env var
|
|
472
|
+
# seeding done by `openc3cli initsettings`. An Admin Console edit is
|
|
473
|
+
# mirrored straight back into the file by set_setting, so the file is
|
|
474
|
+
# already the edited value and applying it reverts nothing. Skipping a
|
|
475
|
+
# setting that already exists would instead mean a file was never applied
|
|
476
|
+
# at all: localinit runs after the first plugin load creates the scope,
|
|
477
|
+
# and that seeds source_url, rubygems_url, pypi_url, news_feed and
|
|
478
|
+
# system_health, so those five always exist by the time this runs.
|
|
479
|
+
#
|
|
480
|
+
# Because initsettings runs before localinit, a local mode file wins over
|
|
481
|
+
# OPENC3_SETTING_<NAME> for the same setting.
|
|
482
|
+
#
|
|
483
|
+
# A file that won't coerce is reported and skipped rather than raising,
|
|
484
|
+
# for the same reason `initsettings` doesn't abort: one bad settings file
|
|
485
|
+
# shouldn't stop the rest of localinit.
|
|
486
|
+
problems = []
|
|
471
487
|
scopes = ScopeModel.names()
|
|
472
488
|
scopes.each do |scope|
|
|
473
489
|
Dir["#{OPENC3_LOCAL_MODE_PATH}/#{scope}/settings/*.json"].each do |config|
|
|
474
490
|
name = File.basename(config, ".json")
|
|
491
|
+
# save_setting writes a boolean as the JSON text "true"/"false", so
|
|
492
|
+
# convert it back rather than storing the file contents verbatim -
|
|
493
|
+
# the string "false" is truthy in the frontend. Settings that hold
|
|
494
|
+
# JSON text (classification_banner, astro) stay strings, which is
|
|
495
|
+
# what their components JSON.parse.
|
|
496
|
+
begin
|
|
497
|
+
data = SettingModel.coerce(name, File.read(config))
|
|
498
|
+
rescue StandardError => error
|
|
499
|
+
problems << "#{config}: #{error.message}"
|
|
500
|
+
next
|
|
501
|
+
end
|
|
475
502
|
puts "Syncing setting #{name}"
|
|
476
|
-
# Anything can be stored in settings so read and set directly
|
|
477
|
-
data = File.read(config)
|
|
478
503
|
SettingModel.set({ name: name, data: data }, scope: scope)
|
|
479
504
|
end
|
|
480
505
|
end
|
|
506
|
+
problems.each { |problem| puts "ERROR: #{problem}" }
|
|
481
507
|
end
|
|
482
508
|
|
|
483
509
|
def self.save_setting(scope, name, data)
|
|
@@ -485,7 +511,10 @@ module OpenC3
|
|
|
485
511
|
config_path = "#{OPENC3_LOCAL_MODE_PATH}/#{scope}/settings/#{name}.json"
|
|
486
512
|
return unless File.expand_path(config_path).start_with?(OPENC3_LOCAL_MODE_PATH)
|
|
487
513
|
FileUtils.mkdir_p(File.dirname(config_path))
|
|
488
|
-
# Anything can be stored as a setting
|
|
514
|
+
# Anything can be stored as a setting. Strings are written directly since
|
|
515
|
+
# they're already the serialized form. Anything else is written as JSON so
|
|
516
|
+
# sync_settings can read it back rather than a Ruby inspect string.
|
|
517
|
+
data = JSON.generate(data.as_json(:allow_nan => true)) unless String === data
|
|
489
518
|
File.write(config_path, data)
|
|
490
519
|
end
|
|
491
520
|
|
|
@@ -579,7 +608,7 @@ module OpenC3
|
|
|
579
608
|
# Both files exist - Handled earlier
|
|
580
609
|
else
|
|
581
610
|
# Local is missing remote file
|
|
582
|
-
if not ENV
|
|
611
|
+
if not ENV.fetch('OPENC3_LOCAL_MODE_SECONDARY', nil) and ENV.fetch('OPENC3_LOCAL_MODE_SYNC_REMOVE', nil)
|
|
583
612
|
delete_remote(bucket, key)
|
|
584
613
|
else
|
|
585
614
|
# Go ahead and copy down to get in sync
|
|
@@ -42,39 +42,61 @@ module OpenC3
|
|
|
42
42
|
|
|
43
43
|
@@mutex = Mutex.new
|
|
44
44
|
@@instance = nil
|
|
45
|
-
@@scope = ENV
|
|
45
|
+
@@scope = ENV.fetch('OPENC3_SCOPE', 'DEFAULT')
|
|
46
46
|
|
|
47
|
-
#
|
|
47
|
+
# Levels in increasing severity. Logging at a level prints that level
|
|
48
|
+
# and everything above it, e.g. WARN prints WARN, ERROR and FATAL.
|
|
48
49
|
DEBUG = ::Logger::DEBUG
|
|
49
|
-
# INFO prints INFO, DEBUG messages
|
|
50
50
|
INFO = ::Logger::INFO
|
|
51
|
-
# WARN prints WARN, INFO, DEBUG messages
|
|
52
51
|
WARN = ::Logger::WARN
|
|
53
|
-
# ERROR prints ERROR, WARN, INFO, DEBUG messages
|
|
54
52
|
ERROR = ::Logger::ERROR
|
|
55
|
-
# FATAL prints FATAL, ERROR, WARN, INFO, DEBUG messages
|
|
56
53
|
FATAL = ::Logger::FATAL
|
|
57
54
|
|
|
55
|
+
# Level names as they appear in log messages and OPENC3_LOG_LEVEL
|
|
58
56
|
DEBUG_LEVEL = 'DEBUG'
|
|
59
57
|
INFO_LEVEL = 'INFO'
|
|
60
58
|
WARN_LEVEL = 'WARN'
|
|
61
59
|
ERROR_LEVEL = 'ERROR'
|
|
62
60
|
FATAL_LEVEL = 'FATAL'
|
|
63
61
|
|
|
62
|
+
LEVELS = {
|
|
63
|
+
DEBUG_LEVEL => DEBUG,
|
|
64
|
+
INFO_LEVEL => INFO,
|
|
65
|
+
WARN_LEVEL => WARN,
|
|
66
|
+
ERROR_LEVEL => ERROR,
|
|
67
|
+
FATAL_LEVEL => FATAL
|
|
68
|
+
}.freeze
|
|
69
|
+
|
|
64
70
|
# Types
|
|
65
71
|
LOG = 'log'
|
|
66
72
|
NOTIFICATION = 'notification'
|
|
67
73
|
ALERT = 'alert'
|
|
68
74
|
EPHEMERAL = 'ephemeral'
|
|
69
75
|
|
|
76
|
+
# @return [Integer] Level named by the OPENC3_LOG_LEVEL env var.
|
|
77
|
+
# INFO if the var is unset or isn't a level name.
|
|
78
|
+
def self.default_level
|
|
79
|
+
level = ENV.fetch('OPENC3_LOG_LEVEL', '')
|
|
80
|
+
name = level.to_s.strip.upcase
|
|
81
|
+
return INFO if name.empty?
|
|
82
|
+
|
|
83
|
+
LEVELS.fetch(name) do
|
|
84
|
+
unless @warned_bad_level
|
|
85
|
+
@warned_bad_level = true
|
|
86
|
+
$stderr.puts "OPENC3_LOG_LEVEL '#{level}' is not one of #{LEVELS.keys.join(', ')}, using INFO"
|
|
87
|
+
end
|
|
88
|
+
INFO
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
70
92
|
# @param level [Integer] The initial logging level
|
|
71
|
-
def initialize(level = Logger
|
|
93
|
+
def initialize(level = Logger.default_level)
|
|
72
94
|
@stdout = true
|
|
73
95
|
@level = level
|
|
74
96
|
@detail_string = nil
|
|
75
97
|
@container_name = Socket.gethostname
|
|
76
98
|
@microservice_name = nil
|
|
77
|
-
@no_store = ENV
|
|
99
|
+
@no_store = ENV.fetch('OPENC3_NO_STORE', nil)
|
|
78
100
|
end
|
|
79
101
|
|
|
80
102
|
# Only set the microservice name once (to help with multi microservices)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# encoding: ascii-8bit
|
|
2
|
+
|
|
3
|
+
# Copyright 2026 OpenC3, Inc.
|
|
4
|
+
# All Rights Reserved.
|
|
5
|
+
#
|
|
6
|
+
# This program is distributed in the hope that it will be useful,
|
|
7
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
8
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
9
|
+
# See LICENSE.md for more details.
|
|
10
|
+
#
|
|
11
|
+
# This file may also be used under the terms of a commercial license
|
|
12
|
+
# if purchased from OpenC3, Inc.
|
|
13
|
+
|
|
14
|
+
require 'open3'
|
|
15
|
+
require 'openc3/models/target_model'
|
|
16
|
+
require 'openc3/utilities/target_file'
|
|
17
|
+
|
|
18
|
+
module OpenC3
|
|
19
|
+
module PythonVenv
|
|
20
|
+
PLUGIN_VENVS_DIR = '/gems/plugin_venvs'
|
|
21
|
+
|
|
22
|
+
# Shared user site-packages directory used by plugins that predate the
|
|
23
|
+
# per-plugin UV venvs. Every caller that falls back off a plugin venv points
|
|
24
|
+
# PYTHONUSERBASE here, so keep it in one place rather than repeating the
|
|
25
|
+
# literal in script.rb, running_script.rb, microservice_operator.rb and
|
|
26
|
+
# microservice_model.rb.
|
|
27
|
+
DEFAULT_PYTHONUSERBASE = '/gems/python_packages'
|
|
28
|
+
|
|
29
|
+
# Packages a plugin venv must never supply itself. The scripts and
|
|
30
|
+
# microservices that use a plugin venv still run the base venv's Python
|
|
31
|
+
# binary, and CPython searches every PYTHONPATH entry ahead of the running
|
|
32
|
+
# venv's own site-packages. A plugin that declares openc3 as a dependency
|
|
33
|
+
# would therefore shadow the system library with its own copy, silently
|
|
34
|
+
# swapping the API client the script talks to COSMOS with. Reordering
|
|
35
|
+
# PYTHONPATH cannot fix this - the whole variable outranks the base venv -
|
|
36
|
+
# so the copy is removed at install time instead.
|
|
37
|
+
RESERVED_PACKAGES = ['openc3'].freeze
|
|
38
|
+
|
|
39
|
+
# Resolve a script's plugin venv and expose its packages to a child process.
|
|
40
|
+
# Returns the venv path when configured, or nil when the system environment
|
|
41
|
+
# should be used.
|
|
42
|
+
def self.configure_for_script(environment, name:, scope:, python_venv: nil)
|
|
43
|
+
venv_dir = resolve_script_venv(name: name, scope: scope, python_venv: python_venv)
|
|
44
|
+
return nil unless venv_dir
|
|
45
|
+
|
|
46
|
+
configure_environment(environment, venv_dir)
|
|
47
|
+
venv_dir
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def self.configure_environment(environment, venv_dir)
|
|
51
|
+
environment['VIRTUAL_ENV'] = venv_dir
|
|
52
|
+
environment['PATH'] = "#{venv_dir}/bin:#{ENV.fetch('PATH', '')}"
|
|
53
|
+
environment['PYTHONUSERBASE'] = venv_dir
|
|
54
|
+
|
|
55
|
+
site_packages = Dir.glob("#{venv_dir}/lib/python*/site-packages").first
|
|
56
|
+
# Prefer a PYTHONPATH the caller already seeded on `environment` over the
|
|
57
|
+
# ambient one. Script.process_suite sets it to ENV['PYTHONPATH'] || '.'
|
|
58
|
+
# before calling here, and reading ENV directly would drop that value.
|
|
59
|
+
existing_pythonpath = environment['PYTHONPATH'] || ENV.fetch('PYTHONPATH', '')
|
|
60
|
+
if site_packages
|
|
61
|
+
environment['PYTHONPATH'] = existing_pythonpath.empty? ? site_packages : "#{site_packages}:#{existing_pythonpath}"
|
|
62
|
+
else
|
|
63
|
+
environment['PYTHONPATH'] = existing_pythonpath.empty? ? nil : existing_pythonpath
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
environment
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Remove any RESERVED_PACKAGES a plugin installed into its own venv.
|
|
70
|
+
# Returns the names that were removed so callers can report them.
|
|
71
|
+
def self.purge_reserved_packages(venv_dir)
|
|
72
|
+
return [] if venv_dir.nil? || venv_dir.empty?
|
|
73
|
+
|
|
74
|
+
purged = []
|
|
75
|
+
RESERVED_PACKAGES.each do |package|
|
|
76
|
+
next unless package_installed?(venv_dir, package)
|
|
77
|
+
|
|
78
|
+
Logger.warn("Plugin venv #{venv_dir} declares '#{package}', which would shadow the " \
|
|
79
|
+
"system library. Removing it; the plugin will use the system #{package}.")
|
|
80
|
+
_output, status = Open3.capture2e('uv', 'pip', 'uninstall', '--python', venv_dir, package)
|
|
81
|
+
if status.success?
|
|
82
|
+
purged << package
|
|
83
|
+
else
|
|
84
|
+
Logger.error("Failed to remove '#{package}' from plugin venv #{venv_dir}")
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
purged
|
|
88
|
+
rescue => e
|
|
89
|
+
Logger.error("Could not purge reserved packages from #{venv_dir}: #{e.message}")
|
|
90
|
+
[]
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def self.package_installed?(venv_dir, package)
|
|
94
|
+
_output, status = Open3.capture2e('uv', 'pip', 'show', '--python', venv_dir, package)
|
|
95
|
+
status.success?
|
|
96
|
+
end
|
|
97
|
+
private_class_method :package_installed?
|
|
98
|
+
|
|
99
|
+
def self.plugin_venv_path(scope:, plugin_name:)
|
|
100
|
+
sanitized_name = "#{scope}__#{plugin_name}".tr('^a-zA-Z0-9_-', '_')
|
|
101
|
+
candidate = File.join(PLUGIN_VENVS_DIR, sanitized_name, '.venv')
|
|
102
|
+
candidate if File.directory?(candidate)
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def self.resolve_script_venv(name:, scope:, python_venv: nil)
|
|
106
|
+
target_name = name.split('/')[0].to_s.upcase
|
|
107
|
+
if target_name == TargetFile::TEMP_FOLDER && python_venv
|
|
108
|
+
# File.basename strips directory components; the tr() then whitelists the
|
|
109
|
+
# name down to the character set PluginModel.plugin_venv_name builds it
|
|
110
|
+
# from. That leaves no path separators and no glob metacharacters, so
|
|
111
|
+
# the value cannot escape PLUGIN_VENVS_DIR or widen the Dir.glob in
|
|
112
|
+
# configure_environment.
|
|
113
|
+
safe_name = File.basename(python_venv.to_s).tr('^a-zA-Z0-9_-', '_')
|
|
114
|
+
# The venv name is client-supplied, so it must also be confined to the
|
|
115
|
+
# caller's scope. Venv directories are named "<scope>__<plugin>" by
|
|
116
|
+
# PluginModel.plugin_venv_name; without this check a user in one scope
|
|
117
|
+
# could name another scope's venv and run against its packages.
|
|
118
|
+
return nil unless safe_name.start_with?("#{scope}__".tr('^a-zA-Z0-9_-', '_'))
|
|
119
|
+
|
|
120
|
+
candidate = File.join(PLUGIN_VENVS_DIR, safe_name, '.venv')
|
|
121
|
+
return candidate if File.directory?(candidate)
|
|
122
|
+
else
|
|
123
|
+
target_info = TargetModel.get(name: target_name, scope: scope)
|
|
124
|
+
if target_info && target_info['plugin']
|
|
125
|
+
return plugin_venv_path(scope: scope, plugin_name: target_info['plugin'])
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
nil
|
|
129
|
+
rescue => e
|
|
130
|
+
Logger.debug("Could not resolve plugin venv for script '#{name}': #{e.message}")
|
|
131
|
+
nil
|
|
132
|
+
end
|
|
133
|
+
private_class_method :resolve_script_venv
|
|
134
|
+
end
|
|
135
|
+
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -94,7 +94,11 @@ And so is this
|
|
|
94
94
|
# of the file and process the last line
|
|
95
95
|
if next_token.type == :EOF
|
|
96
96
|
if !line.empty?
|
|
97
|
-
|
|
97
|
+
# orig_line_no is normally set below (after this EOF check) but a final
|
|
98
|
+
# line that never reaches that assignment (e.g. a trailing bareword call
|
|
99
|
+
# with no parentheses and no newline at end of file) would yield nil.
|
|
100
|
+
# Fall back to the current token's start line so the line number is valid.
|
|
101
|
+
yield line, instrumentable, inside_begin, orig_line_no || token.location.start_line
|
|
98
102
|
end
|
|
99
103
|
break
|
|
100
104
|
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# encoding: ascii-8bit
|
|
2
|
+
|
|
3
|
+
# Copyright 2026 OpenC3, Inc.
|
|
4
|
+
# All Rights Reserved.
|
|
5
|
+
#
|
|
6
|
+
# This program is distributed in the hope that it will be useful,
|
|
7
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
8
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
9
|
+
# See LICENSE.md for more details.
|
|
10
|
+
#
|
|
11
|
+
# This file may also be used under the terms of a commercial license
|
|
12
|
+
# if purchased from OpenC3, Inc.
|
|
13
|
+
|
|
14
|
+
require 'uri'
|
|
15
|
+
require 'openc3/utilities/logger'
|
|
16
|
+
|
|
17
|
+
module OpenC3
|
|
18
|
+
class RubygemsUrl
|
|
19
|
+
DEFAULT = 'https://rubygems.org'
|
|
20
|
+
|
|
21
|
+
# Validate that a resolved rubygems_url is an http(s) URL before it is used
|
|
22
|
+
# as a Gem source. The value can come from a user-writable setting or ENV, so
|
|
23
|
+
# a malformed or non-http value is rejected and replaced with the default
|
|
24
|
+
# rather than passed through to RubyGems.
|
|
25
|
+
#
|
|
26
|
+
# @param rubygems_url [String] the resolved rubygems source url to validate
|
|
27
|
+
# @return [String] the original url if valid, otherwise DEFAULT
|
|
28
|
+
def self.validate(rubygems_url)
|
|
29
|
+
uri = URI.parse(rubygems_url)
|
|
30
|
+
unless uri.is_a?(URI::HTTP) && !uri.host.to_s.empty?
|
|
31
|
+
raise URI::InvalidURIError, "not an http(s) URL"
|
|
32
|
+
end
|
|
33
|
+
rubygems_url
|
|
34
|
+
rescue URI::InvalidURIError => e
|
|
35
|
+
Logger.error("Invalid rubygems_url '#{rubygems_url}' (#{e.message}); falling back to #{DEFAULT}")
|
|
36
|
+
DEFAULT
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|