Example #1
0
def main():
    Script.parseCommandLine()
    args = Script.getPositionalArgs()
    if len(args) < 1:
        Script.showHelp(exitCode=1)

    # Script imports
    from DIRAC import gConfig
    from DIRAC.FrameworkSystem.Client.ComponentInstaller import gComponentInstaller
    from DIRAC.FrameworkSystem.Utilities import MonitoringUtilities

    gComponentInstaller.exitOnError = True
    gComponentInstaller.getMySQLPasswords()
    for db in args:
        result = gComponentInstaller.installDatabase(db)
        if not result['OK']:
            print("ERROR: failed to correctly install %s" % db,
                  result['Message'])
        else:
            extension, system = result['Value']
            gComponentInstaller.addDatabaseOptionsToCS(gConfig,
                                                       system,
                                                       db,
                                                       overwrite=True)

            if db != 'InstalledComponentsDB':
                result = MonitoringUtilities.monitorInstallation(
                    'DB', system, db)
                if not result['OK']:
                    print(
                        "ERROR: failed to register installation in database: %s"
                        % result['Message'])
Example #2
0
 def export_installDatabase(self, dbName, mysqlPassword=None):
     """ Install a DIRAC database named dbName
 """
     if mysqlPassword:
         gComponentInstaller.setMySQLPasswords(mysqlPassword)
     return gComponentInstaller.installDatabase(dbName)
Example #3
0
                                     '  %s [option|cfgFile] ... DB ...' % Script.scriptName,
                                     'Arguments:',
                                     '  DB: Name of the Database (mandatory)'] ) )
Script.parseCommandLine()
args = Script.getPositionalArgs()
if len( args ) < 1:
  Script.showHelp()
  exit( -1 )

# Script imports
from DIRAC import gConfig
from DIRAC.FrameworkSystem.Client.ComponentInstaller import gComponentInstaller
from DIRAC.FrameworkSystem.Utilities import MonitoringUtilities

__RCSID__ = "$Id$"

gComponentInstaller.exitOnError = True
gComponentInstaller.getMySQLPasswords()
for db in args:
  result = gComponentInstaller.installDatabase( db )
  if not result['OK']:
    print "ERROR: failed to correctly install %s" % db, result['Message']
  else:
    extension, system = result['Value']
    gComponentInstaller.addDatabaseOptionsToCS( gConfig, system, db, overwrite = True )

    if db != 'InstalledComponentsDB':
      result = MonitoringUtilities.monitorInstallation( 'DB', system, db )
      if not result[ 'OK' ]:
        print "ERROR: failed to register installation in database: %s" % result[ 'Message' ]
Example #4
0
 def export_installDatabase( self, dbName, mysqlPassword = None ):
   """ Install a DIRAC database named dbName
   """
   if mysqlPassword :
     gComponentInstaller.setMySQLPasswords( mysqlPassword )
   return gComponentInstaller.installDatabase( dbName )