Commit 0da826ee authored by lukas.burgey's avatar lukas.burgey

Add more complete logging

parent b8f754ad
......@@ -169,6 +169,8 @@ class VODeployment(Deployment):
if created:
LOGGER.debug(deployment.msg('Created'))
else:
LOGGER.debug(deployment.msg('Accessed'))
LOGGER.debug('VO has services: %s', vo.services.all())
for service in vo.services.all():
......@@ -205,8 +207,9 @@ class ServiceDeployment(Deployment):
if created:
LOGGER.debug(deployment.msg('Created'))
else:
LOGGER.debug(deployment.msg('Accessed'))
LOGGER.debug('Service exists: %s', service)
DeploymentState.get_or_create(user, service, deployment)
return deployment
......@@ -225,7 +228,7 @@ def inform_states_about_deletion(sender, instance=None, **kwargs):
_ = kwargs
states = list(instance.states.all())
LOGGER.debug(instance.msg('Deleted deployment still has states: {}'.format(states)))
LOGGER.debug(instance.msg('Informing states about my deletion: {}'.format(states)))
instance.state_target = NOT_DEPLOYED
instance.save()
......@@ -415,6 +418,8 @@ class DeploymentState(models.Model):
tpart()
else:
self._set_state(tpart)
else:
LOGGER.debug(self.msg('No transition to apply for: Target = {} - State = {}'.format(self.state_target, self.state)))
# called when a client patches parts of this state
def state_changed(self):
......@@ -446,7 +451,6 @@ class DeploymentState(models.Model):
# called when one of our deployments changes its state_target or when we are first created
def dep_target_changed(self):
LOGGER.debug(self.msg('Deployment changed'))
LOGGER.debug('My target: %s - My state: %s - My deps: %s', self.state_target, self.state, self.deployments.all())
self._assure_credential_states_exist()
for cred_state in self.credential_states.all():
......
......@@ -456,11 +456,7 @@ class User(AbstractUser):
def delete(self, using=None, keep_parents=False):
if self.user_type == self.TYPE_CHOICE_USER:
LOGGER.info('Deleting User %s', self)
# TODO
# these deletions are a hack. django should (TM) be able to delete them itself
# but there seems to be a bug
LOGGER.info(self.msg('Preparing user deletion'))
self._delete_deployments()
......@@ -468,9 +464,7 @@ class User(AbstractUser):
for key in self.ssh_keys.all():
key.delete_key()
for state in self.states.all():
state.publish_to_client()
LOGGER.info(self.msg('Deleting right now'))
super().delete(using, keep_parents)
def add_key(self, key):
......
......@@ -238,6 +238,8 @@ class DeploymentView(generics.RetrieveUpdateAPIView):
if dep.state_target != old_state_target:
dep.target_changed()
else:
LOGGER.debug(dep.msg('Patched but the state_target was not changed'))
class DeploymentStateListView(generics.ListCreateAPIView):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment