10 from optparse
import OptionParser
11 parser = OptionParser(usage =
"usage: %prog arguments", version=
"%prog")
12 parser.add_option(
"-v",
"--verbose", action=
"store_true", dest=
"verbose", help=
"Set verbose mode (default: %default)")
13 parser.add_option(
"-y",
"--alwaysyes", action=
"store_true", dest=
"alwaysyes", help=
"Always answer yes to checks (default: %default)")
14 parser.add_option(
"-i",
"--infile", action=
"store", dest=
"infile", help=
"Input file (default: %default)")
15 parser.add_option(
"-x",
"--xsreffile", action=
"store", dest=
"xsreffile", help=
"Cross section reference file (default: %default)")
16 parser.add_option(
"-t",
"--istest", action=
"store", dest=
"istest", help=
"Is test (no actual upload to AMI) (default: %default)")
17 parser.add_option(
"-d",
"--delim", action=
"store", dest=
"delim", help=
"Delimiter for input file (default: %default)")
18 parser.add_option(
"-e",
"--explanation",action=
"store", dest=
"explanation",help=
"Comment for explanation field (default: %default)")
19 parser.add_option(
"-D",
"--DS", action=
"store", dest=
"DS", help=
"DS to modify (default: %default)")
20 parser.add_option(
"-p",
"--param", action=
"store", dest=
"param", help=
"Parameter to modify (default: %default)")
21 parser.add_option(
"-V",
"--value", action=
"store", dest=
"value", help=
"Value to upload (default: %default)")
23 parser.set_defaults(verbose=
False,alwaysyes=
False,infile=
None,xsreffile=basepath+
"InputInformation/CrossSectionReference",istest=
"TRUE",delim=
';',explanation=
None)
25 (opts, args) = parser.parse_args()
27 if not opts.explanation:
28 print "ERROR: No explanation found - Should be JIRA ticket or similar"
30 elif 'CENTRPAGE' not in opts.explanation:
31 print "WARNING: Explanation found, but does not include CENTRPAGE - this should usually be a JIRA ticket"
33 if opts.istest==
"FALSE":
36 UT=
uploadTools.UT(istest=opts.istest,verbose=opts.verbose,alwaysyes=opts.alwaysyes,xsRefFile=opts.xsreffile
if hasattr(opts,
"xsreffile")
else None,delim=opts.delim
if hasattr(opts,
"delim")
else None)
41 print cols.FAIL+
"INFO: THIS IS NOT A TEST - UPLOADING FOR REALS!"+cols.ENDC
43 print cols.OKGREEN+
"INFO: THIS IS A TEST - Nothing will be uploaded!"+cols.ENDC
47 UT.updateValue(opts.DS,opts.param,opts.value,opts.explanation)