ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/Processing/bin/sites.py
(Generate patch)

Comparing UserCode/MitProd/Processing/bin/sites.py (file contents):
Revision 1.2 by paus, Sat Jun 5 02:36:28 2010 UTC vs.
Revision 1.4 by paus, Tue Feb 28 11:54:36 2012 UTC

# Line 6 | Line 6 | import os,sys,types,string,getopt
6  
7   # Define string to explain usage of the script
8   usage =  "Usage: site.py --block=<name>\n"
9 + usage += "               [ --dbs=<name> ]\n"
10   usage += "               --help\n"
11      
12   # Define the valid options which can be specified and check out the command line
13 < valid = ['block=','help']
13 > valid = ['block=','dbs=','help']
14   try:
15      opts, args = getopt.getopt(sys.argv[1:], "", valid)
16   except getopt.GetoptError, ex:
# Line 22 | Line 23 | except getopt.GetoptError, ex:
23   # --------------------------------------------------------------------------------------------------
24   # Set defaults for each option
25   block = None
26 + dbs   = ''
27  
28   # Read new values from the command line
29   for opt, arg in opts:
# Line 30 | Line 32 | for opt, arg in opts:
32          sys.exit(0)
33      if opt == "--block":
34          block = arg
35 +    if opt == "--dbs":
36 +        dbs   = arg
37  
38   # Deal with obvious problems
39   if block == None:
# Line 40 | Line 44 | if block == None:
44   # main
45   #---------------------------------------------------------------------------------------------------
46   # find relevant site for this block
47 < cmd  = "dbs search --query=\"find site where block=" + block + "\""
47 > cmd  = "dbs search "
48 > if dbs != '':
49 >    cmd += " --url=" + dbs
50 > cmd += " --query=\"find site where block=" + block + "\""
51   cmd += "| grep -v DBS | grep \\\."
52   sites = []
53   siteText = ''
# Line 51 | Line 58 | for line in os.popen(cmd).readlines():
58              siteText += ','
59          siteText += line
60  
61 + if siteText[0] == ',':
62 +    siteText = siteText[1:]
63 +
64   print siteText

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines