>From 3d5cc5bee6ee8de3757f9b487a9112792289c460 Mon Sep 17 00:00:00 2001
From: Abhishek Koneru <akoneru@redhat.com>
Date: Mon, 8 Jul 2013 10:42:11 -0400
Subject: [PATCH 93/94] Fix issues reported by pylint.

Fixed all warnings caused due to absolute import of modules in same
package and not marking the regexes with an r when trying to match.

Ticket #316
---
 base/common/python/pki/__init__.py                  |   10 +++++-----
 base/common/python/pki/upgrade.py                   |    2 +-
 base/server/src/engine/pkihelper.py                 |   10 +++++-----
 base/server/src/engine/pkimanifest.py               |    4 ++--
 base/server/src/engine/pkimessages.py               |    4 ++--
 base/server/src/engine/pkiparser.py                 |    8 ++++----
 base/server/src/scriptlets/configuration.py         |    9 +++++----
 base/server/src/scriptlets/finalization.py          |    8 ++++----
 base/server/src/scriptlets/infrastructure_layout.py |    6 +++---
 base/server/src/scriptlets/initialization.py        |    6 +++---
 base/server/src/scriptlets/instance_layout.py       |    6 +++---
 base/server/src/scriptlets/security_databases.py    |    6 +++---
 base/server/src/scriptlets/selinux_setup.py         |   11 ++++++-----
 base/server/src/scriptlets/slot_substitution.py     |    6 +++---
 base/server/src/scriptlets/subsystem_layout.py      |    6 +++---
 base/server/src/scriptlets/webapp_deployment.py     |    7 +++----
 16 files changed, 55 insertions(+), 54 deletions(-)

diff --git a/base/common/python/pki/__init__.py b/base/common/python/pki/__init__.py
index 979bf64d9bbc78f879636cb3acb67dbdcc3f5cc3..bbcffb8a4d14e6e488edc195d9b4923b315b99ee 100644
--- a/base/common/python/pki/__init__.py
+++ b/base/common/python/pki/__init__.py
@@ -75,7 +75,7 @@ def implementation_version():
             line = line.strip('\n')
 
             # parse <key>: <value>
-            match = re.match('^\s*(\S*)\s*:\s*(.*)\s*$', line)
+            match = re.match(r'^\s*(\S*)\s*:\s*(.*)\s*$', line)
 
             if not match:
                 continue
@@ -147,7 +147,7 @@ class PropertyFile(object):
         for i, line in enumerate(self.lines):
 
             # parse <key> <delimiter> <value>
-            match = re.match('^\s*(\S*)\s*%s\s*(.*)\s*$' % self.delimiter, line)
+            match = re.match(r'^\s*(\S*)\s*%s\s*(.*)\s*$' % self.delimiter, line)
 
             if not match:
                 continue
@@ -166,7 +166,7 @@ class PropertyFile(object):
         for line in self.lines:
 
             # parse <key> <delimiter> <value>
-            match = re.match('^\s*(\S*)\s*%s\s*(.*)\s*$' % self.delimiter, line)
+            match = re.match(r'^\s*(\S*)\s*%s\s*(.*)\s*$' % self.delimiter, line)
 
             if not match:
                 continue
@@ -184,7 +184,7 @@ class PropertyFile(object):
         for i, line in enumerate(self.lines):
 
             # parse <key> <delimiter> <value>
-            match = re.match('^\s*(\S*)\s*%s\s*(.*)\s*$' % self.delimiter, line)
+            match = re.match(r'^\s*(\S*)\s*%s\s*(.*)\s*$' % self.delimiter, line)
 
             if not match:
                 continue
@@ -206,7 +206,7 @@ class PropertyFile(object):
         for i, line in enumerate(self.lines):
 
             # parse <key> <delimiter> <value>
-            match = re.match('^\s*(\S*)\s*%s\s*(.*)\s*$' % self.delimiter, line)
+            match = re.match(r'^\s*(\S*)\s*%s\s*(.*)\s*$' % self.delimiter, line)
 
             if not match:
                 continue
