cosmetic & rename str into string
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Thu, 9 Feb 2017 15:27:56 +0000 (16:27 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Thu, 9 Feb 2017 15:27:56 +0000 (16:27 +0100)
sfa/client/sfaadmin.py
sfa/trust/certificate.py
sfa/trust/gid.py

index 261218e..a6d5a07 100755 (executable)
@@ -54,6 +54,7 @@ class RegistryCommands(Commands):
         version = self.api.manager.GetVersion(self.api, {})
         pprinter.pprint(version)
 
+        
     @add_options('-x', '--xrn', dest='xrn', metavar='<xrn>', help='authority to list (hrn/urn - mandatory)')
     @add_options('-t', '--type', dest='type', metavar='<type>', help='object type', default='all')
     @add_options('-r', '--recursive', dest='recursive', metavar='<recursive>', help='list all child records',
@@ -74,6 +75,7 @@ class RegistryCommands(Commands):
         options.verbose = verbose
         terminal_render(list, options)
 
+
     @add_options('-x', '--xrn', dest='xrn', metavar='<xrn>', help='object hrn/urn (mandatory)')
     @add_options('-t', '--type', dest='type', metavar='<type>', help='object type', default=None)
     @add_options('-o', '--outfile', dest='outfile', metavar='<outfile>', help='save record to file')
@@ -122,6 +124,7 @@ class RegistryCommands(Commands):
             record_dict.update(extras)
         return record_dict
 
+
     @add_options('-x', '--xrn', dest='xrn', metavar='<xrn>', help='object hrn/urn', default=None)
     @add_options('-t', '--type', dest='type', metavar='<type>', help='object type (mandatory)')
     @add_options('-a', '--all', dest='all', metavar='<all>', action='store_true', default=False, help='check all users GID')
@@ -187,6 +190,7 @@ Users having a non RSA PubKey: %s and are: \n%s\n\n\
 Users having a GID/PubKey correpondence OK: %s and are: \n%s\n\n\
 Users having a GID/PubKey correpondence NOT OK: %s and are: \n%s\n\n" % (len(NOKEY), NOKEY, len(ERROR), ERROR, len(OK), OK, len(NOK), NOK))
 
+
     @add_options('-x', '--xrn', dest='xrn', metavar='<xrn>', help='object hrn/urn (mandatory)')
     @add_options('-t', '--type', dest='type', metavar='<type>', help='object type', default=None)
     @add_options('-e', '--email', dest='email', default="",
@@ -216,6 +220,7 @@ Users having a GID/PubKey correpondence NOT OK: %s and are: \n%s\n\n" % (len(NOK
                                         url=url, description=description, extras=extras)
         self.api.manager.Register(self.api, record_dict)
 
+        
     @add_options('-x', '--xrn', dest='xrn', metavar='<xrn>', help='object hrn/urn (mandatory)')
     @add_options('-t', '--type', dest='type', metavar='<type>', help='object type', default=None)
     @add_options('-u', '--url', dest='url', metavar='<url>', help='URL', default=None)
@@ -242,6 +247,7 @@ Users having a GID/PubKey correpondence NOT OK: %s and are: \n%s\n\n" % (len(NOK
                                         url=url, description=description, extras=extras)
         self.api.manager.Update(self.api, record_dict)
 
+
     @add_options('-x', '--xrn', dest='xrn', metavar='<xrn>', help='object hrn/urn (mandatory)')
     @add_options('-t', '--type', dest='type', metavar='<type>', help='object type', default=None)
     def remove(self, xrn, type=None):
@@ -249,6 +255,7 @@ Users having a GID/PubKey correpondence NOT OK: %s and are: \n%s\n\n" % (len(NOK
         xrn = Xrn(xrn, type)
         self.api.manager.Remove(self.api, xrn)
 
+
     @add_options('-x', '--xrn', dest='xrn', metavar='<xrn>', help='object hrn/urn (mandatory)')
     @add_options('-t', '--type', dest='type', metavar='<type>', help='object type', default=None)
     def credential(self, xrn, type=None):
@@ -257,18 +264,21 @@ Users having a GID/PubKey correpondence NOT OK: %s and are: \n%s\n\n" % (len(NOK
             self.api, xrn, type, self.api.hrn)
         print(cred)
 
+
     def import_registry(self):
         """Run the importer"""
         from sfa.importer import Importer
         importer = Importer()
         importer.run()
 
+
     def sync_db(self):
         """Initialize or upgrade the db"""
         from sfa.storage.dbschema import DBSchema
         dbschema = DBSchema()
         dbschema.init_or_upgrade()
 
+
     @add_options('-a', '--all', dest='all', metavar='<all>', action='store_true', default=False,
                  help='Remove all registry records and all files in %s area' % help_basedir)
     @add_options('-c', '--certs', dest='certs', metavar='<certs>', action='store_true', default=False,
index 960a387..ac64366 100644 (file)
@@ -693,13 +693,13 @@ class Certificate:
     # the X509 subject_alt_name extension. Set_data can only be called once, due
     # to limitations in the underlying library.
 
-    def set_data(self, str, field='subjectAltName'):
+    def set_data(self, string, field='subjectAltName'):
         # pyOpenSSL only allows us to add extensions, so if we try to set the
         # same extension more than once, it will not work
         if field in self.data:
             raise Exception("Cannot set {} more than once".format(field))
-        self.data[field] = str
-        self.add_extension(field, 0, str)
+        self.data[field] = string
+        self.add_extension(field, 0, string)
 
     ##
     # Return the data string that was previously set with set_data
index 5d7ce57..7222b18 100644 (file)
@@ -156,15 +156,15 @@ class GID(Certificate):
         else:
             urn = hrn_to_urn(self.hrn, None)
 
-        str = "URI:" + urn
+        string = "URI:" + urn
 
         if self.uuid:
-            str += ", " + "URI:" + uuid.UUID(int=self.uuid).urn
+            string += ", " + "URI:" + uuid.UUID(int=self.uuid).urn
 
         if self.email:
-            str += ", " + "email:" + self.email
+            string += ", " + "email:" + self.email
 
-        self.set_data(str, 'subjectAltName')
+        self.set_data(string, 'subjectAltName')
 
     ##
     # Decode the subject-alt-name field of the X509 certificate into the