merge
authorTony Mack <tmack@paris.CS.Princeton.EDU>
Thu, 18 Oct 2012 21:06:36 +0000 (17:06 -0400)
committerTony Mack <tmack@paris.CS.Princeton.EDU>
Thu, 18 Oct 2012 21:06:36 +0000 (17:06 -0400)
clientbin/sfadump.py
sfa/methods/Delete.py
sfa/methods/Provision.py
sfa/methods/Shutdown.py
sfa/methods/Status.py
sfa/openstack/osaggregate.py
sfa/planetlab/plaggregate.py
sfa/trust/auth.py

index 59dd38c..b366aec 100755 (executable)
@@ -13,7 +13,7 @@ from sfa.trust.certificate import Certificate
 from sfa.trust.credential import Credential
 from sfa.trust.gid import GID
 
-from sfa.storage.record import SfaRecord
+from sfa.storage.record import Record
 
 def determine_sfa_filekind(fn):
 
index 9ed6e98..74ff838 100644 (file)
@@ -16,7 +16,7 @@ class Delete(Method):
     interfaces = ['aggregate', 'slicemgr', 'component']
     
     accepts = [
-        Parameter([str], "Human readable name of slice to delete (hrn or urn)"),
+        Parameter(type([str]), "Human readable name of slice to delete (hrn or urn)"),
         Parameter(dict, "Credentials"),
         Parameter(dict, "options"),
         ]
index 6051093..21ab93d 100644 (file)
@@ -22,7 +22,7 @@ class Provision(Method):
     """
     interfaces = ['aggregate', 'slicemgr']
     accepts = [
-        Parameter([str], "URNs"),
+        Parameter(type([str]), "URNs"),
         Parameter(dict, "Credentials"),
         Parameter(dict, "options"),
         ]
index d288036..e532d1d 100644 (file)
@@ -13,7 +13,7 @@ class Shutdown(Method):
     interfaces = ['aggregate', 'slicemgr']
     accepts = [
         Parameter(str, "Slice URN"),
-        Parameter(type(dict), "Credentials"),
+        Parameter(dict, "Credentials"),
         ]
     returns = Parameter(bool, "Success or Failure")
 
index 951871d..83aa023 100644 (file)
@@ -12,8 +12,8 @@ class Status(Method):
     """
     interfaces = ['aggregate', 'slicemgr', 'component']
     accepts = [
-        Parameter([str], "Slice or sliver URNs"),
-        Parameter(dict), "credentials")),
+        Parameter(type([str]), "Slice or sliver URNs"),
+        Parameter(dict, "credentials"),
         Parameter(dict, "Options")
         ]
     returns = Parameter(dict, "Status details")
index 3738a6b..d4eba12 100644 (file)
@@ -122,7 +122,7 @@ class OSAggregate:
 
         # filter on id
         if ids:
-            instances = [server in servers if server.id in ids]
+            instances = [server for server in servers if server.id in ids]
 
         return instances
 
index 5da1693..ece53ba 100644 (file)
@@ -147,7 +147,7 @@ class PlAggregate:
         # only doing this because protogeni rspec needs
         # to advertise available initscripts
         rspec_node['pl_initscripts'] = pl_initscripts.values()
-         # add site/interface info to nodes.
+        # add site/interface info to nodes.
         # assumes that sites, interfaces and tags have already been prepared.
         if site['longitude'] and site['latitude']:
             location = Location({'longitude': site['longitude'], 'latitude': site['latitude'], 'country': 'unknown'})
@@ -372,7 +372,13 @@ class PlAggregate:
             rspec.version.add_leases(leases)
 
                
+<<<<<<< HEAD:sfa/planetlab/plaggregate.py
         return {'geni_urn': urns[0], 
                 'geni_rspec': rspec.toxml(),
                 'geni_slivers': geni_slivers}
+=======
+        return  {'geni_urn': urns[0],
+                 'geni_rspec': rspec.toxml(),
+                 'geni_slivers': geni_slivers}
+>>>>>>> 3acb26e0ac5bc5de68effe62d0878ba674e40369:sfa/planetlab/plaggregate.py
 
index b88a472..5d48a94 100644 (file)
@@ -35,7 +35,6 @@ class Auth:
         self.trusted_cert_file_list = TrustedRoots(self.config.get_trustedroots_dir()).get_file_list()
 
         
-        
     def checkCredentials(self, creds, operation, xrns=[]):
         if not isinstance(xrns, list):
             xrns = [xrns]
@@ -43,7 +42,10 @@ class Auth:
         valid = []
         if not isinstance(creds, list):
             creds = [creds]
-        logger.debug("Auth.checkCredentials with %d creds"%len(creds))
+        logger.debug("Auth.checkCredentials with %d creds on hrns=%s"%(len(creds),hrns))
+        # won't work if either creds or hrns is empty - let's make it more explicit
+        if not creds: raise InsufficientRights("Access denied - no credential provided")
+        if not hrns: raise InsufficientRights("Access denied - no subject xrn provided")
         for cred in creds:
             for hrn in hrns:
                 try:
@@ -70,6 +72,8 @@ class Auth:
         the specified operation.    
         """
         self.client_cred = Credential(string = cred)
+        logger.debug("Auth.check: handling hrn=%s and credential=%s"%\
+                         (hrn,cred.get_summary_tostring()))
         self.client_gid = self.client_cred.get_gid_caller()
         self.object_gid = self.client_cred.get_gid_object()