Re: [Pki-devel] [PATCH] Fixed pylint errors (re-sent)

2017-05-31 Thread Christian Heimes
On 2017-06-01 01:47, Endi Sukma Dewata wrote:
> Just one thing, I was under the impression that we're supposed to remove
> PKIServerUpgradeScriptlet.__init__() altogether.
> 
> Christian, could you take a look a this?

Yes, you can safely drop PKIServerUpgradeScriptlet.__init__(). The
method merely performances a super call without additional logic.
Removing the method will silence pylint and shorten the code by three
unnecessary lines.

Christian

-- 
Christian Heimes
Senior Software Engineer, Identity Management and Platform Security

Red Hat GmbH, http://www.de.redhat.com/, Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Michael Cunningham, Michael
O'Neill, Eric Shander



signature.asc
Description: OpenPGP digital signature
___
Pki-devel mailing list
Pki-devel@redhat.com
https://www.redhat.com/mailman/listinfo/pki-devel

Re: [Pki-devel] [PATCH] Fixed pylint errors (re-sent)

2017-05-31 Thread Endi Sukma Dewata

On 5/31/2017 6:30 PM, Matthew Harmsen wrote:

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


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



Just one thing, I was under the impression that we're supposed to remove 
PKIServerUpgradeScriptlet.__init__() altogether.


Christian, could you take a look a this?

Everything else is good.

--
Endi S. Dewata

___
Pki-devel mailing list
Pki-devel@redhat.com
https://www.redhat.com/mailman/listinfo/pki-devel


[Pki-devel] [PATCH] Fixed pylint errors (re-sent)

2017-05-31 Thread Matthew Harmsen
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
   

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 
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

[Pki-devel] [PATCH] Fixed pylint errors

2017-05-31 Thread Matthew Harmsen

Please review the attached patch which addresses the following issues:

 * dogtagpki Pagure Issue #2713 - Build failure due to Pylint issues
   

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

From f5044bb484d61a569ba7da252f88d9c87378fcc0 Mon Sep 17 00:00:00 2001
From: Matthew Harmsen 
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,