>From 6b837267de5e6a0c7be9d78b0e2abbe5152d9224 Mon Sep 17 00:00:00 2001
From: Abhishek Koneru <akoneru@redhat.com>
Date: Tue, 26 Mar 2013 11:50:15 -0400
Subject: [PATCH] Separate folder for python deployment engine source code.

Place the python deployment source code and the python deployment
scriptlets in two seperate folders base/deploy/src/engine and
/base/deploy/src/scriptlets in the project.

Ticket #521
---
 base/deploy/CMakeLists.txt                         |   14 +++---
 .../deploy/src/{scriptlets => engine}/pkiconfig.py |    0
 .../deploy/src/{scriptlets => engine}/pkihelper.py |   46 ++++++++++----------
 .../src/{scriptlets => engine}/pkilogging.py       |    0
 .../src/{scriptlets => engine}/pkimanifest.py      |    0
 .../src/{scriptlets => engine}/pkimessages.py      |    0
 .../deploy/src/{scriptlets => engine}/pkiparser.py |    0
 .../src/{scriptlets => engine}/pkiscriptlet.py     |    0
 8 files changed, 30 insertions(+), 30 deletions(-)
 rename base/deploy/src/{scriptlets => engine}/pkiconfig.py (100%)
 rename base/deploy/src/{scriptlets => engine}/pkihelper.py (99%)
 rename base/deploy/src/{scriptlets => engine}/pkilogging.py (100%)
 rename base/deploy/src/{scriptlets => engine}/pkimanifest.py (100%)
 rename base/deploy/src/{scriptlets => engine}/pkimessages.py (100%)
 rename base/deploy/src/{scriptlets => engine}/pkiparser.py (100%)
 rename base/deploy/src/{scriptlets => engine}/pkiscriptlet.py (100%)

