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)
Exemple #2
0
    def run(self):
        super(LDAPUpdater_Upgrade, self).run()
        options = self.options

        updates = None
        realm = krbV.default_context().default_realm
        upgrade = IPAUpgrade(realm, self.files, live_run=not options.test)
        upgrade.create_instance()
        upgradefailed = upgrade.upgradefailed

        if upgrade.badsyntax:
            raise admintool.ScriptError(
                'Bad syntax detected in upgrade file(s).', 1)
        elif upgrade.upgradefailed:
            raise admintool.ScriptError('IPA upgrade failed.', 1)
        elif upgrade.modified and options.test:
            self.info('Update complete, changes to be made, test mode')
            return 2
Exemple #3
0
    def run(self):
        super(LDAPUpdater_Upgrade, self).run()
        options = self.options

        realm = krbV.default_context().default_realm
        upgrade = IPAUpgrade(realm,
                             self.files,
                             schema_files=options.schema_files)
        upgrade.create_instance()

        if upgrade.badsyntax:
            raise admintool.ScriptError(
                'Bad syntax detected in upgrade file(s).', 1)
        elif upgrade.upgradefailed:
            raise admintool.ScriptError('IPA upgrade failed.', 1)
        elif upgrade.modified:
            self.log.info('Update complete')
        else:
            self.log.info('Update complete, no data were modified')
Exemple #4
0
    def run(self):
        super(LDAPUpdater_Upgrade, self).run()
        options = self.options

        realm = api.env.realm
        upgrade = IPAUpgrade(realm,
                             self.files,
                             schema_files=options.schema_files)

        try:
            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 upgrade.modified:
                self.log.info('Update complete')
            else:
                self.log.info('Update complete, no data were modified')