Exemple #1
0
    def _clean(self):

        self._print(_('= Clean Up ='))

        v1_database = self._database(self.prod_db_name)
        tmp_database = self._database(self.tmp_db_name)

        for upgrade_call, description in CLEAN_UPGRADE_CALLS:
            self._print(_('Cleaning: %(d)s') % {'d' : description})
            spinner = ThreadedSpinner(self.prompt)
            spinner.start()

            try:
                report = upgrade_call(v1_database, tmp_database)
            except:
                spinner.stop()
                spinner.clear()
                raise

            spinner.stop()
            spinner.clear()

            if report is None or report.success is None:
                self._print(_('Clean upgrade script did not indicate the result of the step'))
                raise InvalidStepReportException()

            if report.success:
                self._print_report_data(_('Messages'), report.messages)
                self._print_report_data(_('Warnings'), report.warnings)
            else:
                self._print_report_data(_('Warnings'), report.warnings)
                self._print_report_data(_('Errors'), report.errors)
                raise StepException(description)

            self.prompt.write('')
Exemple #2
0
    def _upgrade_files(self):
        """
        Runs all configured upgrade scripts for handling the filesystem.
        """

        self._print(_('= Upgrading Pulp Files ='))

        v1_database = self._database(self.prod_db_name)
        tmp_database = self._database(self.tmp_db_name)

        for upgrade_call, description in self.files_upgrade_calls:
            self._print(_('Upgrading: %(d)s') % {'d' : description})
            spinner = ThreadedSpinner(self.prompt)
            spinner.start()

            try:
                report = upgrade_call(v1_database, tmp_database)
            except:
                spinner.stop()
                spinner.clear()
                raise

            spinner.stop()
            spinner.clear()

            if report is None or report.success is None:
                # This should only happen during development if the script writer
                # didn't properly configure the report and must be fixed before
                # release
                self._print(_('Filesystem upgrade script did not indicate the result of the step'))
                raise InvalidStepReportException()

            if report.success:
                self._print_report_data(_('Messages'), report.messages)
                self._print_report_data(_('Warnings'), report.warnings)
            else:
                self._print_report_data(_('Warnings'), report.warnings)
                self._print_report_data(_('Errors'), report.errors)
                raise StepException(description)

            self.prompt.write('')
Exemple #3
0
    def _install(self):

        # Backup
        if self.backup_v1_db:
            self._print(_('Backing up the v1 database to %(db)s') % {'db' : self.v1_backup_db_name})

            spinner = ThreadedSpinner(self.prompt)
            spinner.start()
            self._backup_v1()
            spinner.stop()
            spinner.clear()
        else:
            self._print(_('The v1 database will not be backed up'))
            self.prompt.write('')

        # Install
        self._print(_('Installing the v2 Database'))

        spinner = ThreadedSpinner(self.prompt)
        spinner.start()
        self._install_v2()
        spinner.stop()
        spinner.clear()

        self.prompt.write('')

        # Clean Up
        self._print(_('Deleting v2 Temporary Database'))

        spinner = ThreadedSpinner(self.prompt)
        spinner.start()
        self._cleanup()
        spinner.stop()
        spinner.clear()

        self.prompt.write('')