示例#1
0
 def _misc(self):
     if self.environment.get(oprovisioncons.ConfigEnv.PROVISION_DB):
         self._provisioning.provision()
     if self.environment.get(oprovisioncons.ConfigEnv.PROVISION_USER):
         self._provisioning.createUser()
     if self._provisioning.databaseRenamed:
         osetuputil.addExitCode(
             environment=self.environment,
             code=(
                 osetupcons.Const.
                 EXIT_CODE_PROVISIONING_EXISTING_RESOURCES_FOUND
             )
         )
         raise RuntimeError(
             _(
                 'Existing resources found, new ones created: \n'
                 'database {database} user {user}'
             ).format(
                 database=self.environment[
                     oprovisioncons.ProvDBEnv.DATABASE
                 ],
                 user=self.environment[
                     oprovisioncons.ProvDBEnv.USER
                 ],
             )
         )
     if self.environment.get(oprovisioncons.ConfigEnv.ADD_TO_PG_HBA):
         with transaction.Transaction() as localtransaction:
             self._provisioning.addPgHbaDatabaseAccess(
                 transaction=localtransaction,
             )
     if self.environment.get(oprovisioncons.ConfigEnv.GRANT_READONLY):
         self._provisioning.grantReadOnlyAccessToUser()
     self._provisioning.restartPG()
示例#2
0
文件: misc.py 项目: jtux270/translate
    def _setup(self):
        self.environment[osetupcons.CoreEnv.GENERATE_POSTINSTALL] = False
        if not os.path.exists(
                osetupcons.FileLocations.OVIRT_SETUP_POST_INSTALL_CONFIG):
            self.logger.error(_('Could not detect a completed product setup'))
            self.dialog.note(
                text=_('Please use the cleanup utility only after a setup '
                       'or after an upgrade from an older installation.'))
            osetuputil.addExitCode(
                environment=self.environment,
                code=osetupcons.Const.EXIT_CODE_REMOVE_WITHOUT_SETUP)
            raise RuntimeError(_('Could not detect product setup'))

        rpm_v = distutils.version.LooseVersion(
            osetupcons.Const.RPM_VERSION).version[:3]
        inst_v = distutils.version.LooseVersion(self.environment[
            osetupcons.CoreEnv.ORIGINAL_GENERATED_BY_VERSION]).version[:3]

        if (rpm_v[:2] != inst_v[:2]) or (rpm_v < inst_v):
            self.logger.error(
                _('Cleanup utility and installed version mismatch'))
            self.dialog.note(text=_(
                'Please use a version of cleanup utility '
                'that matches the engine installed version '
                '(now engine-cleanup {r_version}, engine {i_version})').format(
                    r_version=osetupcons.Const.RPM_VERSION,
                    i_version=self.environment[
                        osetupcons.CoreEnv.ORIGINAL_GENERATED_BY_VERSION],
                ))
            raise RuntimeError(_('Cleanup utility version mismatch'))
示例#3
0
 def _misc(self):
     if self.environment[oprovisioncons.ProvDBEnv.DATABASE]:
         self._provisioning.provision()
     elif self.environment[oprovisioncons.ProvDBEnv.USER]:
         self._provisioning.createUser()
     else:
         self.logger.info(
             _(
                 "Neither database nor user provided, doing nothing"
             )
         )
     if self._provisioning.databaseRenamed:
         osetuputil.addExitCode(
             environment=self.environment,
             code=(
                 osetupcons.Const.
                 EXIT_CODE_PROVISIONING_EXISTING_RESOURCES_FOUND
             )
         )
         raise RuntimeError(
             _(
                 'Existing resources found, new ones created: \n'
                 'database {database} user {user}'
             ).format(
                 database=self.environment[
                     oprovisioncons.ProvDBEnv.DATABASE
                 ],
                 user=self.environment[
                     oprovisioncons.ProvDBEnv.USER
                 ],
             )
         )
示例#4
0
 def _setup(self):
     self._provisioning.detectCommands()
     if not self._provisioning.supported():
         osetuputil.addExitCode(
             environment=self.environment,
             code=(osetupcons.Const.EXIT_CODE_PROVISIONING_NOT_SUPPORTED))
         raise RuntimeError('Provisioning not supported')