diff --git a/base/deploy/CMakeLists.txt b/base/deploy/CMakeLists.txt
index 8483482c29af44503a88850664b9886d74c4d90a..9c2b7f9425dd85990825cc114ecc2141daf1d1f2 100644
--- a/base/deploy/CMakeLists.txt
+++ b/base/deploy/CMakeLists.txt
@@ -107,18 +107,18 @@ install(
 
 install(
     FILES
+        src/engine/pkiconfig.py
+        src/engine/pkihelper.py
+        src/engine/pkilogging.py
+        src/engine/pkimanifest.py
+        src/engine/pkimessages.py
+        src/engine/pkiparser.py
+        src/engine/pkiscriptlet.py
         src/scriptlets/configuration.py
         src/scriptlets/finalization.py
         src/scriptlets/infrastructure_layout.py
         src/scriptlets/initialization.py
         src/scriptlets/instance_layout.py
-        src/scriptlets/pkiconfig.py
-        src/scriptlets/pkihelper.py
-        src/scriptlets/pkilogging.py
-        src/scriptlets/pkimanifest.py
-        src/scriptlets/pkimessages.py
-        src/scriptlets/pkiparser.py
-        src/scriptlets/pkiscriptlet.py
         src/scriptlets/security_databases.py
         src/scriptlets/selinux_setup.py
         src/scriptlets/slot_substitution.py
diff --git a/base/deploy/src/scriptlets/pkiconfig.py b/base/deploy/src/engine/pkiconfig.py
similarity index 100%
rename from base/deploy/src/scriptlets/pkiconfig.py
rename to base/deploy/src/engine/pkiconfig.py
diff --git a/base/deploy/src/scriptlets/pkihelper.py b/base/deploy/src/engine/pkihelper.py
similarity index 99%
rename from base/deploy/src/scriptlets/pkihelper.py
rename to base/deploy/src/engine/pkihelper.py
index 92707c55365faa2f7851fe1bd84b1edc37d2a67c..a48db61d08e664f255554bb2585776d766e62e56 100644
--- a/base/deploy/src/scriptlets/pkihelper.py
+++ b/base/deploy/src/engine/pkihelper.py
@@ -1010,12 +1010,12 @@ class instance:
             status = root.findtext("Status")
             return status
         except requests.exceptions.ConnectionError:
-            config.pki_log.debug("No connection", 
+            config.pki_log.debug("No connection",
                 extra=config.PKI_INDENTATION_LEVEL_3)
             return None
 
     def wait_for_startup(self, timeout):
-        tries = 1   
+        tries = 1
         status = self.get_instance_status()
         while status != "running":
             if tries >= timeout:
@@ -2357,7 +2357,7 @@ class certutil:
                     extra=config.PKI_INDENTATION_LEVEL_2)
                 sys.exit(1)
 
-            config.pki_log.info(command, 
+            config.pki_log.info(command,
                 extra=config.PKI_INDENTATION_LEVEL_2)
             subprocess.call(command)
         except subprocess.CalledProcessError as exc:
@@ -2490,7 +2490,7 @@ class pk12util:
                     extra=config.PKI_INDENTATION_LEVEL_2)
                 sys.exit(1)
 
-            config.pki_log.info(command, 
+            config.pki_log.info(command,
                     extra=config.PKI_INDENTATION_LEVEL_2)
             with open(os.devnull, "w") as fnull:
                 subprocess.call(command, stdout=fnull, stderr=fnull)
@@ -2576,7 +2576,7 @@ class kra_connector:
                 else:
                     return
 
-            self.execute_using_sslget(caport, cahost, subsystemnick, 
+            self.execute_using_sslget(caport, cahost, subsystemnick,
                                  token_pwd, krahost, kraport)
 
         except subprocess.CalledProcessError as exc:
@@ -2591,7 +2591,7 @@ class kra_connector:
                 sys.exit(-1)
         return
 
-    def execute_using_pki(self, caport, cahost, subsystemnick, 
+    def execute_using_pki(self, caport, cahost, subsystemnick,
       token_pwd, krahost, kraport, critical_failure=False):
         command = "/bin/pki -p '{}' -h '{}' -n '{}' -P https -d '{}' -w '{}' "\
                   "kraconnector-del {} {}".format(
@@ -2615,7 +2615,7 @@ class kra_connector:
         if critical_failure == True:
             sys.exit(-1)
 
-    def execute_using_sslget(self, caport, cahost, subsystemnick, 
+    def execute_using_sslget(self, caport, cahost, subsystemnick,
       token_pwd, krahost, kraport):
         urlheader = "https://{}:{}".format(cahost, caport)
         updateURL = "/ca/rest/admin/kraconnector/remove"
@@ -2716,20 +2716,20 @@ class security_domain:
                     log.PKIHELPER_SECURITY_DOMAIN_UNREACHABLE_1,
                     secname,
                     extra=config.PKI_INDENTATION_LEVEL_2)
-                output = self.update_domain_using_agent_port(typeval, 
-                    secname, params, updateURL, sechost, secagentport, 
+                output = self.update_domain_using_agent_port(typeval,
+                    secname, params, updateURL, sechost, secagentport,
                     critical_failure)
         else:
-            output = self.update_domain_using_agent_port(typeval, 
-                secname, params, updateURL, sechost, secagentport, 
+            output = self.update_domain_using_agent_port(typeval,
+                secname, params, updateURL, sechost, secagentport,
                 critical_failure)
 
-        if not output: 
+        if not output:
             if critical_failure == True:
                 sys.exit(-1)
             else:
                 return
-            
+
         config.pki_log.debug(log.PKIHELPER_SSLGET_OUTPUT_1,
                              output,
                              extra=config.PKI_INDENTATION_LEVEL_2)
@@ -3088,11 +3088,11 @@ class config_client:
         os.chmod(master['pki_client_admin_cert_p12'],
             config.PKI_DEPLOYMENT_DEFAULT_SECURITY_DATABASE_PERMISSIONS)
 
-        
+
     def construct_pki_configuration_data(self):
         config.pki_log.info(log.PKI_CONFIG_CONSTRUCTING_PKI_DATA,
                              extra=config.PKI_INDENTATION_LEVEL_2)
-        
+
         data = pki.system.ConfigurationRequest()
 
         # Miscellaneous Configuration Information
@@ -3121,7 +3121,7 @@ class config_client:
             # PKI CA or External CA
             self.set_new_security_domain(data)
 
-        # database 
+        # database
         if master['pki_subsystem'] != "RA":
             self.set_database_parameters(data)
 
@@ -3129,7 +3129,7 @@ class config_client:
         if master['pki_instance_type'] == "Tomcat":
             self.set_backup_parameters(data)
 
-        # admin user 
+        # admin user
         if not config.str2bool(master['pki_clone']):
             self.set_admin_parameters(data)
 
@@ -3318,18 +3318,18 @@ class config_client:
                 certutil.generate_certificate_request(
                                      master['pki_admin_subject_dn'],
                                      master['pki_admin_keysize'],
-                                     master['pki_client_password_conf'], 
+                                     master['pki_client_password_conf'],
                                      noise_file,
-                                     output_file, 
-                                     master['pki_client_database_dir'], 
+                                     output_file,
+                                     master['pki_client_database_dir'],
                                      None, None, True)
 
                 # convert output to ascii
                 command = ["BtoA", output_file, output_file + ".asc"]
-                config.pki_log.info(command, 
+                config.pki_log.info(command,
                                      extra=config.PKI_INDENTATION_LEVEL_2)
                 subprocess.call(command)
-                
+
                 with open(output_file + ".asc") as f:
                     b64 = f.read().replace('\n','')
 
@@ -3377,7 +3377,7 @@ class config_client:
         cert.subjectDN = master["pki_ssl_server_subject_dn"]
         cert.token = cs_cfg.get(cstype + ".sslserver.tokenname")
         return cert
-  
+
 # PKI Deployment Helper Class Instances
 identity = identity()
 namespace = namespace()
diff --git a/base/deploy/src/scriptlets/pkilogging.py b/base/deploy/src/engine/pkilogging.py
similarity index 100%
rename from base/deploy/src/scriptlets/pkilogging.py
rename to base/deploy/src/engine/pkilogging.py
diff --git a/base/deploy/src/scriptlets/pkimanifest.py b/base/deploy/src/engine/pkimanifest.py
similarity index 100%
rename from base/deploy/src/scriptlets/pkimanifest.py
rename to base/deploy/src/engine/pkimanifest.py
diff --git a/base/deploy/src/scriptlets/pkimessages.py b/base/deploy/src/engine/pkimessages.py
similarity index 100%
rename from base/deploy/src/scriptlets/pkimessages.py
rename to base/deploy/src/engine/pkimessages.py
diff --git a/base/deploy/src/scriptlets/pkiparser.py b/base/deploy/src/engine/pkiparser.py
similarity index 100%
rename from base/deploy/src/scriptlets/pkiparser.py
rename to base/deploy/src/engine/pkiparser.py
diff --git a/base/deploy/src/scriptlets/pkiscriptlet.py b/base/deploy/src/engine/pkiscriptlet.py
similarity index 100%
rename from base/deploy/src/scriptlets/pkiscriptlet.py
rename to base/deploy/src/engine/pkiscriptlet.py
-- 
1.7.10.2

