~ubuntu-branches/ubuntu/vivid/ceilometer/vivid-proposed

« back to all changes in this revision

Viewing changes to ceilometer/openstack/common/db/sqlalchemy/test_migrations.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2014-06-13 13:20:35 UTC
  • mfrom: (1.1.17)
  • Revision ID: package-import@ubuntu.com-20140613132035-42ibzh8j7ww2q31i
Tags: 2014.2~b1-0ubuntu1
* New upstream release.
* debian/control: Open up juno release
* debian/patches/fix-requirements.patch: Refreshed.
* debian/rules: Patch the ceilometer.conf.sample directly since
  the configuration files are generated by a tool.
* debian/ceilometer-common.install: Drop sources.json.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
import lockfile
23
23
from six import moves
 
24
from six.moves.urllib import parse
24
25
import sqlalchemy
25
26
import sqlalchemy.exc
26
27
 
27
28
from ceilometer.openstack.common.db.sqlalchemy import utils
28
 
from ceilometer.openstack.common.gettextutils import _
29
 
from ceilometer.openstack.common.py3kcompat import urlutils
 
29
from ceilometer.openstack.common.gettextutils import _LE
30
30
from ceilometer.openstack.common import test
31
31
 
32
32
LOG = logging.getLogger(__name__)
60
60
                path = lock_path or os.environ.get("CEILOMETER_LOCK_PATH")
61
61
                lock = lockfile.FileLock(os.path.join(path, lock_prefix))
62
62
                with lock:
63
 
                    LOG.debug(_('Got lock "%s"') % f.__name__)
 
63
                    LOG.debug('Got lock "%s"' % f.__name__)
64
64
                    return f(*args, **kwargs)
65
65
            finally:
66
 
                LOG.debug(_('Lock released "%s"') % f.__name__)
 
66
                LOG.debug('Lock released "%s"' % f.__name__)
67
67
        return wrapper
68
68
    return decorator
69
69
 
153
153
    def _reset_databases(self):
154
154
        for key, engine in self.engines.items():
155
155
            conn_string = self.test_databases[key]
156
 
            conn_pieces = urlutils.urlparse(conn_string)
 
156
            conn_pieces = parse.urlparse(conn_string)
157
157
            engine.dispose()
158
158
            if conn_string.startswith('sqlite'):
159
159
                # We can just delete the SQLite database, which is
264
264
                if check:
265
265
                    check(engine, data)
266
266
        except Exception:
267
 
            LOG.error("Failed to migrate to version %s on engine %s" %
 
267
            LOG.error(_LE("Failed to migrate to version %s on engine %s") %
268
268
                      (version, engine))
269
269
            raise