Beispiel #1
0
def load_config(cfg_file='globus-config.yml', logger=logging.log):
    config = None
    config_dir = get_config_dirs()[0]
    if os.path.isfile(os.path.join(config_dir, cfg_file)):
        config = os.path.join(config_dir, cfg_file)
    else:
        logger(logging.ERROR, 'Could not find globus config file')
        raise Exception
    return yaml.safe_load(open(config).read())
Beispiel #2
0
def load_test_conf_file(file_name):
    config_dir = next(
        filter(lambda d: os.path.exists(os.path.join(d, file_name)),
               get_config_dirs()))
    with open(os.path.join(config_dir, file_name)) as f:
        return json.load(f)
Beispiel #3
0
import json
import os
import tempfile
from random import choice
from string import ascii_uppercase

import pytest
from six import PY3

from rucio.common.config import config_get, config_get_bool, get_config_dirs
from rucio.common.utils import generate_uuid as uuid, execute

skip_rse_tests_with_accounts = pytest.mark.skipif(
    not any(
        os.path.exists(os.path.join(d, 'rse-accounts.cfg'))
        for d in get_config_dirs()),
    reason='fails if no rse-accounts.cfg found')
skiplimitedsql = pytest.mark.skipif(
    'RDBMS' in os.environ and os.environ['RDBMS'] == 'sqlite',
    reason="does not work in SQLite because of missing features")
skip_multivo = pytest.mark.skipif('SUITE' in os.environ
                                  and os.environ['SUITE'] == 'multi_vo',
                                  reason="does not work for multiVO")


def get_long_vo():
    """ Get the VO name from the config file for testing.
    Don't map the name to a short version.
    :returns: VO name string.
    """
    vo_name = 'def'
Beispiel #4
0
    import html.parser as HTMLParser
import datetime
import glob
import hashlib
import logging
import operator
import os
import re
import requests

import gfal2

CHUNK_SIZE = 10485760

__DUMPERCONFIGDIRS = (os.path.join(confdir, 'auditor')
                      for confdir in get_config_dirs())
__DUMPERCONFIGDIRS = list(filter(os.path.exists, __DUMPERCONFIGDIRS))


class Parser(ConfigParser.RawConfigParser, object):
    '''
    RawConfigParser subclass that doesn't modify the the name of the options
    and removes any quotes arround the string values.
    '''
    remove_quotes_re = re.compile(r"^'(.+)'$")
    remove_double_quotes_re = re.compile(r'^"(.+)"$')

    def optionxform(self, optionstr):
        return optionstr

    def get(self, section, option):
Beispiel #5
0
    type = 'USER'
    try:
        client.get_account(account)
        print 'Account \'' + account + '\' is already registered as Rucio account'
    except exception.AccountNotFound:
        client.add_account(account, type, None)
        pass
    except exception.InvalidObject as e:
        print e[0][0]
        pass


# Get LDAP Config
config = ConfigParser.ConfigParser()
has_config = False
for configfile in (os.path.join(confdir, 'ldap.cfg') for confdir in get_config_dirs()):
    has_config = config.read(configfile) == [configfile]
    if has_config:
        break

# Global Variables
client = Client()
server_url = config.get('ldap', 'ldap_host')
baseDN = config.get('ldap', 'baseDN')
searchScope = ldapurl.LDAP_SCOPE_SUBTREE
retrieveAttributes = ['uid', 'gecos', 'mail']
if config.get('attributes', 'account') != 'uid':
    retrieveAttributes.append('account')
if config.get('attributes', 'auth_type') != 'DEFAULT':
    retrieveAttributes.append('auth_type')
searchFilter = config.get('ldap', 'searchFilter')
Beispiel #6
0
import logging
import operator
import os
import re
import requests

try:
    import gfal2
except ImportError as e:
    import sys
    if 'nose' not in sys.modules and 'py.test' not in sys.modules and 'sphinx' not in sys.modules:
        raise e

CHUNK_SIZE = 10485760

__DUMPERCONFIGDIRS = (os.path.join(confdir, 'auditor') for confdir in get_config_dirs())
__DUMPERCONFIGDIRS = list(filter(os.path.exists, __DUMPERCONFIGDIRS))


class Parser(ConfigParser.RawConfigParser, object):
    '''
    RawConfigParser subclass that doesn't modify the the name of the options
    and removes any quotes arround the string values.
    '''
    remove_quotes_re = re.compile(r"^'(.+)'$")
    remove_double_quotes_re = re.compile(r'^"(.+)"$')

    def optionxform(self, optionstr):
        return optionstr

    def get(self, section, option):