def check_opts(self): ''' in addition to LockssScript.check_option: checking that credentials ''' LockssScript.check_opts(self) # options.action comes from commmand line args # options.actionlist comes from config files # action command line args take precendence over args from config files self.require_server() self.require_auids() self.require_credentials() if (len(self.options.serverlist) != 1): self.option_parser.error("must give exactly one server"); self.options.server = self.options.serverlist[0]; if (not self.options.dir): self.options.dir = self.options.server[0] if (not os.path.exists(self.options.dir)): os.mkdir(self.options.dir) if (not self.options.pause > 0): self.option_parser.error("pause must be greater than 0") self.options.crawlheaders = LockssCrawlStatus.strToPrtFields(self.options.crawlheaders)
def check_opts(self): LockssScript.check_opts(self) self.require_server() self.require_auids() if (self.options.max < 1): self.option_parser.error("max value (%d) must be greater equal 1" % self.options.max)
def check_opts(self): print "chek_opts" LockssScript.check_opts(self) # options.server comes from commmand line args # options.serverlist comes from config files # server command line arg take precendence over args from config files if (self.options.server): self.options.serverlist = self.parse_server(self.options.server) else: print self.options.serverlist if (self.options.serverlist.__class__ == str): self.options.serverlist = self.options.serverlist.split('\n') serverlist = self.options.serverlist self.options.serverlist = [] for a in serverlist: a = a.strip() if (a): self.options.serverlist.append(self.parse_server(a)) print self.options.serverlist if (not self.options.serverlist): self.option_parser.error( "Must give at least one server") if (not os.path.exists(self.options.dir)): os.mkdir(self.options.dir) self.require_credentials() print self.options
def _create_opt_parser(self): option_parser = LockssScript._create_opt_parser(self) option_parser.add_option('-a', '--action', action='append', type='choice', choices=Action.values, help='which action to take on arhival units, available ' + str(Action.values)) option_parser.add_option('--ncrawllimit', type='int', help='limiting the number of printed crawl status per archival units in printcrawlstatus [%default]') option_parser.add_option('-x', '--expire', type='int', help='number of hours after which to expire data from LOCKSS caches [%default]') option_parser.add_option('--noquit', action='store_true', help = "repeat status datat requests for failed auids until all succeed" ) option_parser.add_option('-o', '--outputdir', dest= 'dir', help="Directory for output files [defaults to server's domain name]") option_parser.add_option('--crawlsort', type='choice', choices=LockssCrawlStatus.SORTFIELDS, help='sort field for ' + Action.PRTCRAWLSTATUS + ' action [%default]; available ' + ",".join(sorted(LockssCrawlStatus.SORTFIELDS))) option_parser.add_option('--crawlheaders', help='headers for ' + Action.PRTCRAWLSTATUS + ' [%default]; available headers: ' + ",".join(sorted(LockssCrawlStatus.PRTFIELDS)) ) option_parser.add_option('--ausummarysort', type='choice', choices=LockssCacheAuSummary.SORTFIELDS, help='sort field for ' + Action.PRTAUSUMMARY + ' action [%default]; available ' + ",".join(sorted(LockssCacheAuSummary.SORTFIELDS))) option_parser.add_option('--ausummaryheaders', help='headers for ' + Action.PRTAUSUMMARY + ' [%default]; available headers: ' + ",".join(sorted(LockssCacheAuSummary.PRTFIELDS)) ) option_parser.add_option('--urlsort', type='choice', choices=UrlReport.SORTFIELDS, help='sort field for ' + Action.PRTURLLIST + ' action [%default]; available ' + ",".join(sorted(UrlReport.SORTFIELDS))) option_parser.add_option('--urlheaders', help='headers for ' + Action.PRTURLLIST + ' [%default]; available headers: ' + ",".join(sorted(UrlReport.PRTFIELDS)) ) option_parser.add_option('--urlminversion', help='include only urls with a version at least minversion when doing' + Action.PRTURLLIST + ' [%default] ' ) return option_parser
def _create_opt_parser(self): option_parser = LockssScript._create_parser(self, False, True) option_parser.add_option('-S', '--serverlist', action='append', help='server with port ') option_parser.add_option('-o', '--outputdir', dest= 'dir', help="Directory for output files [defaults to server's domain name]") option_parser.add_option('--noquit', action='store_true', help = "repeat status data requests for failed auids until all succeed" ) return option_parser
def _create_opt_parser(self): option_parser = LockssScript._create_parser(self, au_params=False, mayHaveServer=False, credentials=False) option_parser.add_option('-N', '--Network', dest="network", help="print cache from give network only") option_parser.add_option('-n', '--nickname', action='store_true', help="print cache's nickname [%default]") option_parser.add_option('-D', '--dnsname', action='store_true', help="print cache's dnsname [%default]") option_parser.add_option('--nwname', action='store_true', help="print cache's network name [%default]") option_parser.add_option('-u', '--url', action='store_true', help="print cache's login url [%default]") return option_parser
def _create_opt_parser(self): option_parser = LockssScript._create_opt_parser(self) option_parser.add_option('--pause', type='int', help="pause time in seconds between retrying active crawls [%default]") option_parser.add_option('-o', '--outputdir', dest= 'dir', help='output directory [%default]') option_parser.add_option('--crawlsort', type='choice', choices=LockssCrawlStatus.SORTFIELDS, help='sort field for ' + Action.PRTCRAWLSTATUS + ' action [%default]; available ' + str(LockssCrawlStatus.SORTFIELDS)) option_parser.add_option('--crawlheaders', help='headers for ' + Action.PRTCRAWLSTATUS + ' [%default]; available headers ' + str(LockssCrawlStatus.PRTFIELDS) ) return option_parser
def __init__(self, argv0): LockssScript.__init__(self, argv0, '$Revision$', Report_commpeer.MYCONFIGS)
def _create_opt_parser(self): option_parser = LockssScript._create_parser(self, au_params=True, mayHaveServer=True, credentials=True) option_parser.add_option('-m', '--max', type='int', help='maximum crawls that will be started') return option_parser
def __init__(self, argv0): LockssScript.__init__(self, argv0, '$Revision$', {'max': 10})
def __init__(self, argv0): LockssScript.__init__(self, argv0, "$Revision$", {})
def __init__(self, argv0): LockssScript.__init__(self, argv0, '$Revision$', Cachestatus.MYCONFIGS)
def log_opts(self): LockssScript.log_opts(self) if (self.options.action): for a in self.options.action: log.info("ACTION = %s", a)
def check_opts(self): ''' in addition to LockssScript.check_option: checking that at least on action is given credentials are given with get actions ''' LockssScript.check_opts(self) # options.action comes from commmand line args # options.actionlist comes from config files # action command line args take precendence over args from config files if (not self.options.action and self.options.actionlist): actionlist = self.options.actionlist.split('\n') self.options.action = [] for a in actionlist: a = a.strip() if (a): if (a in Action.values): self.options.action.append(a) else: self.option_parser.error( "Unknown action '%s'" % a) if (not self.options.action): self.option_parser.error( "Must give at least one get action; available actions %s" % str(Action.values)) if (Action.GETURLLIST in self.options.action): self.options.action.append(Action.GETAUSUMMARY) for a in self.options.action: if (a in Action.need_auids): self.require_auids() break if (self.options.expire < 0): self.option_parser.error("Expire option must be greater equal zero"); self.options.expire = timedelta(hours=self.options.expire) self.require_server() if (not os.path.exists(self.options.dir)): os.mkdir(self.options.dir) self.options.need_credentials = False for a in self.options.action: if (a in Action.need_credentials): self.options.need_credentials = True if (self.options.need_credentials): self.require_credentials() try: self.options.urlheaders = UrlReport.strToPrtFields(self.options.urlheaders) except RuntimeError as rt: self.option_parser.error("%s available urlheader option: %s" % (rt, Url.PRTFIELDS)) try: self.options.ausummaryheaders = LockssCacheAuSummary.strToPrtFields(self.options.ausummaryheaders) except RuntimeError as rt: self.option_parser.error("%s available ausummmaryheader option: %s" % (rt, LockssCacheAuSummary.PRTFIELDS)) try: self.options.crawlheaders = LockssCrawlStatus.strToPrtFields(self.options.crawlheaders) except RuntimeError as rt: self.option_parser.error("%s, available crawlheaderoption: %s" % (rt, LockssCrawlStatus.PRTFIELDS))
def __init__(self, argv0): LockssScript.__init__(self, argv0, '$Revision$', Caches.CONFIGURATION_DEFAULTS)
def log_opts(self): LockssScript.log_opts(self) for a in self.options.serverlist: log.info("SERVER = %s", a)
def __init__(self, argv0): LockssScript.__init__(self, argv0, '$Revision$', Crawlwatcher.MYCONFIGS)