The attached patch was altered to change "args" ==> "argv" rather than "argv" ==> "args" since it was discovered that a number of the routines utilized "args" as a local variable that would have to be changed since if the "argv" input parameter were changed to "args". Consequently, this patch converts "args" ==> "argv".

Please review the attached patch which addresses the following issues:

 * dogtagpki Pagure Issue #2713 - Build failure due to Pylint issues
   <https://pagure.io/dogtagpki/issue/2713>

These changes were successfully compiled on a Fedora 27 machine with the following packages:

 * python2-2.7.13-10.fc27.x86_64
 * python3-3.6.1-7.fc27.x86_64
 * pylint-1.7.1-1.fc27.noarch

Additionally, a CA instance was installed and configured, and the following smoke test was run:

 * sudo certutil -d /root/.dogtag/pki-tomcat/ca/alias -L
 * sudo pki -d /root/.dogtag/pki-tomcat/ca/alias -C
   /root/.dogtag/pki-tomcat/ca/password.conf -n "PKI Administrator for
   example.com" -p 8080 ca-user-add testuser --fullName "Test User"
 * sudo certutil -d /root/.dogtag/pki-tomcat/ca/alias -L
 * sudo pki -d /root/.dogtag/pki-tomcat/ca/alias -C
   /root/.dogtag/pki-tomcat/ca/password.conf -n "PKI Administrator for
   example.com" -p 8080 client-cert-request uid=testuser
 * sudo pki -d /root/.dogtag/pki-tomcat/ca/alias -C
   /root/.dogtag/pki-tomcat/ca/password.conf -n "PKI Administrator for
   example.com" -p 8080 ca-cert-request-review 7 --action approve
 * sudo pki -d /root/.dogtag/pki-tomcat/ca/alias -C
   /root/.dogtag/pki-tomcat/ca/password.conf -n "PKI Administrator for
   example.com" -p 8080 ca-user-cert-add testuser --serial 0x7
 * sudo pki -d /root/.dogtag/pki-tomcat/ca/alias -C
   /root/.dogtag/pki-tomcat/ca/password.conf -n "PKI Administrator for
   example.com" -p 8080 client-cert-import testuser --serial 0x7
 * sudo certutil -d /root/.dogtag/pki-tomcat/ca/alias -L

From c04ad1540b09475188f535b2ca3786345ef5426f Mon Sep 17 00:00:00 2001
From: Matthew Harmsen <[email protected]>
Date: Thu, 1 Jun 2017 00:40:06 +0200
Subject: [PATCH] Fixed pylint issues

- https://pagure.io/dogtagpki/issue/2713 - Build failure due to Pylint issues
---
 base/common/python/pki/cli/pkcs12.py           |  4 ++--
 base/common/python/pki/encoder.py              | 12 ++++++------
 base/server/python/pki/server/cli/audit.py     |  8 ++++----
 base/server/python/pki/server/cli/ca.py        | 16 ++++++++--------
 base/server/python/pki/server/cli/db.py        |  8 ++++----
 base/server/python/pki/server/cli/kra.py       | 20 ++++++++++----------
 base/server/python/pki/server/cli/ocsp.py      |  4 ++--
 base/server/python/pki/server/cli/subsystem.py |  4 ++--
 base/server/python/pki/server/cli/tks.py       |  4 ++--
 base/server/python/pki/server/cli/tps.py       | 20 ++++++++++----------
 base/server/python/pki/server/upgrade.py       |  2 +-
 11 files changed, 51 insertions(+), 51 deletions(-)

diff --git a/base/common/python/pki/cli/pkcs12.py b/base/common/python/pki/cli/pkcs12.py
index 8934d33a7..6b99fcfbd 100644
--- a/base/common/python/pki/cli/pkcs12.py
+++ b/base/common/python/pki/cli/pkcs12.py
@@ -62,10 +62,10 @@ class PKCS12ImportCLI(pki.cli.CLI):
         print('      --help                         Show help message.')
         print()
 
-    def execute(self, args):
+    def execute(self, argv):
 
         try:
