Beispiel #1
0
    def _check_versions(self, ignore_missing_tables=False):
        """Check the versions of objects.

        Check that the object versions are compatible with this release
        of ironic. It does this by comparing the objects' .version field
        in the database, with the expected versions of these objects.

        If it isn't compatible, we exit the program, returning 2.
        """
        if migration.version() is None:
            # no tables, nothing to check
            return

        if ignore_missing_tables:
            ignore_models = NEW_MODELS
        else:
            ignore_models = ()

        try:
            if not dbapi.check_versions(ignore_models=ignore_models):
                sys.stderr.write(
                    _('The database is not compatible with this '
                      'release of ironic (%s). Please run '
                      '"ironic-dbsync online_data_migrations" using '
                      'the previous release.\n') %
                    version.version_info.release_string())
                # NOTE(rloo): We return 1 in online_data_migrations() to
                # indicate that there are more objects to migrate,
                # so don't use 1 here.
                sys.exit(2)
        except exception.DatabaseVersionTooOld:
            sys.stderr.write(
                _('The database version is not compatible with this '
                  'release of ironic (%s). This can happen if you are '
                  'attempting to upgrade from a version older than '
                  'the previous release (skip versions upgrade). '
                  'This is an unsupported upgrade method. '
                  'Please run "ironic-dbsync upgrade" using the previous '
                  'releases for a fast-forward upgrade.\n') %
                version.version_info.release_string())
            sys.exit(2)
Beispiel #2
0
    def _check_versions(self):
        """Check the versions of objects.

        Check that the object versions are compatible with this release
        of ironic. It does this by comparing the objects' .version field
        in the database, with the expected versions of these objects.

        If it isn't compatible, we exit the program, returning 2.
        """
        if migration.version() is None:
            # no tables, nothing to check
            return

        if not dbapi.check_versions():
            sys.stderr.write(
                _('The database is not compatible with this '
                  'release of ironic (%s). Please run '
                  '"ironic-dbsync online_data_migrations" using '
                  'the previous release.\n') %
                version.version_info.release_string())
            # NOTE(rloo): We return 1 in online_data_migrations() to indicate
            # that there are more objects to migrate, so don't use 1 here.
            sys.exit(2)
Beispiel #3
0
    def check_obj_versions(self, ignore_missing_tables=False):
        """Check the versions of objects.

        Check that the object versions are compatible with this release
        of ironic. It does this by comparing the objects' .version field
        in the database, with the expected versions of these objects.

        Returns None if compatible; a string describing the issue otherwise.
        """
        if migration.version() is None:
            # no tables, nothing to check
            return

        if ignore_missing_tables:
            ignore_models = NEW_MODELS
        else:
            ignore_models = ()

        msg = None
        try:
            if not dbapi.check_versions(ignore_models=ignore_models):
                msg = (_('The database is not compatible with this '
                         'release of ironic (%s). Please run '
                         '"ironic-dbsync online_data_migrations" using '
                         'the previous release.\n') %
                       version.version_info.release_string())
        except exception.DatabaseVersionTooOld:
            msg = (_('The database version is not compatible with this '
                     'release of ironic (%s). This can happen if you are '
                     'attempting to upgrade from a version older than '
                     'the previous release (skip versions upgrade). '
                     'This is an unsupported upgrade method. '
                     'Please run "ironic-dbsync upgrade" using the previous '
                     'releases for a fast-forward upgrade.\n') %
                   version.version_info.release_string())

        return msg
Beispiel #4
0
    def check_obj_versions(self, ignore_missing_tables=False):
        """Check the versions of objects.

        Check that the object versions are compatible with this release
        of ironic. It does this by comparing the objects' .version field
        in the database, with the expected versions of these objects.

        Returns None if compatible; a string describing the issue otherwise.
        """
        if migration.version() is None:
            # no tables, nothing to check
            return

        if ignore_missing_tables:
            ignore_models = NEW_MODELS
        else:
            ignore_models = ()

        msg = None
        try:
            if not dbapi.check_versions(ignore_models=ignore_models):
                msg = (_('The database is not compatible with this '
                         'release of ironic (%s). Please run '
                         '"ironic-dbsync online_data_migrations" using '
                         'the previous release.\n')
                       % version.version_info.release_string())
        except exception.DatabaseVersionTooOld:
            msg = (_('The database version is not compatible with this '
                     'release of ironic (%s). This can happen if you are '
                     'attempting to upgrade from a version older than '
                     'the previous release (skip versions upgrade). '
                     'This is an unsupported upgrade method. '
                     'Please run "ironic-dbsync upgrade" using the previous '
                     'releases for a fast-forward upgrade.\n')
                   % version.version_info.release_string())

        return msg
Beispiel #5
0
 def test_upgrade_and_version(self):
     migration.upgrade('head')
     v = migration.version()
     self.assertTrue(v)
Beispiel #6
0
 def version(self):
     print(migration.version())
Beispiel #7
0
 def test_upgrade_and_version(self):
     migration.upgrade('head')
     v = migration.version()
     self.assertTrue(v)
Beispiel #8
0
 def version(self):
     print(migration.version())