1
|
import psycopg2 as PgSQL
|
2
|
import threading, Queue
|
3
|
from zephir.backend import config
|
4
|
from time import sleep
|
5
|
|
6
|
from creole.lxml_parser import parse_xml_file
|
7
|
from creole3.lxml_parser import parse_xml_file as parse_xml_file3
|
8
|
from creole3.dtd_parser import parse_dtd
|
9
|
from creole3.config import dtdfilename
|
10
|
|
11
|
ETAB='1'
|
12
|
ID='85'
|
13
|
CREOLE='creole3'
|
14
|
|
15
|
DTD=parse_dtd(dtdfilename)
|
16
|
DIR='/var/lib/zephir/conf/' + ETAB + '/' + ID + '/dicos/module/'
|
17
|
DICO=[DIR + '00_common.xml',
|
18
|
DIR + '22_logs_proxy.xml',
|
19
|
DIR + '01_container.xml',
|
20
|
DIR + '22_mysql.xml',
|
21
|
DIR + '01_log.xml',
|
22
|
DIR + '22_spamassassin.xml',
|
23
|
DIR + '01_network.xml',
|
24
|
DIR + '23_annuaire.xml',
|
25
|
DIR + '02_advanced_network.xml',
|
26
|
DIR + '23_courier.xml',
|
27
|
DIR + '02_certif.xml',
|
28
|
DIR + '23_phpmyadmin.xml',
|
29
|
DIR + '05_apt-cacher-ng.xml',
|
30
|
DIR + '23_proxy_bypass.xml',
|
31
|
DIR + '10_era.xml',
|
32
|
DIR + '23_proxy.xml',
|
33
|
DIR + '14_agregation.xml',
|
34
|
DIR + '24_cups.xml',
|
35
|
DIR + '19_password.xml',
|
36
|
DIR + '24_proxy_parent.xml',
|
37
|
DIR + '20_antivirus.xml',
|
38
|
DIR + '25_nginx.xml',
|
39
|
DIR + '20_bacula.xml',
|
40
|
DIR + '25_proftpd.xml',
|
41
|
DIR + '20_client_annuaire.xml',
|
42
|
DIR + '25_sympa.xml',
|
43
|
DIR + '20_dhcp.xml',
|
44
|
DIR + '26_freeradius.xml',
|
45
|
DIR + '20_dhcrelay.xml',
|
46
|
DIR + '26_mail.xml',
|
47
|
DIR + '20_esu.xml',
|
48
|
DIR + '28_eoleflask.xml',
|
49
|
DIR + '20_fichier-primaire.xml',
|
50
|
DIR + '29_eoleapps.xml',
|
51
|
DIR + '20_fichier.xml',
|
52
|
DIR + '29_scribehorus.xml',
|
53
|
DIR + '20_nscd.xml',
|
54
|
DIR + '29_zephir_container.xml',
|
55
|
DIR + '20_nut.xml',
|
56
|
DIR + '30_amon.xml',
|
57
|
DIR + '20_vpn_amon.xml',
|
58
|
DIR + '30_scribe.xml',
|
59
|
DIR + '20_vpn.xml',
|
60
|
DIR + '50_amonecole.xml',
|
61
|
DIR + '20_web.xml',
|
62
|
DIR + '60_roundcube.xml',
|
63
|
DIR + '21_sso.xml',
|
64
|
DIR + '61_ajaxplorer.xml',
|
65
|
DIR + '22_dns.xml',
|
66
|
DIR + '61_cntlm.xml',
|
67
|
DIR + '22_ead.xml']
|
68
|
|
69
|
|
70
|
class mythread(threading.Thread):
|
71
|
def __init__(self, queue, i):
|
72
|
threading.Thread.__init__(self)
|
73
|
print "init", i
|
74
|
self.i = i
|
75
|
self.queue = queue
|
76
|
|
77
|
def run(self):
|
78
|
sleep(1)
|
79
|
|
80
|
for i in DICO:
|
81
|
if CREOLE == 'creole3':
|
82
|
parse_xml_file3(i, DTD)
|
83
|
else:
|
84
|
parse_xml_file(i)
|
85
|
print 'finish', self.i
|
86
|
|
87
|
queue = Queue.Queue()
|
88
|
for i in xrange(0, 30):
|
89
|
thread = mythread(queue, i)
|
90
|
thread.start()
|
91
|
|
92
|
queue.join()
|
93
|
|