diff options
author | Christian Heimes <cheimes@redhat.com> | 2015-08-11 20:55:48 +0200 |
---|---|---|
committer | Christian Heimes <cheimes@redhat.com> | 2015-08-14 13:03:18 +0200 |
commit | 12badcabc1cd345256a4902f7b0583cf667ecd8d (patch) | |
tree | d0a45d096fab9c0b14d5221557a616824ecfd24a /base/common | |
parent | d63ade55f5cc2a9ecf21ea2b43cfac80149c4c29 (diff) | |
download | pki-12badcabc1cd345256a4902f7b0583cf667ecd8d.tar.gz pki-12badcabc1cd345256a4902f7b0583cf667ecd8d.tar.xz pki-12badcabc1cd345256a4902f7b0583cf667ecd8d.zip |
Make pki PEP 8 compatible
Large portions of the patch was automatically created with autopep8:
find base/ -name '*.py' | xargs autopep8 --in-place --ignore E309 \
--aggressive
find base/common/upgrade base/server/upgrade -type f -and \
-not -name .gitignore | autopep8 --in-place --ignore E309 --aggressive
autopep8 --in-place --ignore E309 --aggressive \
base/common/sbin/pki-upgrade \
base/server/sbin/pkispawn \
base/server/sbin/pkidestroy \
base/server/sbin/pki-server \
base/server/sbin/pki-server-upgrade
About two dozent violations were fixed manually.
https://fedorahosted.org/pki/ticket/708
Diffstat (limited to 'base/common')
-rw-r--r-- | base/common/python/conf.py | 37 | ||||
-rw-r--r-- | base/common/python/pki/__init__.py | 4 | ||||
-rw-r--r-- | base/common/python/pki/cert.py | 60 | ||||
-rw-r--r-- | base/common/python/pki/cli.py | 11 | ||||
-rw-r--r-- | base/common/python/pki/crypto.py | 11 | ||||
-rw-r--r-- | base/common/python/pki/encoder.py | 3 | ||||
-rw-r--r-- | base/common/python/pki/key.py | 42 | ||||
-rw-r--r-- | base/common/python/pki/profile.py | 29 | ||||
-rw-r--r-- | base/common/python/pki/system.py | 9 | ||||
-rw-r--r-- | base/common/python/pki/systemcert.py | 2 | ||||
-rw-r--r-- | base/common/python/pki/upgrade.py | 12 | ||||
-rwxr-xr-x | base/common/sbin/pki-upgrade | 2 |
12 files changed, 126 insertions, 96 deletions
diff --git a/base/common/python/conf.py b/base/common/python/conf.py index 67c59e610..ba29afa41 100644 --- a/base/common/python/conf.py +++ b/base/common/python/conf.py @@ -11,14 +11,15 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys, os +import sys +import os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.abspath('pki')) -# -- General configuration ----------------------------------------------------- +# -- General configuration ----------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' @@ -87,7 +88,7 @@ pygments_style = 'sphinx' #modindex_common_prefix = [] -# -- Options for HTML output --------------------------------------------------- +# -- Options for HTML output --------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. @@ -167,24 +168,24 @@ html_static_path = ['_static'] htmlhelp_basename = 'pythondoc' -# -- Options for LaTeX output -------------------------------------------------- +# -- Options for LaTeX output -------------------------------------------- latex_elements = { -# The paper size ('letterpaper' or 'a4paper'). -#'papersize': 'letterpaper', + # The paper size ('letterpaper' or 'a4paper'). + #'papersize': 'letterpaper', -# The font size ('10pt', '11pt' or '12pt'). -#'pointsize': '10pt', + # The font size ('10pt', '11pt' or '12pt'). + #'pointsize': '10pt', -# Additional stuff for the LaTeX preamble. -#'preamble': '', + # Additional stuff for the LaTeX preamble. + #'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ('index', 'dogtag.tex', u'Dogtag Python Client API', - u'Author', 'manual'), + ('index', 'dogtag.tex', u'Dogtag Python Client API', + u'Author', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of @@ -208,7 +209,7 @@ latex_documents = [ #latex_domain_indices = True -# -- Options for manual page output -------------------------------------------- +# -- Options for manual page output -------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). @@ -221,15 +222,15 @@ man_pages = [ #man_show_urls = False -# -- Options for Texinfo output ------------------------------------------------ +# -- Options for Texinfo output ------------------------------------------ # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ('index', 'Dogtag', u'Dogtag Python Client API', - u'Author', 'Dogtag PKI Team', 'Dogtag is an enterprise software system designed to manage enterprise Public Key Infrastructure (PKI) deployments.', - 'Miscellaneous'), + ('index', 'Dogtag', u'Dogtag Python Client API', + u'Author', 'Dogtag PKI Team', 'Dogtag is an enterprise software system designed to manage enterprise Public Key Infrastructure (PKI) deployments.', + 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. @@ -242,7 +243,7 @@ texinfo_documents = [ #texinfo_show_urls = 'footnote' -# -- Options for Epub output --------------------------------------------------- +# -- Options for Epub output --------------------------------------------- # Bibliographic Dublin Core info. epub_title = u'Dogtag Certificate Server' diff --git a/base/common/python/pki/__init__.py b/base/common/python/pki/__init__.py index 39a0db717..77e5b2365 100644 --- a/base/common/python/pki/__init__.py +++ b/base/common/python/pki/__init__.py @@ -118,7 +118,7 @@ def implementation_version(): raise Exception('Missing implementation version.') -#pylint: disable=R0903 +# pylint: disable=R0903 class Attribute(object): """ Class representing a key/value pair. @@ -132,7 +132,7 @@ class Attribute(object): self.value = value -#pylint: disable=R0903 +# pylint: disable=R0903 class AttributeList(object): """ Class representing a list of attributes. diff --git a/base/common/python/pki/cert.py b/base/common/python/pki/cert.py index 7df9acfd9..575491ffe 100644 --- a/base/common/python/pki/cert.py +++ b/base/common/python/pki/cert.py @@ -335,16 +335,16 @@ class CertSearchRequest(object): setattr(self, 'serialNumberRangeInUse', True) for param, value in cert_search_params.viewitems(): - if not param in CertSearchRequest.search_params: + if param not in CertSearchRequest.search_params: raise ValueError('Invalid search parameter: ' + param) if param in {'serial_to', 'serial_from'}: setattr(self, CertSearchRequest.search_params[param], value) setattr(self, 'serialNumberRangeInUse', True) - if param in {\ - 'email', 'common_name', 'user_id', 'org_unit', 'org',\ - 'locality', 'state', 'country', 'match_exactly'\ + if param in { + 'email', 'common_name', 'user_id', 'org_unit', 'org', + 'locality', 'state', 'country', 'match_exactly' }: setattr(self, CertSearchRequest.search_params[param], value) setattr(self, 'subjectInUse', True) @@ -380,16 +380,16 @@ class CertSearchRequest(object): setattr(self, CertSearchRequest.search_params[param], value) setattr(self, 'validNotAfterInUse', True) - if param in {\ - 'validity_operation', 'validity_count', 'validity_unit'\ + if param in { + 'validity_operation', 'validity_count', 'validity_unit' }: setattr(self, CertSearchRequest.search_params[param], value) setattr(self, 'validityLengthInUse', True) - if param in {\ - 'cert_type_sub_email_ca', 'cert_type_sub_ssl_ca',\ - 'cert_type_secure_email', 'cert_type_ssl_client',\ - 'cert_type_ssl_server'\ + if param in { + 'cert_type_sub_email_ca', 'cert_type_sub_ssl_ca', + 'cert_type_secure_email', 'cert_type_ssl_client', + 'cert_type_ssl_server' }: setattr(self, CertSearchRequest.search_params[param], value) setattr(self, 'certTypeInUse', True) @@ -411,7 +411,8 @@ class CertRevokeRequest(object): 'Certificate_Hold', 'Remove_from_CRL', 'Privilege_Withdrawn', 'AA_Compromise'] - def __init__(self, nonce, reason=None, invalidity_date=None, comments=None): + def __init__(self, nonce, reason=None, invalidity_date=None, + comments=None): """ Constructor """ setattr(self, "Nonce", nonce) @@ -506,7 +507,8 @@ class CertEnrollmentRequest(object): inputs = attr_list['Input'] if not isinstance(inputs, list): - enroll_request.inputs.append(profile.ProfileInput.from_json(inputs)) + enroll_request.inputs.append( + profile.ProfileInput.from_json(inputs)) else: for profile_input in inputs: enroll_request.inputs.append( @@ -585,7 +587,7 @@ class CertReviewResponse(CertEnrollmentRequest): @classmethod def from_json(cls, attr_list): - #First read the values for attributes defined in CertEnrollmentRequest + # First read the values for attributes defined in CertEnrollmentRequest review_response = super(CertReviewResponse, cls).from_json(attr_list) for k, v in attr_list.iteritems(): @@ -634,7 +636,7 @@ class CertClient(object): url = self.cert_url + '/' + str(cert_serial_number) r = self.connection.get(url, self.headers) - #print r.json() + # print r.json() return CertData.from_json(r.json()) @pki.handle_exceptions() @@ -716,7 +718,8 @@ class CertClient(object): This method requires an agent's authentication cert in the connection object. """ - url = self.agent_cert_url + '/' + str(cert_serial_number) + '/revoke-ca' + url = self.agent_cert_url + '/' + str(cert_serial_number) + \ + '/revoke-ca' return self._submit_revoke_request(url, cert_serial_number, revocation_reason, invalidity_date, comments, nonce) @@ -812,7 +815,7 @@ class CertClient(object): review_response = json.dumps(cert_review_response, cls=encoder.CustomTypeEncoder, sort_keys=True) - #print review_response + # print review_response r = self.connection.post(url, review_response, headers=self.headers) return r @@ -823,7 +826,8 @@ class CertClient(object): to fetch the CertReviewResponse object. Requires as agent level authentication. """ - return self._perform_action(request_id, cert_review_response, 'approve') + return self._perform_action( + request_id, cert_review_response, 'approve') def cancel_request(self, request_id, cert_review_response=None): """ @@ -914,8 +918,8 @@ class CertClient(object): return copy.deepcopy(self.enrollment_templates[profile_id]) url = self.cert_requests_url + '/profiles/' + str(profile_id) r = self.connection.get(url, self.headers) - #print r.json() - #Caching the enrollment template object in-memory for future use. + # print r.json() + # Caching the enrollment template object in-memory for future use. enrollment_template = CertEnrollmentRequest.from_json(r.json()) self.enrollment_templates[profile_id] = enrollment_template @@ -951,7 +955,7 @@ class CertClient(object): request_object = json.dumps(enrollment_request, cls=encoder.CustomTypeEncoder, sort_keys=True) - #print request_object + # print request_object r = self.connection.post(self.cert_requests_url, request_object, self.headers) return CertRequestInfoCollection.from_json(r.json()) @@ -1035,12 +1039,12 @@ def main(): # openssl pkcs12 -in <p12_file_path> -out /tmp/auth.pem -nodes connection.set_authentication_cert("/tmp/auth.pem") - #Instantiate the CertClient + # Instantiate the CertClient cert_client = CertClient(connection) cert_client.get_enrollment_template('caUserCert') - #Enrolling an user certificate + # Enrolling an user certificate print 'Enrolling an user certificate' print '-----------------------------' @@ -1130,8 +1134,8 @@ def main(): print "Status: " + cert_data_info.status print - #Trying to get a non-existing cert - #Assuming that there is no certificate with serial number = 100 + # Trying to get a non-existing cert + # Assuming that there is no certificate with serial number = 100 try: cert_data = cert_client.get_cert(100) print 'Serial Number: ' + cert_data.serial_number @@ -1146,7 +1150,7 @@ def main(): # Following examples use the serial number of the user certificate enrolled # before. - #Get certificate data + # Get certificate data print 'Getting information of a certificate' print '------------------------------------' @@ -1176,7 +1180,7 @@ def main(): print 'Nonce: ' + str(cert_data.nonce) print - #Revoke a certificate + # Revoke a certificate print 'Revoking a certificate' print '----------------------' @@ -1187,7 +1191,7 @@ def main(): print 'Request Status: ' + cert_request_info.request_status print - #Un-revoke a certificate + # Un-revoke a certificate print 'Un-revoking a certificate' print '-------------------------' @@ -1199,4 +1203,4 @@ def main(): if __name__ == "__main__": - main()
\ No newline at end of file + main() diff --git a/base/common/python/pki/cli.py b/base/common/python/pki/cli.py index 4379780b2..12b8656e8 100644 --- a/base/common/python/pki/cli.py +++ b/base/common/python/pki/cli.py @@ -99,7 +99,8 @@ class CLI(object): sub_command = None # Search the module by incrementally adding parts into module name. - # Repeat until it finds the module or until there is no more parts to add. + # Repeat until it finds the module or until there is no more parts to + # add. module = None position = 0 @@ -110,7 +111,7 @@ class CLI(object): if i >= 0: # Dash found. Split command into module name and sub command. module_name = command[0:i] - sub_command = command[i+1:] + sub_command = command[i + 1:] else: # Dash not found. Use the whole command. module_name = command @@ -127,7 +128,8 @@ class CLI(object): module = m break - # There is a sub command. It must be processed by module's children. + # There is a sub command. It must be processed by module's + # children. if len(m.modules) > 0: # Module has children. Use this module. module = m @@ -153,7 +155,8 @@ class CLI(object): # Prepare module arguments. if sub_command: - # If module command exists, include it as arguments: <module command> <args>... + # If module command exists, include it as arguments: + # <module command> <args>... module_args = [sub_command] + args[1:] else: diff --git a/base/common/python/pki/crypto.py b/base/common/python/pki/crypto.py index 6a99c13fe..2a33f0638 100644 --- a/base/common/python/pki/crypto.py +++ b/base/common/python/pki/crypto.py @@ -62,7 +62,8 @@ class CryptoProvider(object): pass @abc.abstractmethod - def symmetric_wrap(self, data, wrapping_key, mechanism=None, nonce_iv=None): + def symmetric_wrap(self, data, wrapping_key, mechanism=None, + nonce_iv=None): """ encrypt data using a symmetric key (wrapping key)""" pass @@ -86,7 +87,7 @@ class CryptoProvider(object): """ pass - #abc.abstractmethod + # abc.abstractmethod def get_cert(self, cert_nick): """ Get the certificate for the specified cert_nick. """ pass @@ -101,7 +102,8 @@ class NSSCryptoProvider(CryptoProvider): """ @staticmethod - def setup_database(db_dir, password=None, over_write=False, password_file=None): + def setup_database( + db_dir, password=None, over_write=False, password_file=None): """ Create an NSS database """ if os.path.exists(db_dir): if not over_write: @@ -188,7 +190,8 @@ class NSSCryptoProvider(CryptoProvider): None, slot.get_best_key_length(mechanism)) - # If initialization vector was supplied use it, otherwise set it to None + # If initialization vector was supplied use it, otherwise set it to + # None if nonce_iv: iv_si = nss.SecItem(nonce_iv) iv_param = nss.param_from_iv(mechanism, iv_si) diff --git a/base/common/python/pki/encoder.py b/base/common/python/pki/encoder.py index 84bf32506..6d5725f0f 100644 --- a/base/common/python/pki/encoder.py +++ b/base/common/python/pki/encoder.py @@ -32,6 +32,7 @@ class CustomTypeEncoder(json.JSONEncoder): when-instance-variable-name-is-same-as-method-name """ # pylint: disable=E0202 + def default(self, obj): for k, v in TYPES.iteritems(): if isinstance(obj, v): @@ -56,7 +57,7 @@ class CustomTypeEncoder(json.JSONEncoder): return new_dict -def CustomTypeDecoder(dct): +def CustomTypeDecoder(dct): # nopep8 if len(dct) == 1: type_name, value = dct.items()[0] if type_name in TYPES: diff --git a/base/common/python/pki/key.py b/base/common/python/pki/key.py index f428481f0..0df868657 100644 --- a/base/common/python/pki/key.py +++ b/base/common/python/pki/key.py @@ -32,8 +32,8 @@ import pki import pki.encoder as encoder -#should be moved to request.py -#pylint: disable=R0903 +# should be moved to request.py +# pylint: disable=R0903 class RequestId(object): """ Class representing a Request ID @@ -44,7 +44,7 @@ class RequestId(object): self.value = req_id -#pylint: disable=R0903 +# pylint: disable=R0903 class KeyData(object): """ This is the object that contains the encoded wrapped secret @@ -85,7 +85,8 @@ class Key(object): def __init__(self, key_data): """ Constructor """ - self.encrypted_data = base64.decodestring(key_data.wrapped_private_data) + self.encrypted_data = base64.decodestring( + key_data.wrapped_private_data) self.nonce_data = base64.decodestring(key_data.nonce_data) self.algorithm = key_data.algorithm self.size = key_data.size @@ -139,7 +140,7 @@ class KeyInfo(object): return None -#pylint: disable=R0903 +# pylint: disable=R0903 class KeyInfoCollection(object): """ This class represents data returned when searching the DRM archived @@ -211,7 +212,7 @@ class KeyRequestInfo(object): return None -#pylint: disable=R0903 +# pylint: disable=R0903 class KeyRequestInfoCollection(object): """ This class represents the data returned when searching the key @@ -419,7 +420,7 @@ class KeyClient(object): RSA_ALGORITHM = "RSA" DSA_ALGORITHM = "DSA" - #default session key wrapping algorithm + # default session key wrapping algorithm DES_EDE3_CBC_OID = "{1 2 840 113549 3 7}" def __init__(self, connection, crypto, transport_cert_nick=None): @@ -440,7 +441,8 @@ class KeyClient(object): def set_transport_cert(self, transport_cert_nick): """ Set the transport certificate for crypto operations """ if transport_cert_nick is None: - raise TypeError("Transport certificate nickname must be specified.") + raise TypeError( + "Transport certificate nickname must be specified.") self.transport_cert = self.crypto.get_cert(transport_cert_nick) @pki.handle_exceptions() @@ -626,7 +628,7 @@ class KeyClient(object): if algorithm == self.RSA_ALGORITHM: if key_size < 256: raise ValueError("Invalid key size specified.") - if ((key_size-256) % 16) != 0: + if ((key_size - 256) % 16) != 0: raise ValueError("Invalid key size specified.") if algorithm == self.DSA_ALGORITHM: if key_size not in [512, 768, 1024]: @@ -686,7 +688,9 @@ class KeyClient(object): nonce_iv = self.crypto.generate_nonce_iv() session_key = self.crypto.generate_session_key() - wrapped_session_key = self.crypto.asymmetric_wrap(session_key, self.transport_cert) + wrapped_session_key = self.crypto.asymmetric_wrap( + session_key, + self.transport_cert) encrypted_data = self.crypto.symmetric_wrap( private_data, @@ -704,15 +708,15 @@ class KeyClient(object): key_size=key_size) @pki.handle_exceptions() - def archive_encrypted_data(self,\ - client_key_id,\ - data_type,\ - encrypted_data,\ - wrapped_session_key,\ - algorithm_oid=None,\ - nonce_iv=None,\ - key_algorithm=None,\ - key_size=None): + def archive_encrypted_data(self, + client_key_id, + data_type, + encrypted_data, + wrapped_session_key, + algorithm_oid=None, + nonce_iv=None, + key_algorithm=None, + key_size=None): """ Archive a secret (symmetric key or passphrase) on the DRM. diff --git a/base/common/python/pki/profile.py b/base/common/python/pki/profile.py index 81e2a6c90..00318d0f2 100644 --- a/base/common/python/pki/profile.py +++ b/base/common/python/pki/profile.py @@ -161,7 +161,8 @@ class ProfileAttribute(object): if 'Value' in attr_list: attribute.value = attr_list['Value'] if 'Descriptor' in attr_list: - attribute.descriptor = Descriptor.from_json(attr_list['Descriptor']) + attribute.descriptor = Descriptor.from_json( + attr_list['Descriptor']) return attribute @@ -501,6 +502,7 @@ class PolicyConstraintValue(object): """ Represents a PolicyConstraintValue """ + def __init__(self, name=None, value=None, descriptor=None): self.name = name self.value = value @@ -783,7 +785,8 @@ class PolicySetList(object): policy_set_list = cls() policy_sets = attr_list['PolicySet'] if not isinstance(policy_sets, list): - policy_set_list.policy_sets.append(PolicySet.from_json(policy_sets)) + policy_set_list.policy_sets.append( + PolicySet.from_json(policy_sets)) else: for policy_set in policy_sets: policy_set_list.policy_sets.append( @@ -1157,7 +1160,7 @@ def main(): # openssl pkcs12 -in <p12_file_path> -out /tmp/auth.pem -nodes connection.set_authentication_cert("/tmp/auth.pem") - #Initialize the ProfileClient class + # Initialize the ProfileClient class profile_client = ProfileClient(connection) # Folder to store the files generated during test @@ -1165,7 +1168,7 @@ def main(): if not os.path.exists(file_path): os.makedirs(file_path) - #Fetching a list of profiles + # Fetching a list of profiles profile_data_infos = profile_client.list_profiles() print 'List of profiles:' print '-----------------' @@ -1203,7 +1206,7 @@ def main(): print ' Profile ID: ' + profile_data.profile_id print ' Is profile enabled? ' + str(profile.enabled) print - #profile_client.delete_profile('MySampleProfile') + # profile_client.delete_profile('MySampleProfile') # Create a new sample profile print 'Creating a new profile:' print '-----------------------' @@ -1271,7 +1274,9 @@ def main(): "Validity to the request. The default " "values are Range=180 in days") attr_descriptor = Descriptor(syntax="string", description="Not Before") - policy_attribute = ProfileAttribute("notBefore", descriptor=attr_descriptor) + policy_attribute = ProfileAttribute( + "notBefore", + descriptor=attr_descriptor) policy_default.add_attribute(policy_attribute) attr_descriptor = Descriptor(syntax="string", description="Not After") @@ -1283,7 +1288,7 @@ def main(): policy_default.add_parameter(profile_param) policy_default.add_parameter(profile_param2) - #Defining the policy constraint + # Defining the policy constraint policy_constraint = PolicyConstraint("Validity Constraint", "This constraint rejects the validity " "that is not between 365 days.", @@ -1316,7 +1321,7 @@ def main(): profile_data.add_policy_set(policy_set) # Write the profile data object to a file for testing a file input - with open(file_path+'/original.json', 'w') as output_file: + with open(file_path + '/original.json', 'w') as output_file: output_file.write(json.dumps(profile_data, cls=encoder.CustomTypeEncoder, sort_keys=True, indent=4)) @@ -1368,7 +1373,7 @@ def main(): fetch.name += " (Modified)" modified_profile = profile_client.modify_profile(fetch) - with open(file_path+'modified.json', 'w') as output_file: + with open(file_path + 'modified.json', 'w') as output_file: output_file.write(json.dumps(fetch, cls=encoder.CustomTypeEncoder, sort_keys=True, indent=4)) @@ -1410,10 +1415,10 @@ def main(): # Test clean up profile_client.delete_profile('MySampleProfile') - os.remove(file_path+'original.json') - os.remove(file_path+'modified.json') + os.remove(file_path + 'original.json') + os.remove(file_path + 'modified.json') os.removedirs(file_path) if __name__ == "__main__": - main()
\ No newline at end of file + main() diff --git a/base/common/python/pki/system.py b/base/common/python/pki/system.py index 76b505909..b3d5fc641 100644 --- a/base/common/python/pki/system.py +++ b/base/common/python/pki/system.py @@ -112,7 +112,7 @@ class SecurityDomainSubsystem(object): hosts = json_value['Host'] if isinstance(hosts, dict): - hosts = [ hosts ] + hosts = [hosts] for h in hosts: host = SecurityDomainHost.from_json(h) @@ -155,7 +155,7 @@ class SecurityDomainInfo(object): subsystems = domain_info['Subsystem'] if isinstance(subsystems, dict): - subsystems = [ subsystems ] + subsystems = [subsystems] for s in subsystems: subsystem = SecurityDomainSubsystem.from_json(s) @@ -211,6 +211,7 @@ class ConfigurationRequest(object): This class is the python equivalent of the Java class: com.netscape.certsrv.system.ConfigurationRequest """ + def __init__(self): self.token = "Internal Key Storage Token" self.isClone = "false" @@ -227,6 +228,7 @@ class ConfigurationResponse(object): This class is the python equivalent of the Java class: com.netscape.certsrv.system.ConfigurationRequest """ + def __init__(self): pass @@ -240,6 +242,7 @@ class SystemCertData(object): This class is the python equivalent of the Java class: com.netscape.certsrv.system.SystemCertData """ + def __init__(self): pass @@ -252,6 +255,7 @@ class SystemConfigClient(object): The connection details for the system being configured are passed in the PKIConnection object used when constructing this object. """ + def __init__(self, connection): self.connection = connection @@ -276,6 +280,7 @@ class SystemStatusClient(object): """ Client used to check the status of a Dogtag subsystem. """ + def __init__(self, connection): self.connection = connection diff --git a/base/common/python/pki/systemcert.py b/base/common/python/pki/systemcert.py index d59e07b3d..b5f7b03b8 100644 --- a/base/common/python/pki/systemcert.py +++ b/base/common/python/pki/systemcert.py @@ -35,7 +35,7 @@ class SystemCertClient(object): def __init__(self, connection): """ Constructor """ - #super(PKIResource, self).__init__(connection) + # super(PKIResource, self).__init__(connection) self.connection = connection self.headers = {'Content-type': 'application/json', 'Accept': 'application/json'} diff --git a/base/common/python/pki/upgrade.py b/base/common/python/pki/upgrade.py index 30911613a..010f88c81 100644 --- a/base/common/python/pki/upgrade.py +++ b/base/common/python/pki/upgrade.py @@ -283,7 +283,7 @@ class PKIUpgradeScriptlet(object): backup_dir = self.get_backup_dir() if os.path.exists(backup_dir): - # remove old backup dir + # remove old backup dir shutil.rmtree(backup_dir) # create backup dir @@ -334,7 +334,7 @@ class PKIUpgradeScriptlet(object): # restore all backed up files for sourcepath, _, filenames in os.walk(oldfiles): - #unused item _ for dirnames + # unused item _ for dirnames destpath = sourcepath[len(oldfiles):] if destpath == '': @@ -525,7 +525,9 @@ class PKIUpgrader(object): try: i = filename.index('-') except ValueError as e: - raise pki.PKIException('Invalid scriptlet name: ' + filename, e) + raise pki.PKIException( + 'Invalid scriptlet name: ' + filename, + e) index = int(filename[0:i]) classname = filename[i + 1:] @@ -622,7 +624,7 @@ class PKIUpgrader(object): except pki.PKIException: raise - except Exception as e: # pylint: disable=W0703 + except Exception as e: # pylint: disable=W0703 print @@ -689,7 +691,7 @@ class PKIUpgrader(object): except pki.PKIException: raise - except Exception as e: # pylint: disable=W0703 + except Exception as e: # pylint: disable=W0703 print diff --git a/base/common/sbin/pki-upgrade b/base/common/sbin/pki-upgrade index 0fbfde3d6..48b7c826b 100755 --- a/base/common/sbin/pki-upgrade +++ b/base/common/sbin/pki-upgrade @@ -27,6 +27,8 @@ import pki import pki.upgrade # pylint: disable=W0613 + + def interrupt_handler(event, frame): print print |