Method: OpenC3::InterfaceModel#undeploy

Defined in:
lib/openc3/models/interface_model.rb

#undeployObject

Looks up the deployed MicroserviceModel and destroy the microservice model should should trigger the operator to kill the microservice that in turn will destroy the InterfaceStatusModel when a stop is called.



389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
# File 'lib/openc3/models/interface_model.rb', line 389

def undeploy
  type = self.class._get_type
  name = "#{@scope}__#{type}__#{@name}"
  model = MicroserviceModel.get_model(name: name, scope: @scope)
  if model
    model.destroy
    ConfigTopic.write({ kind: 'deleted', type: type.downcase, name: @name, plugin: @plugin }, scope: @scope)
  end

  if type == 'INTERFACE'
    status_model = InterfaceStatusModel.get_model(name: @name, scope: @scope)
  else
    status_model = RouterStatusModel.get_model(name: @name, scope: @scope)
  end
  status_model.destroy if status_model
rescue Exception => error
  Logger.error("Error undeploying interface/router model #{@name} in scope #{@scope} due to #{error}")
end