From: Thierry Parmentelat Date: Thu, 9 Feb 2017 15:27:56 +0000 (+0100) Subject: cosmetic & rename str into string X-Git-Tag: sfa-3.1-22~10^2~1 X-Git-Url: http://git.onelab.eu/?p=sfa.git;a=commitdiff_plain;h=8cbccf66e8c89243e1d55c0e71841cebb6c98006 cosmetic & rename str into string --- diff --git a/sfa/client/sfaadmin.py b/sfa/client/sfaadmin.py index 261218e1..a6d5a07c 100755 --- a/sfa/client/sfaadmin.py +++ b/sfa/client/sfaadmin.py @@ -54,6 +54,7 @@ class RegistryCommands(Commands): version = self.api.manager.GetVersion(self.api, {}) pprinter.pprint(version) + @add_options('-x', '--xrn', dest='xrn', metavar='', help='authority to list (hrn/urn - mandatory)') @add_options('-t', '--type', dest='type', metavar='', help='object type', default='all') @add_options('-r', '--recursive', dest='recursive', metavar='', 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='', help='object hrn/urn (mandatory)') @add_options('-t', '--type', dest='type', metavar='', help='object type', default=None) @add_options('-o', '--outfile', dest='outfile', metavar='', 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='', help='object hrn/urn', default=None) @add_options('-t', '--type', dest='type', metavar='', help='object type (mandatory)') @add_options('-a', '--all', dest='all', metavar='', 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='', help='object hrn/urn (mandatory)') @add_options('-t', '--type', dest='type', metavar='', 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='', help='object hrn/urn (mandatory)') @add_options('-t', '--type', dest='type', metavar='', help='object type', default=None) @add_options('-u', '--url', dest='url', metavar='', 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='', help='object hrn/urn (mandatory)') @add_options('-t', '--type', dest='type', metavar='', 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='', help='object hrn/urn (mandatory)') @add_options('-t', '--type', dest='type', metavar='', 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='', 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='', action='store_true', default=False, diff --git a/sfa/trust/certificate.py b/sfa/trust/certificate.py index 960a387d..ac643669 100644 --- a/sfa/trust/certificate.py +++ b/sfa/trust/certificate.py @@ -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 diff --git a/sfa/trust/gid.py b/sfa/trust/gid.py index 5d7ce578..7222b181 100644 --- a/sfa/trust/gid.py +++ b/sfa/trust/gid.py @@ -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