Method: OpenC3::ToolModel#undeploy

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

#undeployObject



280
281
282
283
284
285
286
287
288
289
290
291
# File 'lib/openc3/models/tool_model.rb', line 280

def undeploy
  if @folder_name and @folder_name.to_s.length > 0
    bucket = Bucket.getClient
    prefix = "#{@folder_name}/"
    bucket.list_objects(bucket: ENV['OPENC3_TOOLS_BUCKET'], prefix: prefix).each do |object|
      bucket.delete_object(bucket: ENV['OPENC3_TOOLS_BUCKET'], key: object.key)
      ConfigTopic.write({ kind: 'deleted', type: 'tool', name: @folder_name, plugin: @plugin }, scope: @scope)
    end
  end
rescue Exception => e
  Logger.error("Error undeploying tool model #{@name} in scope #{@scope} due to #{e}")
end