def main():
    parser = optparse.OptionParser()
    parser.add_option('--output', '-O', default="out.txt")
    options, arguments = parser.parse_args()
    if(len(sys.argv)>=2):
        pass
    else:
        sys.exit("None output file passed. Aborting.")

    site_names= getSiteDBSiteNames()
    site_names= [x for x in site_names if re.match('T[0-3]_*',x[1])<>None]
#    site_names= [x for x in site_names if re.match('T3_*',x[1])<>None]
    k=0
    f=open(options.output, 'w')
    for k in range(len(site_names)):
        f.write('%s\n'%(site_names[k][1]))
    f.close()
Beispiel #2
0
    # load exception list
    try:
        fp = open(os.environ['EXCEPTIONS'], 'r')
        exception_dict = eval(fp.read())
        fp.close()
    except Exception, e:
        print('Error loading exceptionlist configuration... Aborting.')
        exit(0)

    # now initialize the robot
    br = init()

    ######################How to check members? Get the list from siteDB
    print('Trying to create a squad for %s' % (cms_name))
    allSites = getSiteDBSiteNames()
    siteAlias = [x[0] for x in allSites if x[1] == cms_name]
    list_sitedb = getCMSNamesToAdmin(siteAlias[0])
    list_sitedb = [(x[0], x[1].split()[-1], x[2]) for x in list_sitedb]

    if (len(list_sitedb) == 0):
        print('Site %s not found at SiteDB database or without contacts' %
              (cms_name))
        sys.exit()

    # remove from list_sitedb everybody blacklisted
    try:
        site_blacklist = blacklist[cms_name]
        temp_list = []
        for member in list_sitedb:
            aMember = " ".join(member[:-1])
new_def_fac=DefaultFactory()
new_def_fac._forms_factory=new_form_fac
br=Browser(factory=new_def_fac)

#br.set_handle_referer(True)
br.set_handle_refresh(True)
#br.set_handle_equiv(True)

## HTTP Error 403: request disallowed by robots.txt
br.set_handle_robots(False)

#lets get a list of CMS names from SiteDB
label="Getting site names from SiteDB".ljust(50,'.')
sys.stdout.write(label[0:40])
sys.stdout.flush()
siteNamesFromSiteDB = getSiteDBSiteNames()

siteNamesFromSiteDB=[x[1] for x in siteNamesFromSiteDB]
for site in siteNamesFromSiteDB:
  if site.endswith('_Disk'):
    siteNamesFromSiteDB.remove(site)

totalNames = len(siteNamesFromSiteDB)

if totalNames==0:
  sys.stdout.write('   Error: site names not fetched - Aborting')
  sys.stdout.flush()
  exit(2)

sys.stdout.write('   Ok  (%d names fetched from SiteDB)\n'%totalNames)
sys.stdout.flush()
    # load exception list
    try:
      fp = open(os.environ['EXCEPTIONS'], 'r')
      exception_dict=eval(fp.read())
      fp.close()
    except Exception,e:
      print('Error loading exceptionlist configuration... Aborting.')
      exit(0)


    # now initialize the robot
    br=init()

######################How to check members? Get the list from siteDB
    print('Trying to create a squad for %s' %(cms_name))
    allSites = getSiteDBSiteNames()
    siteAlias= [x[0] for x in allSites if x[1] == cms_name]
    list_sitedb = getCMSNamesToAdmin(siteAlias[0])
    list_sitedb=[(x[0],x[1].split()[-1],x[2]) for x in list_sitedb]
    
    if (len(list_sitedb)==0):
        print('Site %s not found at SiteDB database or without contacts'%(cms_name))
        sys.exit()

    # remove from list_sitedb everybody blacklisted
    try:
      site_blacklist=blacklist[cms_name]
      temp_list=[]
      for member in list_sitedb:
        aMember=" ".join(member[:-1])
        if aMember not in site_blacklist: