Skip to content

Commit 6d91ef2

Browse files
committed
Fix python router logic
1 parent 4129e58 commit 6d91ef2

File tree

6 files changed

+892
-77
lines changed

6 files changed

+892
-77
lines changed

openc3/lib/openc3/microservices/interface_microservice.rb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@ def run
231231
cmd_name = msg_hash['cmd_name']
232232
manual = ConfigParser.handle_true_false(msg_hash['manual'])
233233
cmd_params = nil
234+
range_check = true
235+
raw = false
234236
cmd_buffer = nil
235237
hazardous_check = nil
236238
if msg_hash['cmd_params']
@@ -288,14 +290,13 @@ def run
288290
if @critical_commanding and @critical_commanding != 'OFF' and not release_critical
289291
restricted = command.restricted
290292
if hazardous or restricted or (@critical_commanding == 'ALL' and manual)
293+
cmd_type = 'NORMAL'
291294
if hazardous
292-
type = 'HAZARDOUS'
295+
cmd_type = 'HAZARDOUS'
293296
elsif restricted
294-
type = 'RESTRICTED'
295-
else
296-
type = 'NORMAL'
297+
cmd_type = 'RESTRICTED'
297298
end
298-
model = CriticalCmdModel.new(name: SecureRandom.uuid, type: type, interface_name: @interface.name, username: msg_hash['username'], cmd_hash: msg_hash, scope: @scope)
299+
model = CriticalCmdModel.new(name: SecureRandom.uuid, type: cmd_type, interface_name: @interface.name, username: msg_hash['username'], cmd_hash: msg_hash, scope: @scope)
299300
model.create
300301
@logger.info("Critical Cmd Pending: #{msg_hash['cmd_string']}", user: msg_hash['username'], scope: @scope)
301302
next "CriticalCmdError\n#{model.name}"
@@ -428,10 +429,12 @@ def run
428429
params = JSON.parse(msg_hash['params'], allow_nan: true, create_additions: true)
429430
end
430431
@router = @tlm.attempting(*params)
432+
next 'SUCCESS'
431433
end
432434
if msg_hash['disconnect']
433435
@logger.info "#{@router.name}: Disconnect requested"
434436
@tlm.disconnect(false)
437+
next 'SUCCESS'
435438
end
436439
if msg_hash.key?('log_stream')
437440
if msg_hash['log_stream'] == 'true'
@@ -441,6 +444,7 @@ def run
441444
@logger.info "#{@router.name}: Disable stream logging"
442445
@router.stop_raw_logging
443446
end
447+
next 'SUCCESS'
444448
end
445449
if msg_hash.key?('router_cmd')
446450
params = JSON.parse(msg_hash['router_cmd'], allow_nan: true, create_additions: true)

0 commit comments

Comments
 (0)