diff --git a/base/common/python/pki/upgrade.py b/base/common/python/pki/upgrade.py
index d1cda6bacee991488ae53bf70fc61a803c1fe980..05db24f63f43543373832e3f049ff153d4d65149 100644
--- a/base/common/python/pki/upgrade.py
+++ b/base/common/python/pki/upgrade.py
@@ -55,7 +55,7 @@ class Version(object):
                 raise Exception('Invalid version number: ' + obj)
 
             # parse <major>.<minor>.<patch>
-            match = re.match('^(\d+)\.(\d+)\.(\d+)$', self.version)
+            match = re.match(r'^(\d+)\.(\d+)\.(\d+)$', self.version)
 
             if match is None:
                 raise Exception('Invalid version number: ' + self.version)
diff --git a/base/server/src/engine/pkihelper.py b/base/server/src/engine/pkihelper.py
index c33abe0f81ef97e5f349b34faca574a62ee2d5f7..39a0b8b9efa2c2765fcc706018dc58ab4abcb66e 100644
--- a/base/server/src/engine/pkihelper.py
+++ b/base/server/src/engine/pkihelper.py
@@ -47,11 +47,11 @@ if selinux.is_selinux_enabled():
 
 
 # PKI Deployment Imports
-import pkiconfig as config
-from pkiconfig import pki_selinux_config_ports as ports
-import pkimanifest as manifest
-import pkimessages as log
-from pkiparser import PKIConfigParser
+from . import pkiconfig as config
+from .pkiconfig import pki_selinux_config_ports as ports
+from . import pkimanifest as manifest
+from . import pkimessages as log
+from .pkiparser import PKIConfigParser
 import pki.account
 import pki.client
 import pki.system
diff --git a/base/server/src/engine/pkimanifest.py b/base/server/src/engine/pkimanifest.py
index 721373eac57a4fa7e70ef9b4774b3d1194b15447..09079b4334c713959a5d76735b43515983c40159 100644
--- a/base/server/src/engine/pkimanifest.py
+++ b/base/server/src/engine/pkimanifest.py
@@ -23,8 +23,8 @@
 import csv
 
 # PKI Deployment Imports
-import pkiconfig as config
-import pkimessages as log
+from . import pkiconfig as config
+from . import pkimessages as log
 
 
 # PKI Deployment Manifest Constants
diff --git a/base/server/src/engine/pkimessages.py b/base/server/src/engine/pkimessages.py
index 5ee8bb840a162fbb358d90039019198d30c01216..fdbd2831200f7d9a6a771d6c2ebc1dd28ffdfe8a 100644
--- a/base/server/src/engine/pkimessages.py
+++ b/base/server/src/engine/pkimessages.py
@@ -307,10 +307,10 @@ PKI_CONFIG_RESPONSE_ADMIN_CERT = "adminCert:"
 PKI_CONFIG_RESPONSE_STATUS = "status:"
 PKI_CONFIG_NOT_YET_IMPLEMENTED_1 = " %s NOT YET IMPLEMENTED"
 PKI_CHECK_STATUS_MESSAGE = "    To check the status of the subsystem: \n"\
-"        systemctl status pki-tomcatd\@%s.service"
+"        systemctl status pki-tomcatd@%s.service"
 PKI_ACCESS_URL = "    The URL for the subsystem is https://%s:%s/%s"
 PKI_INSTANCE_RESTART_MESSAGE = "    To restart the subsystem: \n"\
-"        systemctl restart pki-tomcatd\@%s.service"
+"        systemctl restart pki-tomcatd@%s.service"
 
 
 PKI_SPAWN_INFORMATION_HEADER = "\n    ==========================================================================\n"\
diff --git a/base/server/src/engine/pkiparser.py b/base/server/src/engine/pkiparser.py
index a70a8df6e16f0e9a266e098af396c7b02ee74d57..00d9f7322e93c8852b765d3f5cddaec14828cc75 100644
--- a/base/server/src/engine/pkiparser.py
+++ b/base/server/src/engine/pkiparser.py
@@ -34,13 +34,13 @@ import subprocess
 # PKI Imports
 import pki
 import pki.upgrade
