X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=bin%2Fcheck-hrns.py;h=9f24bf242eefcbb39fd37c827404b0a8b6687f35;hb=f7c23db02ca1ad10652e1b3a38a315ce10f5dfef;hp=f92d41277f5b96709a6ba473e0a27e454b2d994a;hpb=7e2ad8541774b6c74430d465a143fd1e960d0698;p=myplc.git diff --git a/bin/check-hrns.py b/bin/check-hrns.py index f92d412..9f24bf2 100755 --- a/bin/check-hrns.py +++ b/bin/check-hrns.py @@ -21,14 +21,14 @@ def handle_nodes (sites,sites_by_id, dry_run, verbose): if dry_run: continue SetNodeHrn (node['node_id'],hrn) else: - if verbose: print "host %s OK"%node['hostname'] + if verbose: print "Node %s OK"%node['hostname'] def handle_persons (sites,sites_by_id, dry_run,verbose): persons=GetPersons ({'peer_id':None},['person_id','email','hrn','site_ids']) for person in persons: how_many=len(person['site_ids']) if how_many !=1: - if verbose: print "person %s not in 1 site (%s instead) -- ignored"%(person['email'],how_many) + if verbose: print "Checking persons in exactly one site -- person %s in %s site(s) -- ignored"%(person['email'],how_many) continue try: login_base=sites_by_id[person['site_ids'][0]]['login_base'] except: print "Cannot handle person %s - site not found"%person['email']; continue @@ -42,7 +42,12 @@ def handle_persons (sites,sites_by_id, dry_run,verbose): def main(): - parser = OptionParser() + usage="""Usage: %prog + Checks that the hrn tags are correctly set +Example: + %prog -- -p -nv +""" + parser = OptionParser(usage=usage) parser.add_option("-p", "--person", action = "store_true", default = False, dest='persons',help="run on persons") parser.add_option("-n", "--node", action = "store_true", default = False,