コード例 #1
0
ファイル: config.py プロジェクト: rumale/trove
 def start_db_with_conf_changes(self, context, config_contents):
     """Restarts the PgSql instance with a new configuration."""
     LOG.info(_("{guest_id}: Going into restart mode for config file changes.").format(guest_id=CONF.guest_id))
     PgSqlAppStatus.get().begin_restart()
     self.stop_db(context)
     self.reset_configuration(context, config_contents)
     self.start_db(context)
     LOG.info(_("{guest_id}: Ending restart mode for config file changes.").format(guest_id=CONF.guest_id))
     PgSqlAppStatus.get().end_install_or_restart()
コード例 #2
0
 def restart(self, context):
     """Restart the PgSql service."""
     LOG.info(
         _("{guest_id}: Restarting database engine.").format(
             guest_id=CONF.guest_id, ))
     try:
         PgSqlAppStatus.get().begin_restart()
         self.stop_db(context)
         self.start_db(context)
     finally:
         PgSqlAppStatus.get().end_install_or_restart()
コード例 #3
0
ファイル: config.py プロジェクト: flg77/trove
 def start_db_with_conf_changes(self, context, config_contents):
     """Restarts the PgSql instance with a new configuration."""
     LOG.info(
         _("{guest_id}: Going into restart mode for config file changes.").
         format(guest_id=CONF.guest_id, ))
     PgSqlAppStatus.get().begin_restart()
     self.stop_db(context)
     self.reset_configuration(context, config_contents)
     self.start_db(context)
     LOG.info(
         _("{guest_id}: Ending restart mode for config file changes.").
         format(guest_id=CONF.guest_id, ))
     PgSqlAppStatus.get().end_install_or_restart()
コード例 #4
0
ファイル: process.py プロジェクト: AlexeyDeyneko/trove
 def restart(self, context):
     """Restart the PgSql service."""
     LOG.info(
         _("{guest_id}: Restarting database engine.").format(
             guest_id=CONF.guest_id,
         )
     )
     try:
         PgSqlAppStatus.get().begin_restart()
         self.stop_db(context)
         self.start_db(context)
     finally:
         PgSqlAppStatus.get().end_install_or_restart()
コード例 #5
0
ファイル: install.py プロジェクト: AlexeyDeyneko/trove
    def install(self, context, packages):
        """Install one or more packages that postgresql needs to run.

        The packages parameter is a string representing the package names that
        should be given to the system's package manager.
        """

        LOG.debug(
            "{guest_id}: Beginning PgSql package installation.".format(
                guest_id=CONF.guest_id
            )
        )
        PgSqlAppStatus.get().begin_install()
        packager = pkg.Package()
        if not packager.pkg_is_installed(packages):
            try:
                LOG.info(
                    _("{guest_id}: Installing ({packages}).").format(
                        guest_id=CONF.guest_id,
                        packages=packages,
                    )
                )
                packager.pkg_install(packages, {}, 1000)
            except (pkg.PkgAdminLockError, pkg.PkgPermissionError,
                    pkg.PkgPackageStateError, pkg.PkgNotFoundError,
                    pkg.PkgTimeout, pkg.PkgScriptletError,
                    pkg.PkgDownloadError, pkg.PkgSignError,
                    pkg.PkgBrokenError):
                LOG.exception(
                    "{guest_id}: There was a package manager error while "
                    "trying to install ({packages}).".format(
                        guest_id=CONF.guest_id,
                        packages=packages,
                    )
                )
                PgSqlAppStatus.get().end_install_or_restart()
                PgSqlAppStatus.get().set_status(
                    instance.ServiceStatuses.FAILED
                )
            except Exception:
                LOG.exception(
                    "{guest_id}: The package manager encountered an unknown "
                    "error while trying to install ({packages}).".format(
                        guest_id=CONF.guest_id,
                        packages=packages,
                    )
                )
                PgSqlAppStatus.get().end_install_or_restart()
                PgSqlAppStatus.get().set_status(
                    instance.ServiceStatuses.FAILED
                )
            else:
                self.start_db(context)
                PgSqlAppStatus.get().end_install_or_restart()
                LOG.debug(
                    "{guest_id}: Completed package installation.".format(
                        guest_id=CONF.guest_id,
                    )
                )
コード例 #6
0
    def install(self, context, packages):
        """Install one or more packages that postgresql needs to run.

        The packages parameter is a string representing the package names that
        should be given to the system's package manager.
        """

        LOG.debug(
            "{guest_id}: Beginning PgSql package installation.".format(
                guest_id=CONF.guest_id
            )
        )
        PgSqlAppStatus.get().begin_install()
        packager = pkg.Package()
        if not packager.pkg_is_installed(packages):
            try:
                LOG.info(
                    _("{guest_id}: Installing ({packages}).").format(
                        guest_id=CONF.guest_id,
                        packages=packages,
                    )
                )
                packager.pkg_install(packages, {}, 1000)
            except (pkg.PkgAdminLockError, pkg.PkgPermissionError,
                    pkg.PkgPackageStateError, pkg.PkgNotFoundError,
                    pkg.PkgTimeout, pkg.PkgScriptletError,
                    pkg.PkgDownloadError, pkg.PkgSignError,
                    pkg.PkgBrokenError):
                LOG.exception(
                    "{guest_id}: There was a package manager error while "
                    "trying to install ({packages}).".format(
                        guest_id=CONF.guest_id,
                        packages=packages,
                    )
                )
                PgSqlAppStatus.get().end_install_or_restart()
                PgSqlAppStatus.get().set_status(
                    instance.ServiceStatuses.FAILED
                )
            except Exception:
                LOG.exception(
                    "{guest_id}: The package manager encountered an unknown "
                    "error while trying to install ({packages}).".format(
                        guest_id=CONF.guest_id,
                        packages=packages,
                    )
                )
                PgSqlAppStatus.get().end_install_or_restart()
                PgSqlAppStatus.get().set_status(
                    instance.ServiceStatuses.FAILED
                )
            else:
                self.start_db(context)
                PgSqlAppStatus.get().end_install_or_restart()
                LOG.debug(
                    "{guest_id}: Completed package installation.".format(
                        guest_id=CONF.guest_id,
                    )
                )