From f5044bb484d61a569ba7da252f88d9c87378fcc0 Mon Sep 17 00:00:00 2001
From: Matthew Harmsen <mharmsen@redhat.com>
Date: Wed, 31 May 2017 22:29:24 +0200
Subject: [PATCH] Fixed pylint issues

- https://pagure.io/dogtagpki/issue/2713 - Build failure due to Pylint issues
---
 base/common/python/pki/cli/__init__.py         |  6 ++--
 base/common/python/pki/cli/main.py             |  4 +--
 base/common/python/pki/encoder.py              | 12 ++++----
 base/server/python/pki/server/cli/instance.py  | 40 +++++++++++++-------------
 base/server/python/pki/server/cli/migrate.py   |  4 +--
 base/server/python/pki/server/cli/nuxwdog.py   |  8 +++---
 base/server/python/pki/server/cli/subsystem.py | 32 ++++++++++-----------
 base/server/python/pki/server/upgrade.py       |  2 +-
 base/server/sbin/pki-server                    |  4 +--
 9 files changed, 56 insertions(+), 56 deletions(-)

diff --git a/base/common/python/pki/cli/__init__.py b/base/common/python/pki/cli/__init__.py
index 2bed317c9..ac141ebf7 100644
--- a/base/common/python/pki/cli/__init__.py
+++ b/base/common/python/pki/cli/__init__.py
@@ -171,10 +171,10 @@ class CLI(object):
 
         return (module, module_args)
 
-    def execute(self, argv):
+    def execute(self, args):
 
         try:
