Method: OpenC3::MicroserviceModel#undeploy

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

#undeployObject



269
270
271
272
273
274
275
276
277
278
279
# File 'lib/openc3/models/microservice_model.rb', line 269

def undeploy
  prefix = "#{@scope}/microservices/#{@name}/"
  @bucket.list_objects(bucket: ENV['OPENC3_CONFIG_BUCKET'], prefix: prefix).each do |object|
    @bucket.delete_object(bucket: ENV['OPENC3_CONFIG_BUCKET'], key: object.key)
  end
  config = { kind: 'deleted', type: 'microservice', name: @name }
  config[:plugin] = @plugin if @plugin
  ConfigTopic.write(config, scope: @scope)
rescue Exception => error
  Logger.error("Error undeploying microservice model #{@name} in scope #{@scope} due to #{error}")
end