Example #1
0
 def export_getSoftwareComponents(self):
     """  Get the list of all the components ( services and agents ) for which the software
      is installed on the system
 """
     return gComponentInstaller.getSoftwareComponents(getCSExtensions())
Example #2
0
 def export_getSoftwareComponents( self ):
   """  Get the list of all the components ( services and agents ) for which the software
        is installed on the system
   """
   return gComponentInstaller.getSoftwareComponents( getCSExtensions() )
Script.parseCommandLine()
args = Script.getPositionalArgs()

if len( args ) == 1:
  args = args[0].split( '/' )

if len( args ) != 2:
  Script.showHelp()
  DIRACexit( 1 )

cType = None
system = args[0]
component = args[1]

result = gComponentInstaller.getSoftwareComponents( getCSExtensions() )
if not result[ 'OK' ]:
  gLogger.error( result[ 'Message' ] )
  DIRACexit( 1 )
else:
  availableComponents = result[ 'Value' ]

for compType in availableComponents:
  if system in availableComponents[ compType ] and component in availableComponents[ compType ][ system ]:
    cType = compType[:-1].lower()
    break

if not cType:
  gLogger.error( 'Component %s/%s is not available for installation' % ( system, component ) )
  DIRACexit( 1 )
Example #4
0
args = Script.getPositionalArgs()

if len(args) == 1:
  args = args[0].split('/')

if len(args) != 2:
  Script.showHelp()
  DIRACexit(1)

cType = None
system = args[0]
component = args[1]
compOrMod = module if module else component


result = gComponentInstaller.getSoftwareComponents(getCSExtensions())
if not result['OK']:
  gLogger.error(result['Message'])
  DIRACexit(1)
else:
  availableComponents = result['Value']

for compType in availableComponents:
  if system in availableComponents[compType] and compOrMod in availableComponents[compType][system]:
    cType = compType[:-1].lower()
    break

if not cType:
  gLogger.error('Component %s/%s is not available for installation' % (system, component))
  DIRACexit(1)
Example #5
0
def main():
    global overwrite
    global specialOptions
    global module
    global specialOptions

    from DIRAC.FrameworkSystem.Client.ComponentInstaller import gComponentInstaller

    gComponentInstaller.exitOnError = True

    Script.registerSwitch("w", "overwrite",
                          "Overwrite the configuration in the global CS",
                          setOverwrite)
    Script.registerSwitch("m:", "module=",
                          "Python module name for the component code",
                          setModule)
    Script.registerSwitch("p:", "parameter=", "Special component option ",
                          setSpecialOption)
    # Registering arguments will automatically add their description to the help menu
    Script.registerArgument((
        "System/Component: Full component name (ie: WorkloadManagement/Matcher)",
        "System:           Name of the DIRAC system (ie: WorkloadManagement)",
    ))
    Script.registerArgument(
        " Component:        Name of the DIRAC service (ie: Matcher)",
        mandatory=False)

    Script.parseCommandLine()
    args = Script.getPositionalArgs()

    if len(args) == 1:
        args = args[0].split("/")

    if len(args) != 2:
        Script.showHelp(exitCode=1)

    system = args[0]
    component = args[1]
    compOrMod = module or component

    result = gComponentInstaller.getSoftwareComponents(extensionsByPriority())
    if not result["OK"]:
        gLogger.error(result["Message"])
        DIRACexit(1)
    availableComponents = result["Value"]

    for compType in availableComponents:
        if system in availableComponents[
                compType] and compOrMod in availableComponents[compType][
                    system]:
            cType = compType[:-1].lower()
            break
    else:
        gLogger.error("Component %s/%s is not available for installation" %
                      (system, component))
        DIRACexit(1)

    if module:
        result = gComponentInstaller.addDefaultOptionsToCS(
            gConfig,
            cType,
            system,
            module,
            extensionsByPriority(),
            overwrite=overwrite)
        result = gComponentInstaller.addDefaultOptionsToCS(
            gConfig,
            cType,
            system,
            component,
            extensionsByPriority(),
            specialOptions=specialOptions,
            overwrite=overwrite,
            addDefaultOptions=False,
        )
    else:
        result = gComponentInstaller.addDefaultOptionsToCS(
            gConfig,
            cType,
            system,
            component,
            extensionsByPriority(),
            specialOptions=specialOptions,
            overwrite=overwrite,
        )

    if not result["OK"]:
        gLogger.error(result["Message"])
        DIRACexit(1)
    result = gComponentInstaller.installComponent(cType, system, component,
                                                  extensionsByPriority(),
                                                  module)
    if not result["OK"]:
        gLogger.error(result["Message"])
        DIRACexit(1)
    gLogger.notice(
        "Successfully installed component %s in %s system, now setting it up" %
        (component, system))
    result = gComponentInstaller.setupComponent(cType, system, component,
                                                extensionsByPriority(), module)
    if not result["OK"]:
        gLogger.error(result["Message"])
        DIRACexit(1)
    if component == "ComponentMonitoring":
        result = MonitoringUtilities.monitorInstallation(
            "DB", system, "InstalledComponentsDB")
        if not result["OK"]:
            gLogger.error(result["Message"])
            DIRACexit(1)
    result = MonitoringUtilities.monitorInstallation(cType, system, component,
                                                     module)
    if not result["OK"]:
        gLogger.error(result["Message"])
        DIRACexit(1)
    gLogger.notice("Successfully completed the installation of %s/%s" %
                   (system, component))
    DIRACexit()
