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 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): ''' 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): ''' 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))