Merge branch 'master' of ssh://git.onelab.eu/git/sfa
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 19 Oct 2010 11:01:54 +0000 (14:01 +0300)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 19 Oct 2010 11:01:54 +0000 (14:01 +0300)
Conflicts:
sfa/managers/aggregate_manager_max.py
sfa/util/xrn.py

sfa/managers/aggregate_manager_max.py
sfa/managers/registry_manager_pl.py
sfa/server/sfa-ca.py
sfa/util/xrn.py

index 2a46cb5..e586ffb 100644 (file)
@@ -3,7 +3,8 @@
 from sfa.util.rspec import RSpec
 import sys
 import pdb
-from sfa.util.xrn import urn_to_hrn, get_authority
+from sfa.util.xrn import urn_to_hrn, hrn_to_urn, get_authority
+from sfa.util.plxrn import hrn_to_pl_slicename
 from sfa.util.plxrn import hrn_to_pl_slicename
 from sfa.util.rspec import *
 from sfa.util.specdict import *
@@ -147,7 +148,8 @@ def create_slice_max_aggregate(api, hrn, nodes):
     registries = Registries(api)
     registry = registries[api.hrn]
     credential = api.getCredential()
-    records = registry.resolve(credential, hrn)
+    urn = hrn_to_urn(hrn, 'slice')
+    records = registry.Resolve(urn, credential)
     for record in records:
         if record.get_type() in ['slice']:
             slice = record.as_dict()
@@ -164,7 +166,8 @@ def create_slice_max_aggregate(api, hrn, nodes):
         sites = api.plshell.GetSites(api.plauth, [login_base])
         if not sites:
             authority = get_authority(hrn)
-            site_records = registry.resolve(credential, authority)
+            authority_urn = hrn_to_urn(authority, 'authority')
+            site_records = registry.Resolve(authority_urn, credential)
             site_record = {}
             if not site_records:
                 raise RecordNotFound(authority)
@@ -193,7 +196,8 @@ def create_slice_max_aggregate(api, hrn, nodes):
     researchers = record.get('researcher', [])
     for researcher in researchers:
         person_record = {}
-        person_records = registry.resolve(credential, researcher)
+        researcher_urn = hrn_to_urn(researcher, 'user')
+        person_records = registry.Resolve(researcher_urn, credential)
         for record in person_records:
             if record.get_type() in ['user']:
                 person_record = record
index 3835873..28f9198 100644 (file)
@@ -159,7 +159,7 @@ def list(api, xrn, origin_hrn=None):
     records = []    
     if registry_hrn != api.hrn:
         credential = api.getCredential()
-        record_list = registries[registry_hrn].list(credential, xrn, origin_hrn)
+        record_list = registries[registry_hrn].List(xrn, credential)
         records = [SfaRecord(dict=record).as_dict() for record in record_list]
     
     # if we still have not found the record yet, try the local registry
index c76b985..ad2488f 100755 (executable)
@@ -1,8 +1,20 @@
 #!/usr/bin/python
 
 #
-# SFA Certificate Signing and management 
-#   
+# SFA Certificate Signing and management. Root authorities can use this script to sign
+# the certificate of another authority and become its parent.     
+# 
+# Example usage: 
+#
+## sign a peer cert
+# sfa-ca.py --sign PEER_CERT_FILENAME -o OUTPUT_FILENAME 
+#
+## import a cert and update the registry hierarchy
+# sfa-ca.py --import CERT_FILENAME   
+#
+## display a cert
+# sfa-ca.py --display CERT_FILENAME
+
 
 import os
 import sys
@@ -64,6 +76,8 @@ def display(options):
 def sign_gid(gid, parent_key, parent_gid):
     gid.set_issuer(parent_key, parent_gid.get_hrn())
     gid.set_parent(parent_gid)
+    gid.set_intermediate_ca(True)
+    gid.set_pubkey(gid.get_pubkey())
     gid.sign()
     return gid 
 
index eb0d39e..a503e71 100644 (file)
@@ -61,6 +61,7 @@ class Xrn:
     # self.path
     # provide either urn, or (hrn + type)
     def __init__ (self, xrn=None, urn=None, hrn=None, type=None):
+        # user has specified xrn : guess if urn or hrn
         if xrn is not None:
             if xrn.startswith(Xrn.URN_PREFIX):
                 self.urn=xrn
@@ -69,13 +70,16 @@ class Xrn:
                 self.hrn=xrn
                 self.type=type
                 self.hrn_to_urn()
+        # user has specified urn, let's use it
         elif urn is not None: 
             self.urn=urn
             self.urn_to_hrn()
+        # user has specified hrn and type
         elif hrn is not None and type is not None: 
             self.hrn=hrn
             self.type=type
             self.hrn_to_urn()
+        # what should we do ?
         else:
             raise SfaAPIError,"Xrn.__init__"
 # happens all the time ..