implement deleting capsuls
This commit is contained in:
@ -161,6 +161,7 @@ def cron_task():
|
||||
index_to_send = i
|
||||
|
||||
if index_to_send > -1:
|
||||
print(f"cron_task: sending {warnings[index_to_send]['id']} warning email to {account['email']}.")
|
||||
current_app.config["FLASK_MAIL_INSTANCE"].send(
|
||||
Message(
|
||||
warnings[index_to_send]['subject'],
|
||||
@ -170,7 +171,10 @@ def cron_task():
|
||||
)
|
||||
get_model().set_account_balance_warning(account['email'], warnings[index_to_send]['id'])
|
||||
if index_to_send == len(warnings)-1:
|
||||
print('TODO: delete capsuls')
|
||||
for vm in vms:
|
||||
print(f"cron_task: deleting {vm['id']} ( {account['email']} ) due to negative account balance.")
|
||||
current_app.config["VIRTUALIZATION_MODEL"].destroy(email=account["email"], id=vm['id'])
|
||||
get_model().delete_vm(email=account["email"], id=vm['id'])
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user