X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FRO.git;a=blobdiff_plain;f=osm_ro%2Fwim%2Fpersistence.py;h=636676a4cb112de778da96439ff6e55d89d6396c;hp=2e72640b6dc8f9c9107f61ae4702e8e7c68118c4;hb=433a63deecc246609abe0b070e6bf75826d03ef2;hpb=8a2d20725d5b3ad32946affd7bea7388434094e9 diff --git a/osm_ro/wim/persistence.py b/osm_ro/wim/persistence.py index 2e72640b..636676a4 100644 --- a/osm_ro/wim/persistence.py +++ b/osm_ro/wim/persistence.py @@ -45,7 +45,7 @@ from hashlib import sha1 from itertools import groupby from operator import itemgetter from sys import exc_info -from time import time +# from time import time from uuid import uuid1 as generate_uuid from six import reraise @@ -681,8 +681,7 @@ class WimPersistence(object): 'LIMIT {:d},{:d}').format( self.safe_str(wim_account_id), ','.join(type_options), - group_offset, group_limit - ) + group_offset, group_limit) join = 'vim_wim_actions NATURAL JOIN ({}) AS items'.format(items) db_results = self.db.get_rows( @@ -697,7 +696,7 @@ class WimPersistence(object): 'task_index': task_index} try: action = self.query_one('vim_wim_actions', WHERE=condition) - except: + except Exception: actions = self.query('vim_wim_actions', WHERE=condition) self.logger.error('More then one action found:\n%s', json.dumps(actions, indent=4)) @@ -710,8 +709,7 @@ class WimPersistence(object): updates = preprocess_record( merge_dicts(action, properties, extra=extra)) - num_changes = self.db.update_rows('vim_wim_actions', - UPDATE=updates, WHERE=condition) + num_changes = self.db.update_rows('vim_wim_actions', UPDATE=updates, WHERE=condition) if num_changes is None: raise UnexpectedDatabaseError( @@ -782,8 +780,7 @@ class WimPersistence(object): if not changes: return 0 - return self.db.update_rows('instance_actions', - WHERE={'uuid': uuid}, UPDATE=changes) + return self.db.update_rows('instance_actions', WHERE={'uuid': uuid}, UPDATE=changes) def get_only_vm_with_external_net(self, instance_net_id, **kwargs): """Return an instance VM if that is the only VM connected to an