Exemplo n.º 1
0
 def update(self, core_identity, validated_data):
     quota = validated_data.get('quota')
     data = {'quota': quota.id, 'identity': core_identity.id}
     event_serializer = QuotaAssignedSerializer(data=data)
     if not event_serializer.is_valid():
         raise serializers.ValidationError(
             "Validation of EventSerializer failed with: %s" %
             event_serializer.errors)
     try:
         event_serializer.save()
     except Exception as exc:
         logger.exception("Unexpected error occurred during Event save")
         raise serializers.ValidationError(
             "Unexpected error occurred during Event save: %s" % exc)
     # Synchronous call to EventTable -> Set Quota for Identity's CloudProvider -> Save the Quota to Identity
     identity = Identity.objects.get(uuid=core_identity.uuid)
     return identity
Exemplo n.º 2
0
 def update(self, core_identity, validated_data):
     quota = validated_data.get('quota')
     data = {'quota': quota.id, 'identity': core_identity.id}
     event_serializer = QuotaAssignedSerializer(data=data)
     if not event_serializer.is_valid():
         raise serializers.ValidationError(
             "Validation of EventSerializer failed with: %s"
             % event_serializer.errors)
     try:
         event_serializer.save()
     except Exception as exc:
         logger.exception("Unexpected error occurred during Event save")
         raise serializers.ValidationError(
             "Unexpected error occurred during Event save: %s" % exc)
     # Synchronous call to EventTable -> Set Quota for Identity's CloudProvider -> Save the Quota to Identity
     identity = Identity.objects.get(uuid=core_identity.uuid)
     return identity
Exemplo n.º 3
0
 def clean(self):
     quota = self.cleaned_data['quota']
     core_identity = self.instance
     data = {
         'quota': quota.id,
         'identity': core_identity.id,
         'update_method': 'admin'
     }
     event_serializer = QuotaAssignedSerializer(data=data)
     if not event_serializer.is_valid():
         raise forms.ValidationError(
             "Validation of EventSerializer failed with: %s" %
             event_serializer.errors)
     try:
         event_serializer.save()
     except Exception as exc:
         logger.exception("Unexpected error occurred during Event save")
         raise forms.ValidationError(
             "Unexpected error occurred during Event save: %s. See logs for details."
             % exc)
 def clean(self):
     quota = self.cleaned_data['quota']
     core_identity = self.instance
     data = {
         'quota': quota.id,
         'identity': core_identity.id,
         'update_method': 'admin'
     }
     event_serializer = QuotaAssignedSerializer(data=data)
     if not event_serializer.is_valid():
         raise forms.ValidationError(
             "Validation of EventSerializer failed with: %s" %
             event_serializer.errors
         )
     try:
         event_serializer.save()
     except Exception as exc:
         logger.exception("Unexpected error occurred during Event save")
         raise forms.ValidationError(
             "Unexpected error occurred during Event save: %s. See logs for details."
             % exc
         )