示例#5
0
 def _misc(self):
     if self.environment[oprovisioncons.ProvDBEnv.DATABASE]:
         self._provisioning.provision()
     elif self.environment[oprovisioncons.ProvDBEnv.USER]:
         self._provisioning.createUser()
     else:
         self.logger.info(
             _(
                 "Neither database nor user provided, doing nothing"
             )
         )
     if self._provisioning.databaseRenamed:
         osetuputil.addExitCode(
             environment=self.environment,
             code=(
                 osetupcons.Const.
                 EXIT_CODE_PROVISIONING_EXISTING_RESOURCES_FOUND
             )
         )
         raise RuntimeError(
             _(
                 'Existing resources found, new ones created: \n'
                 'database {database} user {user}'
             ).format(
                 database=self.environment[
                     oprovisioncons.ProvDBEnv.DATABASE
                 ],
                 user=self.environment[
                     oprovisioncons.ProvDBEnv.USER
                 ],
             )
         )
示例#6
0
 def _setup(self):
     self._provisioning.detectCommands()
     if not self._provisioning.supported():
         osetuputil.addExitCode(
             environment=self.environment,
             code=(
                 osetupcons.Const.
                 EXIT_CODE_PROVISIONING_NOT_SUPPORTED
             )
         )
         raise RuntimeError('Provisioning not supported')
示例#7
0
 def _misc(self):
     self._provisioning.provision()
     if self._provisioning.databaseRenamed:
         osetuputil.addExitCode(
             environment=self.environment,
             code=(osetupcons.Const.
                   EXIT_CODE_PROVISIONING_EXISTING_RESOURCES_FOUND))
         raise RuntimeError(
             _('Existing resources found, new ones created: \n'
               'database {database} user {user}').format(
                   database=self.environment[
                       oprovisioncons.ProvDBEnv.DATABASE],
                   user=self.environment[oprovisioncons.ProvDBEnv.USER],
               ))
示例#8
0
    def _setup(self):
        self.environment[osetupcons.CoreEnv.GENERATE_POSTINSTALL] = False
        if not os.path.exists(
            osetupcons.FileLocations.OVIRT_SETUP_POST_INSTALL_CONFIG
        ):
            self.logger.error(_('Could not detect a completed product setup'))
            self.dialog.note(
                text=_(
                    'Please use the cleanup utility only after a setup '
                    'or after an upgrade from an older installation.'
                )
            )
            osetuputil.addExitCode(
                environment=self.environment,
                code=osetupcons.Const.EXIT_CODE_REMOVE_WITHOUT_SETUP
            )
            raise RuntimeError(
                _('Could not detect product setup')
            )

        rpm_v = distutils.version.LooseVersion(
            osetupcons.Const.RPM_VERSION
        ).version[:3]
        inst_v = distutils.version.LooseVersion(
            self.environment[
                osetupcons.CoreEnv.ORIGINAL_GENERATED_BY_VERSION
            ]
        ).version[:3]

        if (rpm_v[:2] != inst_v[:2]) or (rpm_v < inst_v):
            self.logger.error(
                _('Cleanup utility and installed version mismatch')
            )
            self.dialog.note(
                text=_(
                    'Please use a version of cleanup utility '
                    'that matches the engine installed version '
                    '(now engine-cleanup {r_version}, engine {i_version})'
                ).format(
                    r_version=osetupcons.Const.RPM_VERSION,
                    i_version=self.environment[
                        osetupcons.CoreEnv.ORIGINAL_GENERATED_BY_VERSION
                    ],
                )
            )
            raise RuntimeError(
                _('Cleanup utility version mismatch')
            )
示例#9
0
 def _misc(self):
     self._provisioning.provision()
     if self._provisioning.databaseRenamed:
         osetuputil.addExitCode(
             environment=self.environment,
             code=(
                 osetupcons.Const.
                 EXIT_CODE_PROVISIONING_EXISTING_RESOURCES_FOUND
             )
         )
         raise RuntimeError(
             _(
                 'Existing resources found, new ones created: \n'
                 'database {database} user {user}'
             ).format(
                 database=self.environment[
                     oprovisioncons.ProvDBEnv.DATABASE
                 ],
                 user=self.environment[
                     oprovisioncons.ProvDBEnv.USER
                 ],
             )
         )