Remove user from opennebula also

This commit is contained in:
PCoder 2019-04-28 23:57:39 +02:00
parent c8bd3f97c6
commit 591614ade5

View file

@ -1,4 +1,5 @@
import logging import logging
import oca
import sys import sys
import stripe import stripe
@ -7,6 +8,7 @@ from membership.models import CustomUser
from hosting.models import ( from hosting.models import (
HostingOrder, HostingBill, VMDetail, UserCardDetail, UserHostingKey HostingOrder, HostingBill, VMDetail, UserCardDetail, UserHostingKey
) )
from opennebula_api.models import OpenNebulaManager
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -123,6 +125,13 @@ class Command(BaseCommand):
# delete CustomUesr # delete CustomUesr
cus_user.delete() cus_user.delete()
# remove user from OpenNebula
manager = OpenNebulaManager()
manager.oneadmin_client.call(
oca.User.METHODS['delete'], email
)
logger.debug("Deleted {} SUCCESSFULLY.".format(email)) logger.debug("Deleted {} SUCCESSFULLY.".format(email))
except Exception as e: except Exception as e:
print(" *** Error occurred. Details {}".format(str(e))) print(" *** Error occurred. Details {}".format(str(e)))