-import pkilogging
-import pkiconfig as config
-import pkimessages as log
-
 import pki.account
 import pki.client
 import pki.system
+from . import pkiconfig as config
+from . import pkimessages as log
+from . import pkilogging
+
 
 class PKIConfigParser:
 
diff --git a/base/server/src/scriptlets/configuration.py b/base/server/src/scriptlets/configuration.py
index b2223cab72fbf640c4b0aad64ca2635ebc9b975f..d32437f0bc5316cd9f1357aa930636a15a1f7f09 100644
--- a/base/server/src/scriptlets/configuration.py
+++ b/base/server/src/scriptlets/configuration.py
@@ -19,11 +19,12 @@
 # All rights reserved.
 #
 
-# PKI Deployment Imports
-import pkiconfig as config
-import pkimessages as log
-import pkiscriptlet
 import json
+
+# PKI Deployment Imports
+from . import pkiconfig as config
+from . import pkimessages as log
+from . import pkiscriptlet
 import pki.system
 import pki.encoder
 
diff --git a/base/server/src/scriptlets/finalization.py b/base/server/src/scriptlets/finalization.py
index 529f9d45d6f698a7469b6c7a344e1bd0a630c54c..0d937584a5b513415ab05e966b4d9492969b4087 100644
--- a/base/server/src/scriptlets/finalization.py
+++ b/base/server/src/scriptlets/finalization.py
@@ -20,10 +20,10 @@
 #
 
 # PKI Deployment Imports
-import pkiconfig as config
-import pkimanifest as manifest
-import pkimessages as log
-import pkiscriptlet
+from . import pkiconfig as config
+from . import pkimanifest as manifest
+from . import pkimessages as log
+from . import pkiscriptlet
 
 
 # PKI Deployment Finalization Scriptlet
diff --git a/base/server/src/scriptlets/infrastructure_layout.py b/base/server/src/scriptlets/infrastructure_layout.py
index 3becd34c3de8ccbc30014a15c0197fe09752ce9d..e4d32bb0bae506cf5ac05bbcac7246e6e566e028 100644
--- a/base/server/src/scriptlets/infrastructure_layout.py
+++ b/base/server/src/scriptlets/infrastructure_layout.py
@@ -20,9 +20,9 @@
 #
 
 # PKI Deployment Imports
-import pkiconfig as config
-import pkimessages as log
-import pkiscriptlet
+from . import pkiconfig as config
+from . import pkimessages as log
+from . import pkiscriptlet
 
 
 # PKI Deployment Top-Level Infrastructure Layout Scriptlet
diff --git a/base/server/src/scriptlets/initialization.py b/base/server/src/scriptlets/initialization.py
index 41e5752029cbe04112ca6c2498820002786bfcaa..55b984693ee5c0f95fb04a99c38a02e81f3d75b1 100644
--- a/base/server/src/scriptlets/initialization.py
+++ b/base/server/src/scriptlets/initialization.py
@@ -20,9 +20,9 @@
 #
 
 # PKI Deployment Imports
-import pkiconfig as config
-import pkimessages as log
-import pkiscriptlet
+from . import pkiconfig as config
+from . import pkimessages as log
+from . import pkiscriptlet
 
 
 # PKI Deployment Initialization Scriptlet
diff --git a/base/server/src/scriptlets/instance_layout.py b/base/server/src/scriptlets/instance_layout.py
index 99a97532bb319a683d70b4a7f2be9550794066fa..fe02a9f9d6b23eba8ce8439c4f9089e8c8129586 100644
--- a/base/server/src/scriptlets/instance_layout.py
+++ b/base/server/src/scriptlets/instance_layout.py
@@ -24,9 +24,9 @@ import os
 
 
 # PKI Deployment Imports
-import pkiconfig as config
-import pkimessages as log
-import pkiscriptlet
+from . import pkiconfig as config
+from . import pkimessages as log
+from . import pkiscriptlet
 
 
 # PKI Deployment Instance Layout Scriptlet
