75 |
|
#tmpBad = ['fnal'] |
76 |
|
for tmp in tmpBad: |
77 |
|
tmp=string.strip(tmp) |
78 |
< |
if (tmp == 'cnaf'): tmp = 'webserver' ########## warning: temp. patch |
78 |
> |
#if (tmp == 'cnaf'): tmp = 'webserver' ########## warning: temp. patch |
79 |
|
CEBlackList.append(tmp) |
80 |
|
except KeyError: |
81 |
|
pass |
82 |
+ |
|
83 |
+ |
CEWhiteList = [] |
84 |
+ |
try: |
85 |
+ |
tmpGood = string.split(self.cfg_params['EDG.ce_white_list'],',') |
86 |
+ |
#tmpGood = ['cern'] |
87 |
+ |
for tmp in tmpGood: |
88 |
+ |
tmp=string.strip(tmp) |
89 |
+ |
#if (tmp == 'cnaf'): tmp = 'webserver' ########## warning: temp. patch |
90 |
+ |
CEWhiteList.append(tmp) |
91 |
+ |
except KeyError: |
92 |
+ |
pass |
93 |
+ |
|
94 |
+ |
#print 'CEWhiteList: ',CEWhiteList |
95 |
+ |
self.reCEWhiteList=[] |
96 |
+ |
for Good in CEWhiteList: |
97 |
+ |
self.reCEWhiteList.append(re.compile( Good )) |
98 |
+ |
#print 'ReGood: ',self.reCEWhiteList |
99 |
+ |
|
100 |
|
common.logger.debug(5,'CEBlackList: '+str(CEBlackList)) |
101 |
+ |
common.logger.debug(5,'CEWhiteList: '+str(CEWhiteList)) |
102 |
|
self.reCEBlackList=[] |
103 |
|
for bad in CEBlackList: |
104 |
|
self.reCEBlackList.append(re.compile( bad )) |
207 |
|
# check that PubDBurl occurrance is the same as the number of collections |
208 |
|
if ( allurls.count(url)==countColl ) : |
209 |
|
SelectedPubDBURLs.append(url) |
210 |
+ |
common.logger.debug(5,'PubDBs '+str(SelectedPubDBURLs)) |
211 |
|
|
212 |
|
#print 'Required Collections',CollIDs,'are all present in PubDBURLs : ',SelectedPubDBURLs,'\n' |
213 |
< |
#### check based on CE black list: select only PubDB not in the CE black list |
214 |
< |
GoodPubDBURLs=self.checkBlackList(SelectedPubDBURLs) |
213 |
> |
#### check based on CE black list: select only PubDB not in the CE black list |
214 |
> |
tmp=self.checkBlackList(SelectedPubDBURLs) |
215 |
> |
common.logger.debug(5,'PubDBs after black list '+str(tmp)) |
216 |
> |
|
217 |
> |
### check based on CE white list: select only PubDB defined by user |
218 |
> |
GoodPubDBURLs=self.checkWhiteList(tmp) |
219 |
> |
common.logger.debug(5,'PubDBs after white list '+str(GoodPubDBURLs)) |
220 |
|
return GoodPubDBURLs |
221 |
|
|
222 |
|
####################################################################### |
223 |
|
def uniquelist(self, old): |
224 |
|
""" |
225 |
< |
remove duplicates from a list |
225 |
> |
remove duplicates from a list |
226 |
|
""" |
227 |
|
nd={} |
228 |
|
for e in old: |
230 |
|
return nd.keys() |
231 |
|
|
232 |
|
####################################################################### |
233 |
+ |
def checkWhiteList(self, pubDBUrls): |
234 |
+ |
""" |
235 |
+ |
select PubDB URLs that are at site defined by the user (via CE white list) |
236 |
+ |
""" |
237 |
+ |
goodurls = [] |
238 |
+ |
for url in pubDBUrls: |
239 |
+ |
#print 'connecting to the URL ',url |
240 |
+ |
good=0 |
241 |
+ |
for re in self.reCEWhiteList: |
242 |
+ |
if re.search(url): |
243 |
+ |
common.logger.debug(5,'CE in white list, adding PubDB URL '+url) |
244 |
+ |
good=1 |
245 |
+ |
if not good: continue |
246 |
+ |
goodurls.append(url) |
247 |
+ |
if len(goodurls) == 0: |
248 |
+ |
common.logger.message("No selected PubDB URLs \n") |
249 |
+ |
else: |
250 |
+ |
common.logger.debug(5,"Selected PubDB URLs are "+str(goodurls)+"\n") |
251 |
+ |
return goodurls |
252 |
+ |
|
253 |
+ |
####################################################################### |
254 |
|
def checkBlackList(self, pubDBUrls): |
255 |
|
""" |
256 |
|
select PubDB URLs that are at site not exluded by the user (via CE black list) |