ComponentInstaller

Module for managing the installation of DIRAC components: MySQL, DB’s, NoSQL DBs, Services, Agents, Executors

It only makes use of defaults in LocalInstallation Section in dirac.cfg

The Following Options are used:

/DIRAC/Setup:             Setup to be used for any operation
/LocalInstallation/InstanceName:    Name of the Instance for the current Setup (default /DIRAC/Setup)
/LocalInstallation/LogLevel:        LogLevel set in "run" script for all components installed
/LocalInstallation/Host:            Used when build the URL to be published for the installed
                                    service (default: socket.getfqdn())
/LocalInstallation/Database/User:                 (default Dirac)
/LocalInstallation/Database/Password:             (must be set for SystemAdministrator Service to work)
/LocalInstallation/Database/RootUser:             (default root)
/LocalInstallation/Database/RootPwd:              (must be set for SystemAdministrator Service to work)
/LocalInstallation/Database/Host:                 (must be set for SystemAdministrator Service to work)
/LocalInstallation/Database/Port:                 (default 3306)
/LocalInstallation/NoSQLDatabase/Host:            (must be set for SystemAdministrator Service to work)
/LocalInstallation/NoSQLDatabase/Port:            (default 9200)
/LocalInstallation/NoSQLDatabase/User:            (default '')
/LocalInstallation/NoSQLDatabase/Password:        (not strictly necessary)
/LocalInstallation/NoSQLDatabase/SSL:             (default True)

The setupSite method (used by the dirac-setup-site command) will use the following info:

/LocalInstallation/Systems:       List of Systems to be defined for this instance
                                  in the CS (default: Configuration, Framework)
/LocalInstallation/Databases:     List of MySQL Databases to be installed and configured
/LocalInstallation/Services:      List of System/ServiceName to be setup
/LocalInstallation/Agents:        List of System/AgentName to be setup
/LocalInstallation/WebPortal:     Boolean to setup the Web Portal (default no)
/LocalInstallation/ConfigurationMaster: Boolean, requires Configuration/Server to be given
                                        in the list of Services (default: no)
/LocalInstallation/PrivateConfiguration: Boolean, requires Configuration/Server to be given
                                         in the list of Services (default: no)

If a Master Configuration Server is being installed the following Options can be used:

/LocalInstallation/ConfigurationName: Name of the Configuration (default: Setup )
/LocalInstallation/AdminUserName:  Name of the Admin user (default: None )
/LocalInstallation/AdminUserDN:    DN of the Admin user certificate (default: None )
/LocalInstallation/AdminUserEmail: Email of the Admin user (default: None )
/LocalInstallation/AdminGroupName: Name of the Admin group (default: dirac_admin )
/LocalInstallation/HostDN: DN of the host certificate (default: None )
/LocalInstallation/VirtualOrganization: Name of the main Virtual Organization (default: None)
class DIRAC.FrameworkSystem.Client.ComponentInstaller.ComponentInstaller

Bases: object

__init__()
addCfgToComponentCfg(componentType, systemName, component, cfg)

Add some extra configuration to the local component cfg

addDatabaseOptionsToCS(gConfig_o, systemName, dbName, mySetup=None, overwrite=False)

Add the section with the database options to the CS

addDefaultOptionsToCS(gConfig_o, componentType, systemName, component, extensions, mySetup=None, specialOptions={}, overwrite=False, addDefaultOptions=True)

Add the section with the component options to the CS

addDefaultOptionsToComponentCfg(componentType, systemName, component, extensions)

Add default component options local component cfg

addOptionToDiracCfg(option, value)

Add Option to dirac.cfg

addSystemInstance(systemName, compInstance, mySetup=None, myCfg=False)

Add a new system self.instance to dirac.cfg and CS

addTornadoOptionsToCS(gConfig_o)

Add the section with the component options to the CS

checkComponentModule(componentType, system, module)

Check existence of the given module and if it inherits from the proper class

