Example #1
0
def update_distro_conf_file(path, distro, d):
    logger.debug('Updating distro %s' % path)
    desc = ""
    with open(path, 'r') as f:
        for line in f:
            if line.startswith('#@NAME:'):
                desc = line[7:].strip()
            if line.startswith('#@DESCRIPTION:'):
                desc = line[14:].strip()
                desc = re.sub(
                    r'Distribution configuration for( running)*( an)*( the)*',
                    '', desc)
                break

    distro_name = ''
    try:
        d = utils.parse_conf(path, d)
        distro_name = d.getVar('DISTRO_NAME', True)
    except Exception as e:
        logger.warn('Error parsing distro configuration file %s: %s' %
                    (path, str(e)))

    if distro_name:
        distro.description = distro_name
    else:
        distro.description = desc
Example #2
0
 def args(self, p):
     path = "cfgs/args"
     if not isfile(path): return
     d = parse_conf(path)
     for k, v in d.items():
         kwargs = v
         try:
             if kwargs["type"] == "int":
                 kwargs["type"] = int
             elif kwargs["type"] == "float":
                 kwargs["type"] = float
         except:
             pass
         p.add_argument("--" + self.__class__.__name__.lower() + "-" + k,
                        **kwargs)
Example #3
0
#!/usr/bin/python

# This script queries the publication table and produces several statistics

import MySQLdb;
from utils import parse_conf;

#parse conf.php file
conf = open("../conf.php");
credentials = parse_conf(conf);
conf.close()
host	= credentials['host']
user	= credentials['user']
passwd	= credentials['passwd']
db		= credentials['db']

mysql = MySQLdb.connect(unix_socket="/tmp/mysql.sock", host=host, user=user, passwd=passwd, db=db);
cursor = mysql.cursor()

# Number of accessions in table publications:
cursor.execute("SELECT distinct accession FROM publications WHERE accession is not null and accession !='' and accession != 'null'");
result = cursor.fetchall()
accessions_pub = [];
for item in result:
	accessions_pub.append(item[0]);

# Number of accessions in table sequences:
cursor.execute("SELECT distinct accession FROM sequences WHERE accession is not null and accession !='' and accession != 'null'");
result = cursor.fetchall()
accessions_seq = [];
for item in result:
Example #4
0
def service(config):
    """Jaguar service operations."""
    try:
        parse_conf(config)
    except:
        config.server['port'] = '8080'
Example #5
0
def policy(config):
    """Jaguar policy operations."""
    parse_conf(config)