check_hrns.py: external Sites are tagged with sfa_created=='True'
[myplc.git] / bin / check-hrns.py
index 7c8bdef..1ca6cdf 100755 (executable)
@@ -5,11 +5,7 @@ from optparse import OptionParser
 from PLC.Namespace import hostname_to_hrn, email_to_hrn, slicename_to_hrn
 # (auth_hrn, email):
 
-try:
-    from sfa.util.config import Config
-    toplevel=Config().SFA_INTERFACE_HRN
-except:
-    toplevel=api.config.PLC_HRN_ROOT
+toplevel=api.config.PLC_HRN_ROOT
 
 def handle_nodes (sites,sites_by_id, dry_run, verbose):
     nodes=GetNodes ({'peer_id':None},['node_id','hostname','hrn'])
@@ -112,9 +108,9 @@ Example:
     dry_run=options.show
     verbose=options.verbose
     # optimizing : we compute the set of sites only once
-    sites = GetSites({'peer_id':None},['site_id','login_base','node_ids','person_ids','name','hrn'])
+    sites = GetSites({'peer_id':None},['site_id','login_base','node_ids','person_ids','name','hrn','slice_ids', 'sfa_created'])
     # remove external sites created through SFA
-    sites = [site for site in sites if not site['name'].startswith('sfa:')]
+    sites = [site for site in sites if site['sfa_created'] != 'True']
     sites_by_id = dict ( [ (site['site_id'], site) for site in sites ] )
 
     if options.nodes: handle_nodes(sites,sites_by_id,dry_run,verbose)