Example #1
0
 def apply_updates(self):
     data_upgrade = upgradeinstance.IPAUpgrade(self.realm)
     try:
         data_upgrade.create_instance()
     except Exception as e:
         # very fatal errors only will raise exception
         raise RuntimeError("Update failed: %s" % e)
     installutils.store_version()
Example #2
0
 def apply_updates(self):
     schema_files = get_all_external_schema_files(paths.EXTERNAL_SCHEMA_DIR)
     data_upgrade = upgradeinstance.IPAUpgrade(self.realm, schema_files=schema_files)
     try:
         data_upgrade.create_instance()
     except Exception as e:
         # very fatal errors only will raise exception
         raise RuntimeError("Update failed: %s" % e)
     installutils.store_version()
Example #3
0
    def run(self):
        super(ServerUpgrade, self).run()

        api.bootstrap(in_server=True, context='updates')
        api.finalize()

        options = self.options

        if not options.skip_version_check:
            # check IPA version and data version
            try:
                installutils.check_version()
            except (installutils.UpgradePlatformError,
                    installutils.UpgradeDataNewerVersionError) as e:
                raise admintool.ScriptError(
                    'Unable to execute IPA upgrade: %s' % e, 1)
            except installutils.UpgradeMissingVersionError as e:
                self.log.info("Missing version: %s", e)
            except installutils.UpgradeVersionError:
                # Ignore other errors
                pass
        else:
            self.log.info("Skipping version check")
            self.log.warning("Upgrade without version check may break your "
                             "system")

        realm = krbV.default_context().default_realm
        schema_files = [os.path.join(ipautil.SHARE_DIR, f) for f
                        in dsinstance.ALL_SCHEMA_FILES]
        data_upgrade = IPAUpgrade(realm, schema_files=schema_files)

        try:
            data_upgrade.create_instance()
        except BadSyntax:
            raise admintool.ScriptError(
                'Bad syntax detected in upgrade file(s).', 1)
        except RuntimeError:
            raise admintool.ScriptError('IPA upgrade failed.', 1)
        else:
            if data_upgrade.modified:
                self.log.info('Update complete')
            else:
                self.log.info('Update complete, no data were modified')

        # store new data version after upgrade
        installutils.store_version()

        # FIXME: remove this when new installer will be ready
        # execute upgrade of configuration
        cmd = ['ipa-upgradeconfig', ]
        if options.verbose:
            cmd.append('--debug')
        if options.quiet:
            cmd.append('--quiet')

        self.log.info('Executing ipa-upgradeconfig, please wait')
        ipautil.run(cmd)
Example #4
0
 def apply_updates(self):
     schema_files = get_all_external_schema_files(paths.EXTERNAL_SCHEMA_DIR)
     data_upgrade = upgradeinstance.IPAUpgrade(self.realm,
                                               schema_files=schema_files)
     try:
         data_upgrade.create_instance()
     except Exception as e:
         # very fatal errors only will raise exception
         raise RuntimeError("Update failed: %s" % e)
     installutils.store_version()
Example #5
0
    def run(self):
        super(ServerUpgrade, self).run()

        api.bootstrap(in_server=True, context='updates')
        api.finalize()

        options = self.options

        if not options.skip_version_check:
            # check IPA version and data version
            try:
                installutils.check_version()
            except (installutils.UpgradePlatformError,
                    installutils.UpgradeDataNewerVersionError) as e:
                raise admintool.ScriptError(
                    'Unable to execute IPA upgrade: %s' % e, 1)
            except installutils.UpgradeMissingVersionError as e:
                self.log.info("Missing version: %s", e)
            except installutils.UpgradeVersionError:
                # Ignore other errors
                pass
        else:
            self.log.info("Skipping version check")
            self.log.warning("Upgrade without version check may break your "
                             "system")

        realm = krbV.default_context().default_realm
        data_upgrade = IPAUpgrade(realm)
        data_upgrade.create_instance()

        if data_upgrade.badsyntax:
            raise admintool.ScriptError(
                'Bad syntax detected in upgrade file(s).', 1)
        elif data_upgrade.upgradefailed:
            raise admintool.ScriptError('IPA upgrade failed.', 1)
        elif data_upgrade.modified:
            self.log.info('Data update complete')
        else:
            self.log.info('Data update complete, no data were modified')

        # store new data version after upgrade
        installutils.store_version()

        # FIXME: remove this when new installer will be ready
        # execute upgrade of configuration
        cmd = [
            'ipa-upgradeconfig',
        ]
        if options.verbose:
            cmd.append('--debug')
        if options.quiet:
            cmd.append('--quiet')

        self.log.info('Executing ipa-upgradeconfig, please wait')
        ipautil.run(cmd)