Statistics
| Branch: | Tag: | Revision:

root / snf-ganeti-tools / synnefo / ganeti / config.py @ 45ebfd48

History | View | Annotate | Download (664 Bytes)

1
import os
2
import imp
3
import sys
4
import glob
5

    
6
def load(conf_dir): 
7
    """Takes a configuration file directory and interprets all *.conf files"""
8

    
9
    files = glob.glob(os.path.join(conf_dir, '*.conf'))
10

    
11
    for filename in sorted(files):
12
        if sys.version_info > (2, 6):
13
            # We are using a version that understands PYTHONDONTWRITEBYTECODE
14
            # so it is safe to use imp.load_source here
15
            module = imp.load_source(filename, filename)
16
            #CONFIG = getattr(module, 'CONFIG', None)
17
        else:
18
            module = {}
19
            execfile(filename, module)
20
            #CONFIG = module.get('CONFIG')
21

    
22
        return module