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(
"-t",
"--istest", action=
"store", dest=
"istest", help=
"Is test (no actual upload to AMI) (default: %default)")
15 parser.add_option(
"-e",
"--explanation",action=
"store", dest=
"explanation",help=
"Comment for explanation field (default: %default)")
16 parser.add_option(
"-d",
"--dataset", action=
"store", dest=
"dataset", help=
"Dataset to remove value from (default: %default)")
17 parser.add_option(
"-p",
"--param", action=
"store", dest=
"param", help=
"Parameter to remove (default: %default)")
19 parser.set_defaults(verbose=
False,alwaysyes=
False,istest=
"TRUE",explanation=
None,dataset=
None,param=
None)
21 (opts, args) = parser.parse_args()
23 if not opts.explanation:
24 print "ERROR: No explanation found - Should be JIRA ticket or similar"
26 elif 'CENTRPAGE' not in opts.explanation:
27 print "WARNING: Explanation found, but does not include CENTRPAGE - this should usually be a JIRA ticket"
30 print "ERROR: No dataset found"
34 print "ERROR: No parameter found"
37 if opts.istest==
"FALSE":
44 print cols.FAIL+
"INFO: THIS IS NOT A TEST - UPLOADING FOR REALS!"+cols.ENDC
46 print cols.OKGREEN+
"INFO: THIS IS A TEST - Nothing will be uploaded!"+cols.ENDC
49 UT.removeParamEntry(opts.dataset,UT.getScope(opts.dataset),opts.param,opts.explanation)