checkComponentSoftware(componentType, system, component, extensions)

Check the component software

execCommand(timeout, cmd)

Execute command tuple and handle Error cases

execMySQL(cmd, dbName='mysql', localhost=False)

Execute MySQL Command

getAvailableDatabases(extensions=None)

Find all databases defined

getAvailableESDatabases(extensions)

Find the ES DBs definitions, by introspection.

This method makes a few assumptions: - the files defining modules interacting with ES DBs are found in the xyzSystem/DB/ directories - the files defining modules interacting with ES DBs are named xyzDB.py (e.g. MonitoringDB.py) - the modules define ES DBs classes with the same name of the module (e.g. class MonitoringDB()) - the classes are inheriting from the ElasticDB module (e.g. class MonitoringDB(ElasticDB))

Result should be something like:

{'MonitoringDB': {'Type': 'ES', 'System': 'Monitoring', 'Extension': ''},
 'ElasticJobParametersDB': {'Type': 'ES', 'System': 'WorkloadManagement', 'Extension': ''}}
Parameters:

extensions (list) – list of DIRAC extensions

Returns:

dict of ES DBs

getAvailableSQLDatabases(extensions)

Find the sql files

Parameters:

extensions (list) – list of DIRAC extensions

Returns:

dict of MySQL DBs

getComponentCfg(componentType, system, component, compInstance, extensions, specialOptions={}, addDefaultOptions=True)

Get the CFG object of the component configuration

getComponentModule(system, component, compType)

Get the component software module

getDatabaseCfg(system, dbName, compInstance)

Get the CFG object of the database configuration

getDatabases()

Get the list of installed databases

getInfo()
getInstalledComponents()

Get the list of all the components (services, agents, executors) installed on the system in the runit directory

getLogTail(system, component, length=100)

Get the tail of the component log file

getMySQLPasswords()

Get MySQL passwords from local configuration or prompt

getMySQLStatus()

Get the status of the MySQL database installation

getOverallStatus(extensions)

Get the list of all the components (services, agents, executors) set up for running with runsvdir in startup directory

getSetupComponents()

Get the list of all the components (services, agents, executors) set up for running with runsvdir in startup directory

getSoftwareComponents(extensions)

Get the list of all the components (services, agents, executors) for which the software is installed on the system

getStartupComponentStatus(componentTupleList)

Get the list of all the components (services, agents, executors) set up for running with runsvdir in startup directory

installComponent(componentType, system, component, extensions, componentModule='', checkModule=True)

Install runit directory for the specified component

installDatabase(dbName)

Install requested DB in MySQL server

installPortal()

Install runit directories for the Web Portal

installTornado()

Install runit directory for the tornado, and add the configuration of the required service

loadDiracCfg()

Read again defaults from dirac.cfg

printOverallStatus(rDict)

Print in nice format the return dictionary from self.getOverallStatus

printStartupStatus(rDict)

Print in nice format the return dictionary from self.getStartupComponentStatus (also returned by self.runsvctrlComponent)

removeComponentOptionsFromCS(system, component, mySetup=None)

Remove the section with Component options from the CS, if possible

removeDatabaseOptionsFromCS(gConfig_o, system, dbName, mySetup=None)

Remove the section with database options from the CS, if possible

resultIndexes(componentTypes)
runsvctrlComponent(system, component, mode)

Execute runsvctrl and check status of the specified component

setMySQLPasswords(root='', dirac='')

Set MySQL passwords

setupComponent(componentType, system, component, extensions, componentModule='', checkModule=True)

Install and create link in startup

setupPortal()

Install and create link in startup

setupSite(scriptCfg, cfg=None)

Setup a new site using the options defined

setupTornadoService(system, component, extensions, componentModule='', checkModule=True)

Install and create link in startup

uninstallComponent(system, component, removeLogs)

Remove startup and runit directories

uninstallDatabase(gConfig_o, dbName)

Remove a database from DIRAC

unsetupComponent(system, component)

Remove link from startup