def _miscAlways(self): vdcoption.VdcOption( statement=self.environment[ oenginecons.EngineDBEnv.STATEMENT ] ).updateVdcOptions( options=( { 'name': 'ProductRPMVersion', 'value': osetupcons.Const.DISPLAY_VERSION, }, ), ) # Restoring DbJustRestored because the DB has been "imported" vdcoption.VdcOption( statement=self.environment[ oenginecons.EngineDBEnv.STATEMENT ] ).updateVdcOptions( options=( { 'name': 'DbJustRestored', 'value': '0', }, ), )
def _databaseOptions(self): ImageProxyName = vdcoption.VdcOption( statement=self.environment[ oenginecons.EngineDBEnv.STATEMENT ] ).getVdcOption( 'ImageProxyAddress', ownConnection=True, ), old_fqdn, old_port = ImageProxyName[0].split(":") if old_fqdn != self.environment[osetupcons.ConfigEnv.FQDN]: vdcoption.VdcOption( statement=self.environment[ oenginecons.EngineDBEnv.STATEMENT ] ).updateVdcOptions( options=( { 'name': 'ImageProxyAddress', 'value': '%s:%s' % ( self.environment[osetupcons.ConfigEnv.FQDN], old_port ), }, ), ) self.logger.info( _("ImageProxyAddress has been changed to:\n" " {fqdn}:{port}\n" ).format( fqdn=self.environment[osetupcons.ConfigEnv.FQDN], port=old_port ), )
def _miscNewDatabase(self): vdcoption.VdcOption(statement=self.environment[ oenginecons.EngineDBEnv.STATEMENT]).updateVdcOptions(options=( { 'name': 'SSLEnabled', 'value': 'true', }, { 'name': 'EncryptHostCommunication', 'value': 'true', }, { 'name': 'EncryptHostCommunication', 'value': 'true', }, { 'name': 'ConfigDir', 'value': oenginecons.FileLocations.OVIRT_ENGINE_SYSCONFDIR, }, { 'name': 'DataDir', 'value': osetupcons.FileLocations.DATADIR, }, { 'name': 'WebSocketProxy', 'value': '%s:%s' % ( 'localhost', osetupcons.Defaults.DEFAULT_WEBSOCKET_PROXY_PORT, ), }, ), )
def _getCurrentTimeout(self): return vdcoption.VdcOption( statement=self._dbstatement, ).getVdcOption( name='AsyncTaskZombieTaskLifeInMinutes', ownConnection=True, )
def _miscEncrypted_custom(self): if not self.environment.get('TUI_change_admin',False): return vdcoption.VdcOption( statement=self.environment[ oenginecons.EngineDBEnv.STATEMENT ] ).updateVdcOptions( options=( { 'name': 'LocalAdminPassword', 'value': self.environment[ osetupcons.ConfigEnv.ADMIN_PASSWORD ], 'encrypt': True, }, { 'name': 'AdminPassword', 'value': self.environment[ osetupcons.ConfigEnv.ADMIN_PASSWORD ], 'encrypt': True, }, ), )
def _setEngineMode(self, maintenance, timeout=0): mode = ('MAINTENANCE' if maintenance else 'ACTIVE') try: self._parent.logger.debug( 'Setting engine into {mode} mode'.format(mode=mode, )) vdcoption.VdcOption( statement=self._dbstatement, ).updateVdcOptions( options=({ 'name': 'EngineMode', 'value': mode, }, ), ownConnection=True, ) except Exception as e: self._parent.logger.debug( 'Cannot set engine mode', exc_info=True, ) raise RuntimeError( _('Failed to set engine to {mode} mode.\n' 'Error: {error}\n' 'Please check that engine is in correct state ' 'and try running upgrade again.').format( mode=mode, error=e, ))
def _validate(self): ShowHEError = True statement = database.Statement( dbenvkeys=oenginecons.Const.ENGINE_DB_ENV_KEYS, environment=self.environment, ) HostedEngineVmName = vdcoption.VdcOption( statement=statement, ).getVdcOption( 'HostedEngineVmName', ownConnection=True, ) VdsId = statement.execute( statement=""" SELECT vm_guid, run_on_vds FROM vms WHERE vm_name = %(HostedEngineVmName)s; """, args=dict(HostedEngineVmName=HostedEngineVmName, ), ownConnection=True, transaction=False, ) try: if not VdsId[0]['vm_guid']: ShowHEError = False elif VdsId[0]['run_on_vds']: HAGlobalMaintenance = statement.execute( statement=""" SELECT vds_id, ha_global_maintenance FROM vds_statistics WHERE vds_id = %(VdsId)s; """, args=dict(VdsId=VdsId[0]['run_on_vds'], ), ownConnection=True, transaction=False, ) try: if HAGlobalMaintenance[0]['ha_global_maintenance']: self.logger.info( _('Hosted Engine HA is in Global Maintenance mode.' )) ShowHEError = False except IndexError: pass except IndexError: ShowHEError = False if ShowHEError: self.logger.error( _('It seems that you are running your engine inside of ' 'the hosted-engine VM and are not in "Global ' 'Maintenance" mode.\n' 'In that case you should put the system into the "Global ' 'Maintenance" mode before running engine-setup, or the ' 'hosted-engine HA agent might kill the machine, which ' 'might corrupt your data.\n')) raise RuntimeError( _('Hosted Engine setup detected, ' 'but Global Maintenance is not set.'))
def _validation_late(self): adminPassword = None try: adminPassword = vdcoption.VdcOption(statement=database.Statement( dbenvkeys=oenginecons.Const.ENGINE_DB_ENV_KEYS, environment=self.environment, ), ).getVdcOption( 'AdminPassword', ownConnection=True, ) except RuntimeError: pass # we have legacy user. Shouldn't happen anymore, after # 3.6 https://gerrit.ovirt.org/q/Ica85b6a if adminPassword is not None: self.dialog.note(text=_( 'Old AdminPassword found in vdc_options. This should not ' 'happen, and is likely a result of a bad past upgrade.\n' 'Please contact support.\n' 'If you are certain that it is not in use anymore, you ' 'can remove it with this command:\n' '# /usr/share/ovirt-engine/dbscripts/engine-psql.sh -c ' '\\\n' ' "select fn_db_delete_config_value(\'AdminPassword\',' '\'general\');"\n' '\nand then try again.\n')) raise RuntimeError(_('Old AdminPassword found in vdc_options'))
def _validate_wsp_rename(self): self._new_value = '%s:%s' % ( self.environment[osetupcons.RenameEnv.FQDN], osetupcons.Defaults.DEFAULT_WEBSOCKET_PROXY_PORT, ) expected_value = '%s:%s' % ( self._old_fqdn, osetupcons.Defaults.DEFAULT_WEBSOCKET_PROXY_PORT, ) current_value = vdcoption.VdcOption(statement=database.Statement( dbenvkeys=oenginecons.Const.ENGINE_DB_ENV_KEYS, environment=self.environment, ), ).getVdcOption( name='WebSocketProxy', ownConnection=True, ) if expected_value == current_value: self._update_db = True else: self.logger.warning(_('Not updating option WebSocketProxy')) self.dialog.note( _('WebSocketProxy option does not have the expected value:\n' ' {expected_value}\n' 'but instead:\n' ' {current_value}\n' 'To update it, please run:\n' ' # engine-config -s WebSocketProxy={new_value}\n'). format( expected_value=expected_value, current_value=current_value, new_value=self._new_value, ))
def _misc(self): v = self.environment[osetupcons.ConfigEnv.APPLICATION_MODE] self.environment[oenginecons.EngineDBEnv.STATEMENT].execute( statement=""" select inst_update_service_type( %(clusterId)s, %(virt)s, %(gluster)s ) """, args=dict( clusterId=vdcoption.VdcOption(statement=self.environment[ oenginecons.EngineDBEnv.STATEMENT]).getVdcOption( name='AutoRegistrationDefaultVdsGroupID'), virt=(v in ('both', 'virt')), gluster=(v == 'gluster'), ), ) if v != 'both': self.environment[oenginecons.EngineDBEnv.STATEMENT].execute( statement=""" select fn_db_update_config_value( 'ApplicationMode', %(mode)s, 'general' ) """, args=dict( mode=str(self.ApplicationMode.GlusterOnly if v == 'gluster' else self.ApplicationMode.VirtOnly), ), )
def _validation_late(self): adminPassword = None try: adminPassword = vdcoption.VdcOption(statement=database.Statement( dbenvkeys=oenginecons.Const.ENGINE_DB_ENV_KEYS, environment=self.environment, ), ).getVdcOption( 'AdminPassword', ownConnection=True, ) except RuntimeError: pass # we have legacy user if adminPassword is not None: self.environment[ oenginecons.ConfigEnv.ADMIN_USER_AUTHZ_NAME] = 'internal' self.environment[ oenginecons.ConfigEnv.ADMIN_USER] = 'admin@internal' self.environment[ oenginecons.ConfigEnv. ADMIN_USER_ID] = 'fdfc627c-d875-11e0-90f0-83df133b58cc' if self.environment[oenginecons.ConfigEnv.ADMIN_PASSWORD] is None: if not adminPassword: self.environment[oenginecons.ConfigEnv.ADMIN_PASSWORD] = '' elif os.path.exists(oenginecons.FileLocations. OVIRT_ENGINE_PKI_ENGINE_STORE): def _getRSA(): rc, stdout, stderr = self.execute(args=( self.command.get('openssl'), 'pkcs12', '-in', (oenginecons.FileLocations. OVIRT_ENGINE_PKI_ENGINE_STORE), '-passin', 'pass:%s' % self.environment[oenginecons.PKIEnv.STORE_PASS], '-nocerts', '-nodes', ), ) return RSA.load_key_string(str('\n'.join(stdout))) self.environment[ oenginecons.ConfigEnv.ADMIN_PASSWORD] = _getRSA( ).private_decrypt( data=base64.b64decode(adminPassword), padding=RSA.pkcs1_padding, ) else: self.environment[ oenginecons.ConfigEnv. ADMIN_PASSWORD] = self._generatePassword() self.logger.warning( _("Cannot decrypt admin's password during upgrade. " "Admin's password was set to a random password: "******"{password}. Please replace password as soon as " "possible.").format(password=self.environment[ oenginecons.ConfigEnv.ADMIN_PASSWORD], ))
def _misc(self): vdcoption.VdcOption(statement=self.environment[ oenginecons.EngineDBEnv.STATEMENT]).updateVdcOptions(options=({ 'name': 'MacPoolRanges', 'value': self.environment[oenginecons.ConfigEnv.MAC_RANGE_POOL], }, ), )
def _updateSANWipeAfterDelete(self): option = vdcoption.VdcOption( statement=self.environment[oenginecons.EngineDBEnv.STATEMENT]) options = ({ 'name': 'SANWipeAfterDelete', 'value': self.environment[SAN_WIPE_AFTER_DELETE], }, ) option.updateVdcOptions(options=options, )
def miscOptions(self): vdcoption.VdcOption(statement=self.environment[ oenginecons.EngineDBEnv.STATEMENT]).updateVdcOptions(options=({ 'name': 'OrganizationName', 'value': self.environment[oenginecons.PKIEnv.ORG], }, ), )
def _miscAlways(self): vdcoption.VdcOption(statement=self.environment[ oenginecons.EngineDBEnv.STATEMENT]).updateVdcOptions(options=({ 'name': 'ProductRPMVersion', 'value': osetupcons.Const.DISPLAY_VERSION, }, ), )
def _miscNewDatabase(self): self.logger.info(_('Update WebSocketProxy option')) vdcoption.VdcOption(statement=self.environment[ oenginecons.EngineDBEnv.STATEMENT]).updateVdcOptions(options=({ 'name': 'WebSocketProxy', 'value': self._new_value, }, ), )
def _databaseOptions(self): vdcoption.VdcOption(statement=self.environment[ oenginecons.EngineDBEnv.STATEMENT]).updateVdcOptions(options=({ 'name': 'ImageProxyAddress', 'value': '%s:%s' % ( self.environment[osetupcons.ConfigEnv.FQDN], oipcons.ConfigEnv.DEFAULT_IMAGEIO_PROXY_PORT, ), }, ), )
def __miscEncrypted(self): import ovirt.node.utils.vdcoption as vdcoption vdcoption.VdcOption().updateVdcOptions(options=( { 'name': 'LocalAdminPassword', 'value': self.environment['OVESETUP_CONFIG/adminPassword'], 'encrypt': True, }, { 'name': 'AdminPassword', 'value': self.environment['OVESETUP_CONFIG/adminPassword'], 'encrypt': True, }, ), )
def _misc(self): option = 'RedirectServletReportsPage' vdc = vdcoption.VdcOption( statement=self.environment[oenginecons.EngineDBEnv.STATEMENT]) value = vdc.getVdcOption(name=option) if value: newfqdn = self.environment[osetupcons.RenameEnv.FQDN] u = urlparse.urlparse(value) ulist = list(u) ulist[1] = newfqdn + ":" + str(u.port) vdc.updateVdcOptions(options=({ 'name': option, 'value': urlparse.urlunparse(ulist), }, ))
def _update_DisconnectDwh(self, value): vdcoption.VdcOption(statement=self._statement, ).updateVdcOptions( options=({ 'name': 'DisconnectDwh', 'value': value, }, ), # Can't use ownConnection=False. The shared connection is # created only after the db is updated, and we want to stop # dwhd before that. # ownConnection=True means we are not rolled back on error, # if one happens between setting DisconnectDwh to 1 and # setting it back to 0, so an attempt to start dwh before # fixing the problem and finishing the engine upgrade will # fail, which is ok. ownConnection=True, )
def _miscEncrypted(self): vdcoption.VdcOption(statement=self.environment[ oenginecons.EngineDBEnv.STATEMENT]).updateVdcOptions(options=( { 'name': 'LocalAdminPassword', 'value': self.environment[osetupcons.ConfigEnv.ADMIN_PASSWORD], 'encrypt': True, }, { 'name': 'AdminPassword', 'value': self.environment[osetupcons.ConfigEnv.ADMIN_PASSWORD], 'encrypt': True, }, ), )
def _misc(self): v = self.environment[osetupcons.ConfigEnv.APPLICATION_MODE] self.environment[oenginecons.EngineDBEnv.STATEMENT].execute( statement=""" select inst_update_service_type( %(clusterId)s, %(virt)s, %(gluster)s ) """, args=dict( clusterId=vdcoption.VdcOption(statement=self.environment[ oenginecons.EngineDBEnv.STATEMENT]).getVdcOption( name='AutoRegistrationDefaultClusterID'), virt=(v in ('both', 'virt')), gluster=(v == 'gluster'), ), ) if v == 'virt': mode = self.ApplicationMode.VirtOnly elif v == 'gluster': mode = self.ApplicationMode.GlusterOnly elif v == 'both': mode = self.ApplicationMode.AllModes else: raise RuntimeError( _('Selected application mode \'{v}\' is not allowed').format( v=v, )) self.environment[oenginecons.EngineDBEnv.STATEMENT].execute( statement=""" select fn_db_update_config_value( 'ApplicationMode', %(mode)s, 'general' ) """, args=dict(mode=str(mode), ), )
def _validation_late(self): domain = None try: domain = vdcoption.VdcOption(statement=database.Statement( dbenvkeys=oenginecons.Const.ENGINE_DB_ENV_KEYS, environment=self.environment, ), ).getVdcOption( 'DomainName', ownConnection=True, ) except RuntimeError: pass if domain: raise RuntimeError( _('Setup found legacy kerberos/ldap directory ' 'integration in use (added by engine-manage-domains). ' 'This provider is no longer supported, please ' 'migrate to ovirt-engine-extension-aaa-ldap ' 'provider or contact support for assistance.'))
def _database_needs_update(self): if self.environment[oenginecons.EngineDBEnv.NEW_DATABASE]: return True else: current = vdcoption.VdcOption( statement=self.environment[ oenginecons.EngineDBEnv.STATEMENT ] ).getVdcOption( name='ImageProxyAddress', ) if current == '{name}:{port}'.format( name='localhost', port=oipcons.ConfigEnv.DEFAULT_IMAGEIO_PROXY_PORT, ): # Most likely 'localhost' was set by dbscripts and # never updated, because in previous versions we didn't # set it here and later we set it only on new setups. return True return False
def _validation_late(self): domain = None try: domain = vdcoption.VdcOption(statement=database.Statement( dbenvkeys=oenginecons.Const.ENGINE_DB_ENV_KEYS, environment=self.environment, ), ).getVdcOption( 'DomainName', ownConnection=True, ) except RuntimeError: pass if domain: self.logger.warning( _('Setup found legacy kerberos/ldap directory ' 'integration in use (added by engine-manage-domains). ' 'This provider is obsoleted and will be removed in ' 'future. Please migrate to ' 'ovirt-engine-extension-aaa-ldap provider or contact ' 'support for assistance.'))
def _misc(self): content = [] used = set() for vdco, sysprep, osinfo in ( ('SysPrep2K3Path', 'sysprep.2k3', ('windows_2003', 'windows_2003x64')), ('SysPrep2K8Path', 'sysprep.2k8', ('windows_2008', )), ('SysPrep2K8R2Path', 'sysprep.2k8', ('windows_2008', )), ('SysPrep2K8x64Path', 'sysprep.2k8x64', ('windows_2008x64', )), ('SysPrepWindows2012x64Path', 'sysprep.2k12x64', ('windows_2012x64', )), ('SysPrepWindows7Path', 'sysprep.w7', ('windows_7', )), ('SysPrepWindows7x64Path', 'sysprep.w7x64', ('windows_7x64', )), ('SysPrepWindows8Path', 'sysprep.w8', ('windows_8', )), ('SysPrepWindows8x64Path', 'sysprep.w8x64', ('windows_2008x64', )), ('SysPrepXPPath', 'sysprep.xp', ('windows_xp', )), ): val = vdcoption.VdcOption(statement=self.environment[ oenginecons.EngineDBEnv.STATEMENT]).getVdcOption(name=vdco) # # fix embarrassing typo in previous setup # so we can find files. # val = val.replace('/gsysprep', '/sysprep') # # reset so at next cycle we won't # consider vdcoptions any more # vdcoption.VdcOption(statement=self.environment[ oenginecons.EngineDBEnv.STATEMENT]).updateVdcOptions(options=({ 'name': vdco, 'value': '', }, ), ) if val and os.path.exists(val): self.logger.debug( "Found legacy sysprep %s '%s'", vdco, val, ) if filecmp.cmp( val, os.path.join( oenginecons.FileLocations.OVIRT_ENGINE_DATADIR, 'conf', 'sysprep', sysprep, )): self._toremove.add(val) else: used.add(val) self.logger.debug('legacy sysprep differ from %s', sysprep) for name in osinfo: content.append('os.%s.sysprepPath.value = %s' % ( name, val, )) self._toremove -= used self.logger.debug('legacy sysprep fixup: %s', content) self.logger.debug('legacy sysprep remove: %s', self._toremove) if content: self.environment[otopicons.CoreEnv.MAIN_TRANSACTION].append( filetransaction.FileTransaction( name=osetupcons.FileLocations.OSINFO_LEGACY_SYSPREP, content=content, ))
def _closeup(self): self.logger.debug('Connecting to the Engine') engine_api = self._waitEngineUp() eSupportedClusterLevels = vdcoption.VdcOption( statement=self.environment[oenginecons.EngineDBEnv.STATEMENT] ).getVdcOption(name='SupportedClusterLevels') self.logger.debug('engine SupportedClusterLevels [{levels}], ' 'PACKAGE_VERSION [{pv}],'.format( levels=eSupportedClusterLevels, pv=osetupconfig.PACKAGE_VERSION, )) vSupportedClusterLevels, raw_version_revision = \ self._getSupportedClusterLevels() self.logger.debug('VDSM SupportedClusterLevels [{levels}], ' 'VDSM VERSION [{rv}],'.format( levels=vSupportedClusterLevels, rv=raw_version_revision, )) try: v = max( distutils.version.LooseVersion(vs).version for vs in (set(eSupportedClusterLevels.split(',')) & set(vSupportedClusterLevels))) except ValueError: self.logger.debug('exception', exc_info=True) raise RuntimeError( _('Failed to find a ClusterLevel supported ' 'by both engine and VDSM')) engine_version = self._ovirtsdk_xml.params.Version( major=v[0], minor=v[1], ) self.logger.debug('Creating the local data center') engine_api.datacenters.add( self._ovirtsdk_xml.params.DataCenter( name=self.environment[oenginecons.AIOEnv.LOCAL_DATA_CENTER], storage_type='localfs', version=engine_version, )) self.logger.debug( 'Creating the local cluster into the local data center') engine_api.clusters.add( self._ovirtsdk_xml.params.Cluster( name=self.environment[oenginecons.AIOEnv.LOCAL_CLUSTER], cpu=self._ovirtsdk_xml.params.CPU( id=self.environment[oenginecons.AIOEnv.VDSM_CPU]), data_center=engine_api.datacenters.get( self.environment[oenginecons.AIOEnv.LOCAL_DATA_CENTER]), version=engine_version)) self.logger.debug('Adding the local host to the local cluster') # At this stage sshd is already running engine_api.hosts.add( self._ovirtsdk_xml.params.Host( name=self.environment[oenginecons.AIOEnv.LOCAL_HOST], address=self.environment[osetupcons.ConfigEnv.FQDN], reboot_after_installation=False, override_iptables=False, cluster=engine_api.clusters.get( self.environment[oenginecons.AIOEnv.LOCAL_CLUSTER]), ssh=self._ovirtsdk_xml.params.SSH( authentication_method='publickey', port=self.environment[oenginecons.AIOEnv.SSHD_PORT], ), )) if not self._waitVDSMHostUp( engine_api=engine_api, host=self.environment[oenginecons.AIOEnv.LOCAL_HOST], ): self.logger.warning( _('Local storage domain not added because ' 'the VDSM host was not up. Please add it manually.')) else: self.logger.debug('Adding local storage domain') storage = self._ovirtsdk_xml.params.Storage(path=self.environment[ oenginecons.AIOEnv.STORAGE_DOMAIN_DIR].rstrip('/'), ) storage.set_type('localfs') storage_domain = self._ovirtsdk_xml.params.StorageDomain( name=self.environment[oenginecons.AIOEnv.STORAGE_DOMAIN_NAME], data_center=engine_api.datacenters.get( self.environment[oenginecons.AIOEnv.LOCAL_DATA_CENTER]), storage_format='v3', host=engine_api.hosts.get( self.environment[oenginecons.AIOEnv.LOCAL_HOST]), storage=storage) storage_domain.set_type('data') engine_api.storagedomains.add(storage_domain)
def _setup(self): dbovirtutils = database.OvirtUtils( plugin=self, dbenvkeys=oenginecons.Const.ENGINE_DB_ENV_KEYS, ) dbovirtutils.detectCommands() config = configfile.ConfigFile([ oenginecons.FileLocations.OVIRT_ENGINE_SERVICE_CONFIG_DEFAULTS, oenginecons.FileLocations.OVIRT_ENGINE_SERVICE_CONFIG ]) if config.get('ENGINE_DB_PASSWORD'): try: dbenv = {} for e, k in ( (oenginecons.EngineDBEnv.HOST, 'ENGINE_DB_HOST'), (oenginecons.EngineDBEnv.PORT, 'ENGINE_DB_PORT'), (oenginecons.EngineDBEnv.USER, 'ENGINE_DB_USER'), (oenginecons.EngineDBEnv.PASSWORD, 'ENGINE_DB_PASSWORD'), (oenginecons.EngineDBEnv.DATABASE, 'ENGINE_DB_DATABASE'), ): dbenv[e] = config.get(k) for e, k in ((oenginecons.EngineDBEnv.SECURED, 'ENGINE_DB_SECURED'), (oenginecons.EngineDBEnv.SECURED_HOST_VALIDATION, 'ENGINE_DB_SECURED_VALIDATION')): dbenv[e] = config.getboolean(k) dbovirtutils.tryDatabaseConnect(dbenv) self.environment.update(dbenv) self.environment[oenginecons.EngineDBEnv. NEW_DATABASE] = dbovirtutils.isNewDatabase() self.environment[ oenginecons.EngineDBEnv. NEED_DBMSUPGRADE] = dbovirtutils.checkDBMSUpgrade() except RuntimeError: self.logger.debug( 'Existing credential use failed', exc_info=True, ) msg = _('Cannot connect to Engine database using existing ' 'credentials: {user}@{host}:{port}').format( host=dbenv[oenginecons.EngineDBEnv.HOST], port=dbenv[oenginecons.EngineDBEnv.PORT], database=dbenv[oenginecons.EngineDBEnv.DATABASE], user=dbenv[oenginecons.EngineDBEnv.USER], ) if self.environment[osetupcons.CoreEnv. ACTION] == osetupcons.Const.ACTION_REMOVE: self.logger.warning(msg) else: raise RuntimeError(msg) if not self.environment[oenginecons.EngineDBEnv.NEW_DATABASE]: statement = database.Statement( dbenvkeys=oenginecons.Const.ENGINE_DB_ENV_KEYS, environment=self.environment, ) try: justRestored = vdcoption.VdcOption( statement=statement, ).getVdcOption( 'DbJustRestored', ownConnection=True, ) self.environment[oenginecons.EngineDBEnv.JUST_RESTORED] = ( justRestored == '1') except RuntimeError: pass if self.environment[oenginecons.EngineDBEnv.JUST_RESTORED]: self.logger.info( _('The engine DB has been restored from a backup'))