Commit 0da826ee authored by lukasburgey's avatar lukasburgey
Browse files

Add more complete logging

parent b8f754ad
...@@ -169,6 +169,8 @@ class VODeployment(Deployment): ...@@ -169,6 +169,8 @@ class VODeployment(Deployment):
if created: if created:
LOGGER.debug(deployment.msg('Created')) LOGGER.debug(deployment.msg('Created'))
else:
LOGGER.debug(deployment.msg('Accessed'))
LOGGER.debug('VO has services: %s', vo.services.all()) LOGGER.debug('VO has services: %s', vo.services.all())
for service in vo.services.all(): for service in vo.services.all():
...@@ -205,8 +207,9 @@ class ServiceDeployment(Deployment): ...@@ -205,8 +207,9 @@ class ServiceDeployment(Deployment):
if created: if created:
LOGGER.debug(deployment.msg('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) DeploymentState.get_or_create(user, service, deployment)
return deployment return deployment
...@@ -225,7 +228,7 @@ def inform_states_about_deletion(sender, instance=None, **kwargs): ...@@ -225,7 +228,7 @@ def inform_states_about_deletion(sender, instance=None, **kwargs):
_ = kwargs _ = kwargs
states = list(instance.states.all()) 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.state_target = NOT_DEPLOYED
instance.save() instance.save()
...@@ -415,6 +418,8 @@ class DeploymentState(models.Model): ...@@ -415,6 +418,8 @@ class DeploymentState(models.Model):
tpart() tpart()
else: else:
self._set_state(tpart) 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 # called when a client patches parts of this state
def state_changed(self): def state_changed(self):
...@@ -446,7 +451,6 @@ class DeploymentState(models.Model): ...@@ -446,7 +451,6 @@ class DeploymentState(models.Model):
# called when one of our deployments changes its state_target or when we are first created # called when one of our deployments changes its state_target or when we are first created
def dep_target_changed(self): def dep_target_changed(self):
LOGGER.debug(self.msg('Deployment changed')) 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() self._assure_credential_states_exist()
for cred_state in self.credential_states.all(): for cred_state in self.credential_states.all():
......
...@@ -456,11 +456,7 @@ class User(AbstractUser): ...@@ -456,11 +456,7 @@ class User(AbstractUser):
def delete(self, using=None, keep_parents=False): def delete(self, using=None, keep_parents=False):
if self.user_type == self.TYPE_CHOICE_USER: if self.user_type == self.TYPE_CHOICE_USER:
LOGGER.info('Deleting User %s', self) LOGGER.info(self.msg('Preparing user deletion'))
# TODO
# these deletions are a hack. django should (TM) be able to delete them itself
# but there seems to be a bug
self._delete_deployments() self._delete_deployments()
...@@ -468,9 +464,7 @@ class User(AbstractUser): ...@@ -468,9 +464,7 @@ class User(AbstractUser):
for key in self.ssh_keys.all(): for key in self.ssh_keys.all():
key.delete_key() key.delete_key()
for state in self.states.all(): LOGGER.info(self.msg('Deleting right now'))
state.publish_to_client()
super().delete(using, keep_parents) super().delete(using, keep_parents)
def add_key(self, key): def add_key(self, key):
......
...@@ -238,6 +238,8 @@ class DeploymentView(generics.RetrieveUpdateAPIView): ...@@ -238,6 +238,8 @@ class DeploymentView(generics.RetrieveUpdateAPIView):
if dep.state_target != old_state_target: if dep.state_target != old_state_target:
dep.target_changed() dep.target_changed()
else:
LOGGER.debug(dep.msg('Patched but the state_target was not changed'))
class DeploymentStateListView(generics.ListCreateAPIView): 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