Example #1
0
def has_section(section, issuer=None):
    """
    Indicates whether the named section is present in the configuration.

    :param section: The name of the section.
    :param issuer: The issuer account.
    :returns: True/False
    """

    kwargs = {'issuer': issuer, 'section': section}
    if not permission.has_permission(issuer=issuer, action='config_has_section', kwargs=kwargs):
        raise exception.AccessDenied('%s cannot check existence of section %s' % (issuer, section))
    return config.has_section(section)
Example #2
0
def has_section(section, issuer=None):
    """
    Indicates whether the named section is present in the configuration.

    :param section: The name of the section.
    :param issuer: The issuer account.
    :returns: True/False
    """

    kwargs = {'issuer': issuer, 'section': section}
    if not permission.has_permission(issuer=issuer, action='config_has_section', kwargs=kwargs):
        raise exception.AccessDenied('%s cannot check existence of section %s' % (issuer, section))
    return config.has_section(section)
Example #3
0
def map_vo(vo):
    """
    Converts a long VO name into the internal short (three letter)
    tag mapping.
    Mappings are loaded from the vo-map section of the config database table.
    If a mapping is not found, the orignal is returned unchanged.
    :param vo: The long VO name string.
    :returns: The short VO name string.
    """
    # Newline is ignored by regexp if at end of string, so test for that as well.
    if not LONG_VO_RE.match(vo) or '\n' in vo:
        raise exception.RucioException('Invalid characters in VO name.')
    if not config_db.has_section("vo-map"):
        return vo  # No mapping config
    return config_db.get("vo-map", vo, default=vo)