2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-25 11:01:09 +00:00

enable ability to clean up assets

This commit is contained in:
tkucherera 2024-10-22 12:05:23 -04:00
parent b99e4c94a0
commit ab0f48f351

View File

@ -72,6 +72,7 @@ import struct
import sys
import uuid
import yaml
import shutil
pluginmap = {}
@ -1308,8 +1309,14 @@ class Staging:
file = None
return False
def deldirectory(self):
pass
@staticmethod
def remove_directory(directory):
storage_folder = '/var/lib/confluent/client_assets/' + directory
if os.path.exists(storage_folder):
shutil.rmtree(storage_folder)
else:
raise FileNotFoundError
return directory
def handle_staging(pathcomponents, operation, configmanager, inputdata):
'''
@ -1348,9 +1355,12 @@ def handle_staging(pathcomponents, operation, configmanager, inputdata):
yield msg.FileUploadProgress(100)
elif operation == 'retrieve':
pass
return
elif operation == 'delete':
if len(pathcomponents) == 3:
asset = Staging.remove_directory(pathcomponents[2])
yield msg.DeletedResource(asset)
else:
raise Exception("Invalid url")
def handle_path(path, operation, configmanager, inputdata=None, autostrip=True):
"""Given a full path request, return an object.