-            opts, args = getopt.getopt(argv, 'v', [
+            opts, args = getopt.getopt(args, 'v', [
                 'verbose', 'help'])
 
         except getopt.GetoptError as e:
@@ -199,6 +199,6 @@ class CLI(object):
                 self.print_help()
                 sys.exit(1)
 
-        (module, module_args) = self.parse_args(argv)
+        (module, module_args) = self.parse_args(args)
 
         module.execute(module_args)
diff --git a/base/common/python/pki/cli/main.py b/base/common/python/pki/cli/main.py
index f201c1d70..96101b4ff 100644
--- a/base/common/python/pki/cli/main.py
+++ b/base/common/python/pki/cli/main.py
@@ -110,12 +110,12 @@ class PKICLI(pki.cli.CLI):
 
         subprocess.check_call(cmd, stdout=stdout)
 
-    def execute(self, argv):
+    def execute(self, args):
 
         # append global options
         value = os.getenv('PKI_CLI_OPTIONS')
         args = shlex.split(value)
-        args.extend(argv[1:])
+        args.extend(args[1:])
 
         client_type = 'java'
 
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/instance.py b/base/server/python/pki/server/cli/instance.py
index b69519d57..3acdfe74a 100644
--- a/base/server/python/pki/server/cli/instance.py
+++ b/base/server/python/pki/server/cli/instance.py
@@ -85,10 +85,10 @@ class InstanceCertExportCLI(pki.cli.CLI):
         print('      --help                         Show help message.')
         print()
 
-    def execute(self, argv):
+    def execute(self, args):
 
         try:
-            opts, args = getopt.gnu_getopt(argv, 'i:v', [
+            opts, args = getopt.gnu_getopt(args, 'i:v', [
                 'instance=',
                 'pkcs12-file=', 'pkcs12-password=', 'pkcs12-password-file=',
                 'append', 'no-trust-flags', 'no-key', 'no-chain',
@@ -195,10 +195,10 @@ class InstanceFindCLI(pki.cli.CLI):
         print('      --help                   Show help message.')
         print()
 
-    def execute(self, argv):
+    def execute(self, args):
 
         try:
-            opts, _ = getopt.gnu_getopt(argv, 'i:v', [
+            opts, _ = getopt.gnu_getopt(args, 'i:v', [
                 'verbose', 'help'])
 
         except getopt.GetoptError as e:
@@ -255,10 +255,10 @@ class InstanceShowCLI(pki.cli.CLI):
         print('      --help                   Show help message.')
         print()
 
-    def execute(self, argv):
+    def execute(self, args):
 
         try:
-            opts, args = getopt.gnu_getopt(argv, 'i:v', [
+            opts, args = getopt.gnu_getopt(args, 'i:v', [
                 'verbose', 'help'])
 
         except getopt.GetoptError as e:
@@ -309,10 +309,10 @@ class InstanceStartCLI(pki.cli.CLI):
         print('      --help                   Show help message.')
         print()
 
-    def execute(self, argv):
+    def execute(self, args):
 
         try:
-            opts, args = getopt.gnu_getopt(argv, 'i:v', [
+            opts, args = getopt.gnu_getopt(args, 'i:v', [
                 'verbose', 'help'])
 
         except getopt.GetoptError as e:
@@ -368,10 +368,10 @@ class InstanceStopCLI(pki.cli.CLI):
         print('      --help                   Show help message.')
         print()
 
-    def execute(self, argv):
+    def execute(self, args):
 
         try:
-            opts, args = getopt.gnu_getopt(argv, 'i:v', [
+            opts, args = getopt.gnu_getopt(args, 'i:v', [
                 'verbose', 'help'])
 
         except getopt.GetoptError as e:
@@ -429,10 +429,10 @@ class InstanceMigrateCLI(pki.cli.CLI):
         print('      --help                   Show help message.')
         print()
 
-    def execute(self, argv):
+    def execute(self, args):
 
         try:
-            opts, args = getopt.gnu_getopt(argv, 'i:v', [
+            opts, args = getopt.gnu_getopt(args, 'i:v', [
                 'tomcat=', 'verbose', 'debug', 'help'])
 
         except getopt.GetoptError as e:
@@ -508,9 +508,9 @@ class InstanceNuxwdogEnableCLI(pki.cli.CLI):
         print('      --help                   Show help message.')
         print()
 
-    def execute(self, argv):
+    def execute(self, args):
         try:
-            opts, args = getopt.gnu_getopt(argv, 'i:v', [
+            opts, args = getopt.gnu_getopt(args, 'i:v', [
                 'verbose', 'help'])
 
         except getopt.GetoptError as e:
@@ -567,9 +567,9 @@ class InstanceNuxwdogDisableCLI(pki.cli.CLI):
         print('      --help                   Show help message.')
         print()
 
-    def execute(self, argv):
+    def execute(self, args):
         try:
-            opts, args = getopt.gnu_getopt(argv, 'i:v', [
+            opts, args = getopt.gnu_getopt(args, 'i:v', [
                 'verbose', 'help'])
 
         except getopt.GetoptError as e:
@@ -631,9 +631,9 @@ class InstanceExternalCertAddCLI(pki.cli.CLI):
         print('      --help                         Show help message.')
         print()
 
-    def execute(self, argv):
+    def execute(self, args):
         try:
-            opts, _ = getopt.gnu_getopt(argv, 'i:v', [
+            opts, _ = getopt.gnu_getopt(args, 'i:v', [
                 'instance=',
                 'cert-file=', 'trust-args=', 'nickname=','token=',
                 'verbose', 'help'])
@@ -739,9 +739,9 @@ class InstanceExternalCertDeleteCLI(pki.cli.CLI):
         print('      --help                         Show help message.')
         print()
 
-    def execute(self, argv):
+    def execute(self, args):
         try:
-            opts, _ = getopt.gnu_getopt(argv, 'i:v', [
+            opts, _ = getopt.gnu_getopt(args, 'i:v', [
                 'instance=', 'nickname=','token=',
                 'verbose', 'help'])
 
diff --git a/base/server/python/pki/server/cli/migrate.py b/base/server/python/pki/server/cli/migrate.py
index 9c5c0c6f4..a492f2066 100644
--- a/base/server/python/pki/server/cli/migrate.py
+++ b/base/server/python/pki/server/cli/migrate.py
@@ -46,9 +46,9 @@ class MigrateCLI(pki.cli.CLI):
         print('      --help                   Show help message.')
         print()
 
-    def execute(self, argv):
+    def execute(self, args):
         try:
-            opts, _ = getopt.gnu_getopt(argv, 'i:v', [
+            opts, _ = getopt.gnu_getopt(args, 'i:v', [
                 'tomcat=', 'verbose', 'debug', 'help'])
 
         except getopt.GetoptError as e:
diff --git a/base/server/python/pki/server/cli/nuxwdog.py b/base/server/python/pki/server/cli/nuxwdog.py
index afbd438ff..59c02a9e4 100644
--- a/base/server/python/pki/server/cli/nuxwdog.py
+++ b/base/server/python/pki/server/cli/nuxwdog.py
@@ -65,9 +65,9 @@ class NuxwdogEnableCLI(pki.cli.CLI):
         print('      --help                   Show help message.')
         print()
 
-    def execute(self, argv):
+    def execute(self, args):
         try:
-            opts, _ = getopt.gnu_getopt(argv, 'i:v', [
+            opts, _ = getopt.gnu_getopt(args, 'i:v', [
                 'verbose', 'help'])
 
         except getopt.GetoptError as e:
@@ -271,9 +271,9 @@ class NuxwdogDisableCLI(pki.cli.CLI):
         print('      --help                   Show help message.')
         print()
 
-    def execute(self, argv):
+    def execute(self, args):
         try:
-            opts, _ = getopt.gnu_getopt(argv, 'i:v', [
+            opts, _ = getopt.gnu_getopt(args, 'i:v', [
                 'verbose', 'help'])
 
         except getopt.GetoptError as e:
diff --git a/base/server/python/pki/server/cli/subsystem.py b/base/server/python/pki/server/cli/subsystem.py
index 8395bd2cd..9693bd3b4 100644
--- a/base/server/python/pki/server/cli/subsystem.py
+++ b/base/server/python/pki/server/cli/subsystem.py
@@ -129,10 +129,10 @@ class SubsystemShowCLI(pki.cli.CLI):
         print('      --help                      Show help message.')
         print()
 
-    def execute(self, argv):
+    def execute(self, args):
 
         try:
-            opts, args = getopt.gnu_getopt(argv, 'i:v', [
+            opts, args = getopt.gnu_getopt(args, 'i:v', [
                 'instance=',
                 'verbose', 'help'])
 
@@ -196,10 +196,10 @@ class SubsystemEnableCLI(pki.cli.CLI):
         print('      --help                      Show help message.')
         print()
 
-    def execute(self, argv):
+    def execute(self, args):
 
         try:
-            opts, args = getopt.gnu_getopt(argv, 'i:v', [
+            opts, args = getopt.gnu_getopt(args, 'i:v', [
                 'instance=', 'all',
                 'verbose', 'help'])
 
@@ -285,10 +285,10 @@ class SubsystemDisableCLI(pki.cli.CLI):
         print('      --help                      Show help message.')
         print()
 
-    def execute(self, argv):
+    def execute(self, args):
 
         try:
-            opts, args = getopt.gnu_getopt(argv, 'i:v', [
+            opts, args = getopt.gnu_getopt(args, 'i:v', [
                 'instance=', 'all',
                 'verbose', 'help'])
 
@@ -397,10 +397,10 @@ class SubsystemCertFindCLI(pki.cli.CLI):
         print('      --help                      Show help message.')
         print()
 
-    def execute(self, argv):
+    def execute(self, args):
 
         try:
-            opts, args = getopt.gnu_getopt(argv, 'i:v', [
+            opts, args = getopt.gnu_getopt(args, 'i:v', [
                 'instance=', 'show-all',
                 'verbose', 'help'])
 
@@ -480,10 +480,10 @@ class SubsystemCertShowCLI(pki.cli.CLI):
         print('      --help                      Show help message.')
         print()
 
-    def execute(self, argv):
+    def execute(self, args):
 
         try:
-            opts, args = getopt.gnu_getopt(argv, 'i:v', [
+            opts, args = getopt.gnu_getopt(args, 'i:v', [
                 'instance=', 'show-all',
                 'verbose', 'help'])
 
@@ -569,10 +569,10 @@ class SubsystemCertExportCLI(pki.cli.CLI):
         print('      --help                         Show help message.')
         print()
 
-    def execute(self, argv):
+    def execute(self, args):
 
         try:
-            opts, args = getopt.gnu_getopt(argv, 'i:v', [
+            opts, args = getopt.gnu_getopt(args, 'i:v', [
                 'instance=', 'cert-file=', 'csr-file=',
                 'pkcs12-file=', 'pkcs12-password=', 'pkcs12-password-file=',
                 'append', 'no-trust-flags', 'no-key', 'no-chain',
@@ -743,10 +743,10 @@ class SubsystemCertUpdateCLI(pki.cli.CLI):
         print('      --help                      Show help message.')
         print()
 
-    def execute(self, argv):
+    def execute(self, args):
 
         try:
-            opts, args = getopt.gnu_getopt(argv, 'i:v', [
+            opts, args = getopt.gnu_getopt(args, 'i:v', [
                 'instance=',
                 'verbose', 'help'])
 
@@ -864,10 +864,10 @@ class SubsystemCertValidateCLI(pki.cli.CLI):
         print('      --help                      Show help message.')
         print()
 
-    def execute(self, argv):
+    def execute(self, args):
 
         try:
-            opts, args = getopt.gnu_getopt(argv, 'i:v', [
+            opts, args = getopt.gnu_getopt(args, 'i:v', [
                 'instance=',
                 '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)
diff --git a/base/server/sbin/pki-server b/base/server/sbin/pki-server
index 6df70dc84..f9a66abc4 100644
--- a/base/server/sbin/pki-server
+++ b/base/server/sbin/pki-server
@@ -71,9 +71,9 @@ class PKIServerCLI(pki.cli.CLI):
 
         super(PKIServerCLI, self).print_help()
 
-    def execute(self, argv):
+    def execute(self, args):
         try:
-            opts, args = getopt.getopt(argv[1:], 'v', [
+            opts, args = getopt.getopt(args[1:], 'v', [
                 'verbose', 'debug', 'help'])
 
         except getopt.GetoptError as e:
-- 
2.13.0