Example #6
0
def main():
    global overwrite
    global specialOptions
    global module
    global specialOptions

    from DIRAC.FrameworkSystem.Client.ComponentInstaller import gComponentInstaller
    gComponentInstaller.exitOnError = True

    Script.registerSwitch("w", "overwrite",
                          "Overwrite the configuration in the global CS",
                          setOverwrite)
    Script.registerSwitch("m:", "module=",
                          "Python module name for the component code",
                          setModule)
    Script.registerSwitch("p:", "parameter=", "Special component option ",
                          setSpecialOption)
    Script.parseCommandLine()
    args = Script.getPositionalArgs()

    if len(args) == 1:
        args = args[0].split('/')

    if len(args) != 2:
        Script.showHelp(exitCode=1)

    cType = None
    system = args[0]
    component = args[1]
    compOrMod = module if module else component

    result = gComponentInstaller.getSoftwareComponents(getCSExtensions())
    if not result['OK']:
        gLogger.error(result['Message'])
        DIRACexit(1)
    else:
        availableComponents = result['Value']

    for compType in availableComponents:
        if system in availableComponents[
                compType] and compOrMod in availableComponents[compType][
                    system]:
            cType = compType[:-1].lower()
            break

    if not cType:
        gLogger.error('Component %s/%s is not available for installation' %
                      (system, component))
        DIRACexit(1)

    if module:
        result = gComponentInstaller.addDefaultOptionsToCS(gConfig,
                                                           cType,
                                                           system,
                                                           module,
                                                           getCSExtensions(),
                                                           overwrite=overwrite)
        result = gComponentInstaller.addDefaultOptionsToCS(
            gConfig,
            cType,
            system,
            component,
            getCSExtensions(),
            specialOptions=specialOptions,
            overwrite=overwrite,
            addDefaultOptions=False)
    else:
        result = gComponentInstaller.addDefaultOptionsToCS(
            gConfig,
            cType,
            system,
            component,
            getCSExtensions(),
            specialOptions=specialOptions,
            overwrite=overwrite)

    if not result['OK']:
        gLogger.error(result['Message'])
        DIRACexit(1)
    else:
        result = gComponentInstaller.installComponent(cType, system, component,
                                                      getCSExtensions(),
                                                      module)
        if not result['OK']:
            gLogger.error(result['Message'])
            DIRACexit(1)
        else:
            gLogger.notice(
                'Successfully installed component %s in %s system, now setting it up'
                % (component, system))
            result = gComponentInstaller.setupComponent(
                cType, system, component, getCSExtensions(), module)
            if not result['OK']:
                gLogger.error(result['Message'])
                DIRACexit(1)
            if component == 'ComponentMonitoring':
                result = MonitoringUtilities.monitorInstallation(
                    'DB', system, 'InstalledComponentsDB')
                if not result['OK']:
                    gLogger.error(result['Message'])
                    DIRACexit(1)
            result = MonitoringUtilities.monitorInstallation(
                cType, system, component, module)
            if not result['OK']:
                gLogger.error(result['Message'])
                DIRACexit(1)
            gLogger.notice('Successfully completed the installation of %s/%s' %
                           (system, component))
            DIRACexit()