-            opts, _ = getopt.gnu_getopt(args, 'v', [
+            opts, _ = getopt.gnu_getopt(argv, 'v', [
                 'pkcs12-file=', 'pkcs12-password=', 'pkcs12-password-file=',
                 'no-trust-flags', 'no-user-certs', 'no-ca-certs', 'overwrite',
                 'verbose', 'debug', 'help'])
diff --git a/base/common/python/pki/encoder.py b/base/common/python/pki/encoder.py
index 8485ab883..d3298bc67 100644
--- a/base/common/python/pki/encoder.py
+++ b/base/common/python/pki/encoder.py
@@ -82,14 +82,14 @@ class CustomTypeEncoder(json.JSONEncoder):
     """
     # pylint: disable=E0202
 
-    def default(self, obj):
+    def default(self, o):
         for k, v in iteritems(TYPES):
-            if isinstance(obj, v):
-                return {k: obj.__dict__}
+            if isinstance(o, v):
+                return {k: o.__dict__}
         for t in itervalues(NOTYPES):
-            if isinstance(obj, t):
-                return self.attr_name_conversion(obj.__dict__, type(obj))
-        return json.JSONEncoder.default(self, obj)
+            if isinstance(o, t):
+                return self.attr_name_conversion(o.__dict__, type(o))
+        return json.JSONEncoder.default(self, o)
 
     @staticmethod
     def attr_name_conversion(attr_dict, object_class):
diff --git a/base/server/python/pki/server/cli/audit.py b/base/server/python/pki/server/cli/audit.py
index 0833ca816..a19ca8c65 100644
--- a/base/server/python/pki/server/cli/audit.py
+++ b/base/server/python/pki/server/cli/audit.py
@@ -56,10 +56,10 @@ class AuditFileFindCLI(pki.cli.CLI):
         print('      --help                         Show help message.')
         print()
 
-    def execute(self, args):
+    def execute(self, argv):
 
         try:
-            opts, _ = getopt.gnu_getopt(args, 'i:v', [
+            opts, _ = getopt.gnu_getopt(argv, 'i:v', [
                 'instance=',
                 'verbose', 'help'])
 
@@ -129,10 +129,10 @@ class AuditFileVerifyCLI(pki.cli.CLI):
         print('      --help                         Show help message.')
         print()
 
-    def execute(self, args):
+    def execute(self, argv):
 
         try:
-            opts, _ = getopt.gnu_getopt(args, 'i:v', [
+            opts, _ = getopt.gnu_getopt(argv, 'i:v', [
                 'instance=',
                 'verbose', 'help'])
 
diff --git a/base/server/python/pki/server/cli/ca.py b/base/server/python/pki/server/cli/ca.py
index 550e5110a..48c7dba6c 100644
--- a/base/server/python/pki/server/cli/ca.py
+++ b/base/server/python/pki/server/cli/ca.py
@@ -78,10 +78,10 @@ class CACertChainExportCLI(pki.cli.CLI):
         print('      --help                         Show help message.')
         print()
 
-    def execute(self, args):
+    def execute(self, argv):
 
         try:
-            opts, _ = getopt.gnu_getopt(args, 'i:v', [
+            opts, _ = getopt.gnu_getopt(argv, 'i:v', [
                 'instance=', 'pkcs12-file=', 'pkcs12-password=', 'pkcs12-password-file=',
                 'verbose', 'help'])
 
@@ -190,10 +190,10 @@ class CACertRequestFindCLI(pki.cli.CLI):
         print('      --help                      Show help message.')
         print()
 
-    def execute(self, args):
+    def execute(self, argv):
 
         try:
-            opts, _ = getopt.gnu_getopt(args, 'i:v', [
+            opts, _ = getopt.gnu_getopt(argv, 'i:v', [
                 'instance=', 'cert=', 'cert-file=',
                 'verbose', 'help'])
 
@@ -268,10 +268,10 @@ class CACertRequestShowCLI(pki.cli.CLI):
         print('      --help                      Show help message.')
         print()
 
-    def execute(self, args):
+    def execute(self, argv):
 
         try:
-            opts, args = getopt.gnu_getopt(args, 'i:v', [
+            opts, args = getopt.gnu_getopt(argv, 'i:v', [
                 'instance=', 'output-file=',
                 'verbose', 'help'])
 
@@ -356,10 +356,10 @@ class CAClonePrepareCLI(pki.cli.CLI):
         print('      --help                         Show help message.')
         print()
 
-    def execute(self, args):
+    def execute(self, argv):
 
         try:
-            opts, _ = getopt.gnu_getopt(args, 'i:v', [
+            opts, _ = getopt.gnu_getopt(argv, 'i:v', [
                 'instance=', 'pkcs12-file=', 'pkcs12-password=', 'pkcs12-password-file=',
                 'verbose', 'help'])
 
diff --git a/base/server/python/pki/server/cli/db.py b/base/server/python/pki/server/cli/db.py
index 17b1a2fa1..3df911cd9 100644
--- a/base/server/python/pki/server/cli/db.py
+++ b/base/server/python/pki/server/cli/db.py
@@ -58,10 +58,10 @@ class DBSchemaUpgrade(pki.cli.CLI):
         print('      --help                         Show help message.')
         print()
 
-    def execute(self, args):
+    def execute(self, argv):
         try:
             opts, _ = getopt.gnu_getopt(
-                args, 'i:D:w:v', ['instance=', 'bind-dn=', 'bind-password=',
+                argv, 'i:D:w:v', ['instance=', 'bind-dn=', 'bind-password=',
                                   'verbose', 'help'])
 
         except getopt.GetoptError as e:
@@ -150,10 +150,10 @@ class DBUpgrade(pki.cli.CLI):
         print('      --help                         Show help message.')
         print()
 
-    def execute(self, args):
+    def execute(self, argv):
         try:
             opts, _ = getopt.gnu_getopt(
-                args, 'i:v', ['instance=', 'verbose', 'help'])
+                argv, 'i:v', ['instance=', 'verbose', 'help'])
 
         except getopt.GetoptError as e:
             print('ERROR: ' + str(e))
diff --git a/base/server/python/pki/server/cli/kra.py b/base/server/python/pki/server/cli/kra.py
index 372401465..6c1ade97a 100644
--- a/base/server/python/pki/server/cli/kra.py
+++ b/base/server/python/pki/server/cli/kra.py
@@ -81,10 +81,10 @@ class KRAClonePrepareCLI(pki.cli.CLI):
         print('      --help                         Show help message.')
         print()
 
-    def execute(self, args):
+    def execute(self, argv):
 
         try:
-            opts, _ = getopt.gnu_getopt(args, 'i:v', [
+            opts, _ = getopt.gnu_getopt(argv, 'i:v', [
                 'instance=', 'pkcs12-file=', 'pkcs12-password=', 'pkcs12-password-file=',
                 'verbose', 'help'])
 
@@ -203,10 +203,10 @@ class KRADBVLVFindCLI(pki.cli.CLI):
         print('      --help                         Show help message.')
         print()
 
-    def execute(self, args):
+    def execute(self, argv):
         try:
             opts, _ = getopt.gnu_getopt(
-                args,
+                argv,
                 'i:D:w:x:g:v',
                 ['instance=', 'bind-dn=', 'bind-password=', 'generate-ldif=',
                  'verbose', 'help']
@@ -315,10 +315,10 @@ class KRADBVLVAddCLI(pki.cli.CLI):
         print('      --help                         Show help message.')
         print()
 
-    def execute(self, args):
+    def execute(self, argv):
         try:
             opts, _ = getopt.gnu_getopt(
-                args,
+                argv,
                 'i:D:w:x:g:v',
                 ['instance=', 'bind-dn=', 'bind-password=', 'generate-ldif=',
                  'verbose', 'help']
@@ -421,10 +421,10 @@ class KRADBVLVDeleteCLI(pki.cli.CLI):
         print('      --help                         Show help message.')
         print()
 
-    def execute(self, args):
+    def execute(self, argv):
         try:
             opts, _ = getopt.gnu_getopt(
-                args,
+                argv,
                 'i:D:w:x:g:v',
                 ['instance=', 'bind-dn=', 'bind-password=', 'generate-ldif=',
                  'verbose', 'help']
@@ -543,10 +543,10 @@ class KRADBVLVReindexCLI(pki.cli.CLI):
         print('      --help                         Show help message.')
         print()
 
-    def execute(self, args):
+    def execute(self, argv):
         try:
             opts, _ = getopt.gnu_getopt(
-                args,
+                argv,
                 'i:D:w:x:g:v',
                 ['instance=', 'bind-dn=', 'bind-password=', 'generate-ldif=',
                  'verbose', 'help']
diff --git a/base/server/python/pki/server/cli/ocsp.py b/base/server/python/pki/server/cli/ocsp.py
index 3e9b6aa64..b3e4e45ee 100644
--- a/base/server/python/pki/server/cli/ocsp.py
+++ b/base/server/python/pki/server/cli/ocsp.py
@@ -67,10 +67,10 @@ class OCSPClonePrepareCLI(pki.cli.CLI):
         print('      --help                         Show help message.')
         print()
 
-    def execute(self, args):
+    def execute(self, argv):
 
         try:
-            opts, _ = getopt.gnu_getopt(args, 'i:v', [
+            opts, _ = getopt.gnu_getopt(argv, 'i:v', [
                 'instance=', 'pkcs12-file=', 'pkcs12-password=', 'pkcs12-password-file=',
                 'verbose', 'help'])
 
diff --git a/base/server/python/pki/server/cli/subsystem.py b/base/server/python/pki/server/cli/subsystem.py
index 8395bd2cd..10af8ca6a 100644
--- a/base/server/python/pki/server/cli/subsystem.py
+++ b/base/server/python/pki/server/cli/subsystem.py
@@ -66,10 +66,10 @@ class SubsystemFindCLI(pki.cli.CLI):
         print('      --help                      Show help message.')
         print()
 
-    def execute(self, args):
+    def execute(self, argv):
 
         try:
-            opts, _ = getopt.gnu_getopt(args, 'i:v', [
+            opts, _ = getopt.gnu_getopt(argv, 'i:v', [
                 'instance=',
                 'verbose', 'help'])
 
diff --git a/base/server/python/pki/server/cli/tks.py b/base/server/python/pki/server/cli/tks.py
index 0e6a998f7..0bfaca120 100644
--- a/base/server/python/pki/server/cli/tks.py
+++ b/base/server/python/pki/server/cli/tks.py
@@ -67,10 +67,10 @@ class TKSClonePrepareCLI(pki.cli.CLI):
         print('      --help                         Show help message.')
         print()
 
-    def execute(self, args):
+    def execute(self, argv):
 
         try:
-            opts, _ = getopt.gnu_getopt(args, 'i:v', [
+            opts, _ = getopt.gnu_getopt(argv, 'i:v', [
                 'instance=', 'pkcs12-file=', 'pkcs12-password=', 'pkcs12-password-file=',
                 'verbose', 'help'])
 
diff --git a/base/server/python/pki/server/cli/tps.py b/base/server/python/pki/server/cli/tps.py
index 03df8de96..a34bbd942 100644
--- a/base/server/python/pki/server/cli/tps.py
+++ b/base/server/python/pki/server/cli/tps.py
@@ -76,10 +76,10 @@ class TPSClonePrepareCLI(pki.cli.CLI):
         print('      --help                         Show help message.')
         print()
 
-    def execute(self, args):
+    def execute(self, argv):
 
         try:
-            opts, _ = getopt.gnu_getopt(args, 'i:v', [
+            opts, _ = getopt.gnu_getopt(argv, 'i:v', [
                 'instance=', 'pkcs12-file=', 'pkcs12-password=', 'pkcs12-password-file=',
                 'verbose', 'help'])
 
@@ -195,10 +195,10 @@ class TPSDBVLVFindCLI(pki.cli.CLI):
         print('      --help                         Show help message.')
         print()
 
-    def execute(self, args):
+    def execute(self, argv):
         try:
             opts, _ = getopt.gnu_getopt(
-                args,
+                argv,
                 'i:D:w:x:g:v',
                 ['instance=', 'bind-dn=', 'bind-password=', 'generate-ldif=',
                  'verbose', 'help']
@@ -306,10 +306,10 @@ class TPSDBVLVAddCLI(pki.cli.CLI):
         print('      --help                         Show help message.')
         print()
 
-    def execute(self, args):
+    def execute(self, argv):
         try:
             opts, _ = getopt.gnu_getopt(
-                args,
+                argv,
                 'i:D:w:x:g:v',
                 ['instance=', 'bind-dn=', 'bind-password=', 'generate-ldif=',
                  'verbose', 'help']
@@ -419,10 +419,10 @@ class TPSDBVLVDeleteCLI(pki.cli.CLI):
         print('      --help                         Show help message.')
         print()
 
-    def execute(self, args):
+    def execute(self, argv):
         try:
             opts, _ = getopt.gnu_getopt(
-                args,
+                argv,
                 'i:D:w:x:g:v',
                 ['instance=', 'bind-dn=', 'bind-password=', 'generate-ldif=',
                  'verbose', 'help']
@@ -554,10 +554,10 @@ class TPSDBVLVReindexCLI(pki.cli.CLI):
         print('      --help                         Show help message.')
         print()
 
-    def execute(self, args):
+    def execute(self, argv):
         try:
             opts, _ = getopt.gnu_getopt(
-                args,
+                argv,
                 'i:D:w:x:g:v',
                 ['instance=', 'bind-dn=', 'bind-password=', 'generate-ldif=',
                  'verbose', 'help']
diff --git a/base/server/python/pki/server/upgrade.py b/base/server/python/pki/server/upgrade.py
index 2c72e4864..7b57228e6 100644
--- a/base/server/python/pki/server/upgrade.py
+++ b/base/server/python/pki/server/upgrade.py
@@ -39,7 +39,7 @@ SUBSYSTEM_TRACKER = '%s/CS.cfg'
 class PKIServerUpgradeScriptlet(pki.upgrade.PKIUpgradeScriptlet):
 
     def __init__(self):
-        super(PKIServerUpgradeScriptlet, self).__init__()
+        super().__init__(self)
 
     def get_backup_dir(self):
         return BACKUP_DIR + '/' + str(self.version) + '/' + str(self.index)
-- 
2.13.0

_______________________________________________
Pki-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/pki-devel

Reply via email to