def siteName(): """ Determine and return DIRAC name for current site """ global __siteName if not __siteName: __siteName = gConfig.getValue("/LocalSite/Site") if not __siteName: # Some Defaults if not present in the configuration FQDN = getFQDN() if len(FQDN.split(".")) > 2: # Use the last component of the FQDN as country code if there are more than 2 components __siteName = "DIRAC.Client.%s" % FQDN.split(".")[-1] else: # else use local as country code __siteName = "DIRAC.Client.local" return __siteName
# Import DIRAC.Core.Utils modules #from DIRAC.Core.Utilities import * from DIRAC.Core.Utilities.Network import getFQDN import DIRAC.Core.Utilities.ExitCallback as ExitCallback from DIRAC.Core.Utilities.ReturnValues import S_OK, S_ERROR # Logger from DIRAC.FrameworkSystem.Client.Logger import gLogger # Configuration client from DIRAC.ConfigurationSystem.Client.Config import gConfig # Some Defaults if not present in the configuration FQDN = getFQDN() if len(FQDN.split('.')) > 2: # Use the last component of the FQDN as country code if there are more than 2 components _siteName = 'DIRAC.Client.%s' % FQDN.split('.')[-1] else: # else use local as country code _siteName = 'DIRAC.Client.local' __siteName = False # # Update DErrno with the extensions errors # from DIRAC.Core.Utilities.ObjectLoader import ObjectLoader # from DIRAC.ConfigurationSystem.Client.Helpers import CSGlobals # allExtensions = CSGlobals.getCSExtensions() # # # Update for each extension. Careful to conflict :-)
#from DIRAC.Core.Utilities import * from DIRAC.Core.Utilities.Network import getFQDN import DIRAC.Core.Utilities.ExitCallback as ExitCallback from DIRAC.Core.Utilities.ReturnValues import S_OK, S_ERROR # Logger from DIRAC.FrameworkSystem.Client.Logger import gLogger # Configuration client from DIRAC.ConfigurationSystem.Client.Config import gConfig # Some Defaults if not present in the configuration FQDN = getFQDN() if len(FQDN.split('.')) > 2: # Use the last component of the FQDN as country code if there are more than 2 components _siteName = 'DIRAC.Client.%s' % FQDN.split('.')[-1] else: # else use local as country code _siteName = 'DIRAC.Client.local' __siteName = False # # Update DErrno with the extensions errors # from DIRAC.Core.Utilities.ObjectLoader import ObjectLoader # from DIRAC.ConfigurationSystem.Client.Helpers import CSGlobals # allExtensions = CSGlobals.getCSExtensions() #
def test_getFQDN(): assert isinstance(getFQDN(), str)