diff --git a/base/server/src/scriptlets/security_databases.py b/base/server/src/scriptlets/security_databases.py
index d8a6eeb6569a82c39878cfb010bb5a4a65916a36..aa522ce043e51f3cbdc91efdb228a67c2fcbc5e7 100644
--- a/base/server/src/scriptlets/security_databases.py
+++ b/base/server/src/scriptlets/security_databases.py
@@ -20,9 +20,9 @@
 #
 
 # PKI Deployment Imports
-import pkiconfig as config
-import pkimessages as log
-import pkiscriptlet
+from . import pkiconfig as config
+from . import pkimessages as log
+from . import pkiscriptlet
 
 
 # PKI Deployment Security Databases Scriptlet
diff --git a/base/server/src/scriptlets/selinux_setup.py b/base/server/src/scriptlets/selinux_setup.py
index 5e3a5ab0d2e44078cd2a72bfca0d0a36f99219b4..dbc98c23b5df2eef338204021c87b491984a791e 100644
--- a/base/server/src/scriptlets/selinux_setup.py
+++ b/base/server/src/scriptlets/selinux_setup.py
@@ -19,15 +19,16 @@
 # All rights reserved.
 #
 
-# PKI Deployment Imports
-import pkiconfig as config
-from pkiconfig import pki_selinux_config_ports as ports
-import pkimessages as log
-import pkiscriptlet
 import selinux
 import time
 if selinux.is_selinux_enabled():
     import seobject
+    
+# PKI Deployment Imports
+from . import pkiconfig as config
+from .pkiconfig import pki_selinux_config_ports as ports
+from . import pkimessages as log
+from . import pkiscriptlet
 
 
 # PKI Deployment Selinux Setup Scriptlet
diff --git a/base/server/src/scriptlets/slot_substitution.py b/base/server/src/scriptlets/slot_substitution.py
index bd3211b9d65ec4844b3e3b443135e3960f78f66c..2bb888dfd2e28fcf2ed2e54c5b2d3eec04d0ce22 100644
--- a/base/server/src/scriptlets/slot_substitution.py
+++ b/base/server/src/scriptlets/slot_substitution.py
@@ -20,9 +20,9 @@
 #
 
 # PKI Deployment Imports
-import pkiconfig as config
-import pkimessages as log
-import pkiscriptlet
+from . import pkiconfig as config
+from . import pkimessages as log
+from . import pkiscriptlet
 
 
 # PKI Deployment Slot Substitution Scriptlet
diff --git a/base/server/src/scriptlets/subsystem_layout.py b/base/server/src/scriptlets/subsystem_layout.py
index 8e484177642201e4204c12ed6b33761447869740..81dedf68c9aaff78c7990eec290897807ec1f989 100644
--- a/base/server/src/scriptlets/subsystem_layout.py
+++ b/base/server/src/scriptlets/subsystem_layout.py
@@ -20,9 +20,9 @@
 #
 
 # PKI Deployment Imports
-import pkiconfig as config
-import pkimessages as log
-import pkiscriptlet
+from . import pkiconfig as config
+from . import pkimessages as log
+from . import pkiscriptlet
 
 
 # PKI Deployment Subsystem Layout Scriptlet
diff --git a/base/server/src/scriptlets/webapp_deployment.py b/base/server/src/scriptlets/webapp_deployment.py
index bd8de9a15db7d6f7ab9fe08b6bba05db15686feb..4a37b6df9651c816f27144447ae5fdcaca92297e 100644
--- a/base/server/src/scriptlets/webapp_deployment.py
+++ b/base/server/src/scriptlets/webapp_deployment.py
@@ -22,11 +22,10 @@
 # System Imports
 import os
 
-
 # PKI Deployment Imports
-import pkiconfig as config
-import pkimessages as log
-import pkiscriptlet
+from . import pkiconfig as config
+from . import pkimessages as log
+from . import pkiscriptlet
 
 
 # PKI Web Application Deployment Scriptlet
-- 
1.7.10.2

