openc3 5.0.8 → 5.0.10
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/bin/openc3cli +128 -95
- data/data/config/_id_items.yaml +2 -1
- data/data/config/_id_params.yaml +2 -1
- data/data/config/_items.yaml +2 -1
- data/data/config/_params.yaml +2 -1
- data/data/config/command_modifiers.yaml +30 -0
- data/data/config/item_modifiers.yaml +10 -0
- data/data/config/microservice.yaml +12 -0
- data/data/config/param_item_modifiers.yaml +10 -0
- data/data/config/plugins.yaml +0 -9
- data/data/config/telemetry_modifiers.yaml +10 -0
- data/data/config/widgets.yaml +49 -73
- data/ext/openc3/ext/packet/packet.c +20 -2
- data/ext/openc3/ext/structure/structure.c +12 -17
- data/lib/openc3/accessors/accessor.rb +71 -0
- data/lib/openc3/accessors/binary_accessor.rb +1226 -0
- data/lib/openc3/accessors/cbor_accessor.rb +83 -0
- data/lib/openc3/accessors/html_accessor.rb +28 -0
- data/lib/openc3/accessors/json_accessor.rb +131 -0
- data/lib/openc3/accessors/xml_accessor.rb +67 -0
- data/lib/openc3/accessors.rb +23 -0
- data/lib/openc3/api/cmd_api.rb +5 -2
- data/lib/openc3/api/interface_api.rb +15 -0
- data/lib/openc3/api/limits_api.rb +3 -3
- data/lib/openc3/config/config_parser.rb +10 -4
- data/lib/openc3/core_ext/file.rb +5 -0
- data/lib/openc3/core_ext/tempfile.rb +20 -0
- data/lib/openc3/io/json_rpc.rb +3 -3
- data/lib/openc3/microservices/cleanup_microservice.rb +7 -5
- data/lib/openc3/models/cvt_model.rb +1 -10
- data/lib/openc3/models/interface_model.rb +41 -0
- data/lib/openc3/models/microservice_model.rb +33 -1
- data/lib/openc3/models/plugin_model.rb +1 -1
- data/lib/openc3/models/target_model.rb +85 -68
- data/lib/openc3/packets/binary_accessor.rb +2 -1207
- data/lib/openc3/packets/packet.rb +106 -6
- data/lib/openc3/packets/packet_config.rb +30 -7
- data/lib/openc3/packets/parsers/limits_response_parser.rb +1 -3
- data/lib/openc3/packets/parsers/processor_parser.rb +1 -2
- data/lib/openc3/packets/parsers/xtce_parser.rb +68 -3
- data/lib/openc3/packets/structure.rb +39 -14
- data/lib/openc3/packets/structure_item.rb +15 -1
- data/lib/openc3/script/storage.rb +19 -1
- data/lib/openc3/utilities/local_mode.rb +521 -0
- data/lib/openc3/utilities/simulated_target.rb +3 -2
- data/lib/openc3/utilities/target_file.rb +146 -0
- data/lib/openc3/version.rb +5 -5
- data/lib/openc3.rb +1 -0
- metadata +45 -7
@@ -24,6 +24,7 @@ require 'openc3/models/microservice_model'
|
|
24
24
|
require 'openc3/topics/limits_event_topic'
|
25
25
|
require 'openc3/topics/config_topic'
|
26
26
|
require 'openc3/system'
|
27
|
+
require 'openc3/utilities/local_mode'
|
27
28
|
require 'openc3/utilities/s3'
|
28
29
|
require 'openc3/utilities/zip'
|
29
30
|
require 'fileutils'
|
@@ -87,29 +88,36 @@ module OpenC3
|
|
87
88
|
targets = self.all(scope: scope)
|
88
89
|
targets.each { |target_name, target| target['modified'] = false }
|
89
90
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
91
|
+
if ENV['OPENC3_LOCAL_MODE']
|
92
|
+
modified_targets = OpenC3::LocalMode.modified_targets(scope: scope)
|
93
|
+
modified_targets.each do |target_name|
|
94
|
+
targets[target_name]['modified'] = true if targets[target_name]
|
95
|
+
end
|
96
|
+
else
|
97
|
+
rubys3_client = Aws::S3::Client.new
|
98
|
+
token = nil
|
99
|
+
while true
|
100
|
+
resp = rubys3_client.list_objects_v2({
|
101
|
+
bucket: 'config',
|
102
|
+
max_keys: 1000,
|
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
|
109
117
|
end
|
118
|
+
break unless resp.is_truncated
|
119
|
+
token = resp.next_continuation_token
|
110
120
|
end
|
111
|
-
break unless resp.is_truncated
|
112
|
-
token = resp.next_continuation_token
|
113
121
|
end
|
114
122
|
# Sort (which turns hash to array) and return hash
|
115
123
|
# This enables a consistent listing of the targets
|
@@ -117,31 +125,41 @@ module OpenC3
|
|
117
125
|
end
|
118
126
|
|
119
127
|
# Given target's modified file list
|
120
|
-
def self.modified_files(
|
128
|
+
def self.modified_files(target_name, scope:)
|
121
129
|
modified = []
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
130
|
+
|
131
|
+
if ENV['OPENC3_LOCAL_MODE']
|
132
|
+
modified = OpenC3::LocalMode.modified_files(target_name, scope: scope)
|
133
|
+
else
|
134
|
+
rubys3_client = Aws::S3::Client.new
|
135
|
+
token = nil
|
136
|
+
while true
|
137
|
+
resp = rubys3_client.list_objects_v2({
|
138
|
+
bucket: 'config',
|
139
|
+
max_keys: 1000,
|
140
|
+
# The trailing slash is important!
|
141
|
+
prefix: "#{scope}/targets_modified/#{target_name}/",
|
142
|
+
continuation_token: token
|
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
|
136
151
|
end
|
137
|
-
break unless resp.is_truncated
|
138
|
-
token = resp.next_continuation_token
|
139
152
|
end
|
140
153
|
# Sort to enable a consistent listing of the modified files
|
141
154
|
modified.sort
|
142
155
|
end
|
143
156
|
|
144
|
-
def self.delete_modified(
|
157
|
+
def self.delete_modified(target_name, scope:)
|
158
|
+
if ENV['OPENC3_LOCAL_MODE']
|
159
|
+
OpenC3::LocalMode.delete_modified(target_name, scope: scope)
|
160
|
+
end
|
161
|
+
|
162
|
+
# Delete the remote files as well
|
145
163
|
rubys3_client = Aws::S3::Client.new
|
146
164
|
token = nil
|
147
165
|
while true
|
@@ -149,7 +167,7 @@ module OpenC3
|
|
149
167
|
bucket: 'config',
|
150
168
|
max_keys: 1000,
|
151
169
|
# The trailing slash is important!
|
152
|
-
prefix: "#{scope}/targets_modified/#{
|
170
|
+
prefix: "#{scope}/targets_modified/#{target_name}/",
|
153
171
|
continuation_token: token
|
154
172
|
})
|
155
173
|
resp.contents.each do |item|
|
@@ -158,41 +176,40 @@ module OpenC3
|
|
158
176
|
break unless resp.is_truncated
|
159
177
|
token = resp.next_continuation_token
|
160
178
|
end
|
161
|
-
# rubys3_client = Aws::S3::Client.new
|
162
|
-
# prefix = "#{scope}/targets_modified/#{name}/"
|
163
|
-
# rubys3_client.list_objects(bucket: 'config', prefix: prefix).contents.each do |object|
|
164
|
-
# rubys3_client.delete_object(bucket: 'config', key: object.key)
|
165
|
-
# end
|
166
179
|
end
|
167
180
|
|
168
|
-
def self.download(
|
181
|
+
def self.download(target_name, scope:)
|
169
182
|
tmp_dir = Dir.mktmpdir
|
170
|
-
zip_filename = File.join(tmp_dir, "#{
|
183
|
+
zip_filename = File.join(tmp_dir, "#{target_name}.zip")
|
171
184
|
Zip.continue_on_exists_proc = true
|
172
185
|
zip = Zip::File.open(zip_filename, Zip::File::CREATE)
|
173
186
|
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
187
|
+
if ENV['OPENC3_LOCAL_MODE']
|
188
|
+
OpenC3::LocalMode.zip_target(target_name, zip, scope: scope)
|
189
|
+
else
|
190
|
+
rubys3_client = Aws::S3::Client.new
|
191
|
+
token = nil
|
192
|
+
# The trailing slash is important!
|
193
|
+
prefix = "#{scope}/targets_modified/#{target_name}/"
|
194
|
+
while true
|
195
|
+
resp = rubys3_client.list_objects_v2({
|
196
|
+
bucket: 'config',
|
197
|
+
max_keys: 1000,
|
198
|
+
prefix: prefix,
|
199
|
+
continuation_token: token
|
200
|
+
})
|
201
|
+
resp.contents.each do |item|
|
202
|
+
# item.key looks like DEFAULT/targets_modified/INST/screens/blah.txt
|
203
|
+
base_path = item.key.sub(prefix, '') # remove prefix
|
204
|
+
local_path = File.join(tmp_dir, base_path)
|
205
|
+
# Ensure dir structure exists, get_object fails if not
|
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
|
193
212
|
end
|
194
|
-
break unless resp.is_truncated
|
195
|
-
token = resp.next_continuation_token
|
196
213
|
end
|
197
214
|
zip.close
|
198
215
|
|