openc3 5.0.6 → 5.0.7
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 +24 -0
- data/lib/openc3/models/process_status_model.rb +3 -1
- data/lib/openc3/models/target_model.rb +121 -4
- data/lib/openc3/version.rb +5 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19c4ca95f60633de6f38b56a72891bda7cdcdf0b902a16d52f6527966c213bab
|
4
|
+
data.tar.gz: 7ed07cc0014bd9ca27c57ff307cc879e385617339a6cb9b6c1fa891ab971a018
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc5c9ff0457266a17d4bef4f89c40fc99b851d4fe87d1d40783db3bdd84bf2581244e0055bfd6c5db706a60f35f4073d3eb0f9c0659a88a736bdc185051535bc
|
7
|
+
data.tar.gz: fdc7c1552371c0555f0d67e30d8f31b9e966986224ecec2ab0c5705e60f8f2d4708782fb26776d359514c696ea6632f380526f7ba7a6dc34d382d32eab3f536b
|
data/bin/openc3cli
CHANGED
@@ -521,6 +521,30 @@ if not ARGV[0].nil? # argument(s) given
|
|
521
521
|
puts "Valid redis tasks: keys, hget"
|
522
522
|
end
|
523
523
|
|
524
|
+
when 'removebase'
|
525
|
+
# Used to remove tool base to better support enterprise upgrade
|
526
|
+
scopes = OpenC3::ScopeModel.all
|
527
|
+
scopes.each do |scope_name, scope|
|
528
|
+
plugins = OpenC3::PluginModel.all(scope: scope_name)
|
529
|
+
plugins.each do |plugin_name, plugin|
|
530
|
+
if plugin["name"] =~ /tool-base/ and plugin["name"] !~ /enterprise/
|
531
|
+
unload_plugin(plugin_name, scope: scope_name)
|
532
|
+
end
|
533
|
+
end
|
534
|
+
end
|
535
|
+
|
536
|
+
when 'removeenterprise'
|
537
|
+
# Used to remove enterprise plugins to better support downgrade
|
538
|
+
scopes = OpenC3::ScopeModel.all
|
539
|
+
scopes.each do |scope_name, scope|
|
540
|
+
plugins = OpenC3::PluginModel.all(scope: scope_name)
|
541
|
+
plugins.each do |plugin_name, plugin|
|
542
|
+
if plugin["name"] =~ /enterprise/
|
543
|
+
unload_plugin(plugin_name, scope: scope_name)
|
544
|
+
end
|
545
|
+
end
|
546
|
+
end
|
547
|
+
|
524
548
|
else # Unknown task
|
525
549
|
print_usage()
|
526
550
|
abort("Unknown task: #{ARGV[0]}")
|
@@ -40,7 +40,9 @@ module OpenC3
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def self.all(scope:)
|
43
|
-
super("#{scope}__#{PRIMARY_KEY}")
|
43
|
+
all = super("#{scope}__#{PRIMARY_KEY}")
|
44
|
+
# Sort by the time and reverse to put newest (latest timestamp) on top
|
45
|
+
all.sort_by { |key, value| value['updated_at'] }.reverse
|
44
46
|
end
|
45
47
|
# END NOTE
|
46
48
|
|
@@ -82,13 +82,133 @@ module OpenC3
|
|
82
82
|
super("#{scope}__#{PRIMARY_KEY}")
|
83
83
|
end
|
84
84
|
|
85
|
+
# All targets with indication of modified targets
|
86
|
+
def self.all_modified(scope:)
|
87
|
+
targets = self.all(scope: scope)
|
88
|
+
targets.each { |target_name, target| target['modified'] = false }
|
89
|
+
|
90
|
+
rubys3_client = Aws::S3::Client.new
|
91
|
+
token = nil
|
92
|
+
while true
|
93
|
+
resp = rubys3_client.list_objects_v2({
|
94
|
+
bucket: 'config',
|
95
|
+
max_keys: 1000,
|
96
|
+
# The trailing slash is important!
|
97
|
+
prefix: "#{scope}/targets_modified/",
|
98
|
+
delimiter: '/',
|
99
|
+
continuation_token: token
|
100
|
+
})
|
101
|
+
resp.common_prefixes.each do |item|
|
102
|
+
# Results look like DEFAULT/targets_modified/INST/
|
103
|
+
# so split on '/' and pull out the last value
|
104
|
+
target_name = item.prefix.split('/')[-1]
|
105
|
+
# A target could have been deleted without removing the modified files
|
106
|
+
# Thus we have to check for the existance of the target_name key
|
107
|
+
if targets.has_key?(target_name)
|
108
|
+
targets[target_name]['modified'] = true
|
109
|
+
end
|
110
|
+
end
|
111
|
+
break unless resp.is_truncated
|
112
|
+
token = resp.next_continuation_token
|
113
|
+
end
|
114
|
+
# Sort (which turns hash to array) and return hash
|
115
|
+
# This enables a consistent listing of the targets
|
116
|
+
targets.sort.to_h
|
117
|
+
end
|
118
|
+
|
119
|
+
# Given target's modified file list
|
120
|
+
def self.modified_files(name, scope:)
|
121
|
+
modified = []
|
122
|
+
rubys3_client = Aws::S3::Client.new
|
123
|
+
token = nil
|
124
|
+
while true
|
125
|
+
resp = rubys3_client.list_objects_v2({
|
126
|
+
bucket: 'config',
|
127
|
+
max_keys: 1000,
|
128
|
+
# The trailing slash is important!
|
129
|
+
prefix: "#{scope}/targets_modified/#{name}/",
|
130
|
+
continuation_token: token
|
131
|
+
})
|
132
|
+
resp.contents.each do |item|
|
133
|
+
# Results look like DEFAULT/targets_modified/INST/procedures/new.rb
|
134
|
+
# so split on '/' and ignore the first two values
|
135
|
+
modified << item.key.split('/')[2..-1].join('/')
|
136
|
+
end
|
137
|
+
break unless resp.is_truncated
|
138
|
+
token = resp.next_continuation_token
|
139
|
+
end
|
140
|
+
# Sort to enable a consistent listing of the modified files
|
141
|
+
modified.sort
|
142
|
+
end
|
143
|
+
|
144
|
+
def self.delete_modified(name, scope:)
|
145
|
+
rubys3_client = Aws::S3::Client.new
|
146
|
+
token = nil
|
147
|
+
while true
|
148
|
+
resp = rubys3_client.list_objects_v2({
|
149
|
+
bucket: 'config',
|
150
|
+
max_keys: 1000,
|
151
|
+
# The trailing slash is important!
|
152
|
+
prefix: "#{scope}/targets_modified/#{name}/",
|
153
|
+
continuation_token: token
|
154
|
+
})
|
155
|
+
resp.contents.each do |item|
|
156
|
+
rubys3_client.delete_object(bucket: 'config', key: item.key)
|
157
|
+
end
|
158
|
+
break unless resp.is_truncated
|
159
|
+
token = resp.next_continuation_token
|
160
|
+
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
|
+
end
|
167
|
+
|
168
|
+
def self.download(name, scope:)
|
169
|
+
tmp_dir = Dir.mktmpdir
|
170
|
+
zip_filename = File.join(tmp_dir, "#{name}.zip")
|
171
|
+
Zip.continue_on_exists_proc = true
|
172
|
+
zip = Zip::File.open(zip_filename, Zip::File::CREATE)
|
173
|
+
|
174
|
+
rubys3_client = Aws::S3::Client.new
|
175
|
+
token = nil
|
176
|
+
# The trailing slash is important!
|
177
|
+
prefix = "#{scope}/targets_modified/#{name}/"
|
178
|
+
while true
|
179
|
+
resp = rubys3_client.list_objects_v2({
|
180
|
+
bucket: 'config',
|
181
|
+
max_keys: 1000,
|
182
|
+
prefix: prefix,
|
183
|
+
continuation_token: token
|
184
|
+
})
|
185
|
+
resp.contents.each do |item|
|
186
|
+
# item.key looks like DEFAULT/targets_modified/INST/screens/blah.txt
|
187
|
+
base_path = item.key.sub(prefix, '') # remove prefix
|
188
|
+
local_path = File.join(tmp_dir, base_path)
|
189
|
+
# Ensure dir structure exists, get_object fails if not
|
190
|
+
FileUtils.mkdir_p(File.dirname(local_path))
|
191
|
+
rubys3_client.get_object(bucket: 'config', key: item.key, response_target: local_path)
|
192
|
+
zip.add(base_path, local_path)
|
193
|
+
end
|
194
|
+
break unless resp.is_truncated
|
195
|
+
token = resp.next_continuation_token
|
196
|
+
end
|
197
|
+
zip.close
|
198
|
+
|
199
|
+
result = OpenStruct.new
|
200
|
+
result.filename = File.basename(zip_filename)
|
201
|
+
result.contents = File.read(zip_filename, mode: 'rb')
|
202
|
+
return result
|
203
|
+
end
|
204
|
+
|
85
205
|
# @return [Array] Array of all the packet names
|
86
206
|
def self.packet_names(target_name, type: :TLM, scope:)
|
87
207
|
raise "Unknown type #{type} for #{target_name}" unless VALID_TYPES.include?(type)
|
88
208
|
# If the key doesn't exist or if there are no packets we return empty array
|
89
209
|
Store.hkeys("#{scope}__openc3#{type.to_s.downcase}__#{target_name}").sort
|
90
210
|
end
|
91
|
-
|
211
|
+
|
92
212
|
# @return [Hash] Packet hash or raises an exception
|
93
213
|
def self.packet(target_name, packet_name, type: :TLM, scope:)
|
94
214
|
raise "Unknown type #{type} for #{target_name} #{packet_name}" unless VALID_TYPES.include?(type)
|
@@ -420,9 +540,6 @@ module OpenC3
|
|
420
540
|
end
|
421
541
|
|
422
542
|
def undeploy
|
423
|
-
# Note: The plugin_model undeploy method removes all the microservices first
|
424
|
-
# so we don't need to destroy them here
|
425
|
-
|
426
543
|
rubys3_client = Aws::S3::Client.new
|
427
544
|
prefix = "#{@scope}/targets/#{@name}/"
|
428
545
|
rubys3_client.list_objects(bucket: 'config', prefix: prefix).contents.each do |object|
|
data/lib/openc3/version.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# encoding: ascii-8bit
|
2
2
|
|
3
|
-
OPENC3_VERSION = '5.0.
|
3
|
+
OPENC3_VERSION = '5.0.7'
|
4
4
|
module OpenC3
|
5
5
|
module Version
|
6
6
|
MAJOR = '5'
|
7
7
|
MINOR = '0'
|
8
|
-
PATCH = '
|
8
|
+
PATCH = '7'
|
9
9
|
OTHER = ''
|
10
|
-
BUILD = '
|
10
|
+
BUILD = 'be957bd6e3c30c2e535b9ee8dfbeffe75c720874'
|
11
11
|
end
|
12
|
-
VERSION = '5.0.
|
13
|
-
GEM_VERSION = '5.0.
|
12
|
+
VERSION = '5.0.7'
|
13
|
+
GEM_VERSION = '5.0.7'
|
14
14
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openc3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Melton
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-
|
12
|
+
date: 2022-08-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|