def __init__(self, host=None):
        """ Adding some external services
    """

        DIRACSystemAdministratorClientCLI.__init__(self, host)
        self.runitComponents = ["service", "agent", "executor", "consumer"]
        self.externalServices = ["vcycle", "squid"]
Exemple #2
0
def main():
    host = None
    Script.registerSwitch("H:", "host=", "   Target host")
    Script.parseCommandLine(ignoreErrors=False)
    for switch in Script.getUnprocessedSwitches():
        if switch[0].lower() == "h" or switch[0].lower() == "host":
            host = switch[1]

    from DIRAC.FrameworkSystem.Client.SystemAdministratorClientCLI import SystemAdministratorClientCLI

    cli = SystemAdministratorClientCLI(host)
    cli.cmdloop()
    def do_install(self, args):
        """ Install various DIRAC components

        usage:

          install mysql
          install db <database>
          install service <system> <service> [-m <ModuleName>] [-p <Option>=<Value>] [-p <Option>=<Value>] ...
          install agent <system> <agent> [-m <ModuleName>] [-p <Option>=<Value>] [-p <Option>=<Value>] ...
          install executor <system> <executor> [-m <ModuleName>] [-p <Option>=<Value>] [-p <Option>=<Value>] ...
          install consumer <consumer> [-m <ModuleName>] [-p <Option>=<Value>] [-p <Option>=<Value>] ...
    """

        DIRACSystemAdministratorClientCLI.do_install(self, args)
    def do_stop(self, args):
        """ Stop services or agents or database server

        usage:

          stop <system|*> <service|agent|*>
          stop mysql
          stop <service name>
    """
        argss = args.split()
        if len(argss) < 1:
            gLogger.notice(self.do_stop.__doc__)
            return
        option = argss[0]
        del argss[0]

        if option in self.externalServices:
            self.manageService(option, 'stop')
        else:
            DIRACSystemAdministratorClientCLI.do_stop(self, args)
    def do_restart(self, args):
        """ Restart services or agents or database server

        usage:

          restart <system|*> <service|agent|*>
          restart mysql
          restart <service name>
    """
        argss = args.split()
        if len(argss) < 1:
            gLogger.notice(self.do_restart.__doc__)
            return
        option = argss[0]
        del argss[0]

        if option in self.externalServices:
            self.manageService(option, 'restart')
        else:
            DIRACSystemAdministratorClientCLI.do_restart(self, args)
    def setUp(self):
        self.host = 'localhost'
        self.notificationPort = 9154
        self.rootPwd = ''
        self.csClient = CSAPI()
        self.monitoringClient = ComponentMonitoringClient()
        self.client = SystemAdministratorClientCLI(self.host)

        self.csClient.downloadCSData()
        result = self.csClient.getCurrentCFG()
        if not result['OK']:
            raise Exception(result['Message'])
        cfg = result['Value']

        setup = cfg.getOption('DIRAC/Setup', 'JenkinsSetup')

        self.frameworkSetup = cfg.getOption('DIRAC/Setups/' + setup +
                                            '/Framework')
        self.rootPwd = cfg.getOption('Systems/Databases/Password')
        self.diracPwd = self.rootPwd
Exemple #7
0
    def setUp(self):
        self.host = 'localhost'
        self.notificationPort = 9154
        self.rootPwd = ''
        self.csClient = CSAPI()
        self.monitoringClient = ComponentMonitoringClient()
        self.client = SystemAdministratorClientCLI(self.host)

        self.csClient.downloadCSData()
        result = self.csClient.getCurrentCFG()
        if not result['OK']:
            raise Exception(result['Message'])
        cfg = result['Value']

        setup = cfg.getOption('DIRAC/Setup', 'dirac-JenkinsSetup')

        self.frameworkSetup = cfg.getOption('DIRAC/Setups/' + setup +
                                            '/Framework')
        self.rootPwd = cfg.getOption('Systems/Databases/Password')
        self.diracPwd = self.rootPwd

        result = getProxyInfo()
        if not result['OK']:
            raise Exception(result['Message'])
        chain = result['Value']['chain']
        result = chain.getCertInChain(-1)
        if not result['OK']:
            raise Exception(result['Message'])
        result = result['Value'].getSubjectDN()
        if not result['OK']:
            raise Exception(result['Message'])
        userDN = result['Value']
        result = getUsernameForDN(userDN)
        if not result['OK']:
            raise Exception(result['Message'])
        self.user = result['Value']
        if not self.user:
            self.user = '******'
Exemple #8
0
    def setUp(self):
        self.host = "localhost"
        self.notificationPort = 9154
        self.rootPwd = ""
        self.csClient = CSAPI()
        self.monitoringClient = ComponentMonitoringClient()
        self.client = SystemAdministratorClientCLI(self.host)

        self.csClient.downloadCSData()
        result = self.csClient.getCurrentCFG()
        if not result["OK"]:
            raise Exception(result["Message"])
        cfg = result["Value"]

        setup = cfg.getOption("DIRAC/Setup", "dirac-JenkinsSetup")

        self.frameworkSetup = cfg.getOption("DIRAC/Setups/" + setup +
                                            "/Framework")
        self.rootPwd = cfg.getOption("Systems/Databases/Password")
        self.diracPwd = self.rootPwd

        result = getProxyInfo()
        if not result["OK"]:
            raise Exception(result["Message"])
        chain = result["Value"]["chain"]
        result = chain.getCertInChain(-1)
        if not result["OK"]:
            raise Exception(result["Message"])
        result = result["Value"].getSubjectDN()
        if not result["OK"]:
            raise Exception(result["Message"])
        userDN = result["Value"]
        result = getUsernameForDN(userDN)
        if not result["OK"]:
            raise Exception(result["Message"])
        self.user = result["Value"]
        if not self.user:
            self.user = "******"
Exemple #9
0
#!/usr/bin/env python
########################################################################
# $HeadURL$
########################################################################
__RCSID__ = "$Id$"
from DIRAC.Core.Base import Script

host = None
Script.registerSwitch("H:", "host=", "   Target host")
Script.parseCommandLine(ignoreErrors=False)
for switch in Script.getUnprocessedSwitches():
    if switch[0].lower() == "h" or switch[0].lower() == "host":
        host = switch[1]

from DIRAC.FrameworkSystem.Client.SystemAdministratorClientCLI import SystemAdministratorClientCLI

cli = SystemAdministratorClientCLI(host)
cli.cmdloop()
#!/usr/bin/env python
########################################################################
# $HeadURL$
########################################################################
__RCSID__ = "$Id$"
from DIRAC.Core.Base import Script

host = None
Script.registerSwitch( "H:", "host=", "   Target host" )
Script.parseCommandLine( ignoreErrors = False )
for switch in Script.getUnprocessedSwitches():
  if switch[0].lower() == "h" or switch[0].lower() == "host":
    host = switch[1]

from DIRAC.FrameworkSystem.Client.SystemAdministratorClientCLI import SystemAdministratorClientCLI

cli = SystemAdministratorClientCLI( host )
cli.cmdloop()