From 08c0c980ce607746e0bce6965a30a1d6f95a355a Mon Sep 17 00:00:00 2001 From: Sofia Papagiannaki Date: Thu, 25 Jul 2013 17:15:48 +0300 Subject: [PATCH] pithos: Fix reconcile resources command * Provision quantity sent should not be of type Decimal (not JSON serializable) * Fix check for user existance in the database --- .../api/management/commands/reconcile-resources-pithos.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/snf-pithos-app/pithos/api/management/commands/reconcile-resources-pithos.py b/snf-pithos-app/pithos/api/management/commands/reconcile-resources-pithos.py index 63a0c5f93..b9fa0418c 100644 --- a/snf-pithos-app/pithos/api/management/commands/reconcile-resources-pithos.py +++ b/snf-pithos-app/pithos/api/management/commands/reconcile-resources-pithos.py @@ -77,8 +77,10 @@ class Command(NoArgsCommand): users = set(db_usage.keys()) if userid and userid not in users: - self.stdout.write("User '%s' does not exist in DB!\n" % userid) - return + if backend._lookup_account(userid) is None: + self.stdout.write("User '%s' does not exist in DB!\n" % + userid) + return # Get holding from Quotaholder try: @@ -161,4 +163,4 @@ def create_provision(provision_info): return {"holder": user, "source": DEFAULT_SOURCE, "resource": resource, - "quantity": db_value - qh_value} + "quantity": int(db_value - qh_value)} -- GitLab