Moving to python 3 for kubernetes scripts 22/71722/1
authorYury Kylulin <yury.kylulin@intel.com>
Thu, 10 Dec 2020 08:40:29 +0000 (11:40 +0300)
committerYury Kylulin <yury.kylulin@intel.com>
Thu, 10 Dec 2020 09:40:07 +0000 (12:40 +0300)
Move to python version 3 in all scripts for kubernetes environment.
Streamline file names to match existing libraries.

Signed-off-by: Yury Kylulin <yury.kylulin@intel.com>
Change-Id: Id875f4240a87ab600b445cb9a7fd97ec1335f88a

VNFs/DPPD-PROX/helper-scripts/rapid/createrapidk8s.py
VNFs/DPPD-PROX/helper-scripts/rapid/rapid_k8s_deployment.py [moved from VNFs/DPPD-PROX/helper-scripts/rapid/k8sdeployment.py with 96% similarity]
VNFs/DPPD-PROX/helper-scripts/rapid/rapid_k8s_pod.py [moved from VNFs/DPPD-PROX/helper-scripts/rapid/pod.py with 99% similarity]
VNFs/DPPD-PROX/helper-scripts/rapid/rapid_sshclient.py [moved from VNFs/DPPD-PROX/helper-scripts/rapid/sshclient.py with 99% similarity]

index 4285584..c4667f1 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.7
+#!/usr/bin/env python3
 
 ##
 ## Copyright (c) 2019 Intel Corporation
@@ -17,7 +17,7 @@
 ##
 
 import argparse
-from k8sdeployment import K8sDeployment
+from rapid_k8s_deployment import K8sDeployment
 
 # Config file name for deployment creation
 CREATE_CONFIG_FILE_NAME = "rapid.pods"
@@ -1,5 +1,3 @@
-#!/usr/bin/env python2.7
-
 ##
 ## Copyright (c) 2019-2020 Intel Corporation
 ##
 
 import sys
 from kubernetes import client, config
-import ConfigParser
+try:
+    import configparser
+except ImportError:
+    # Python 2.x fallback
+    import ConfigParser as configparser
 import logging
 from logging import handlers
 
-from pod import Pod
+from rapid_k8s_pod import Pod
 
 class K8sDeployment:
     """Deployment class to create containers for test execution in Kubernetes
@@ -69,7 +71,7 @@ class K8sDeployment:
         """Read and parse configuration file for the test environment.
         """
         self._log.info("Loading configuration file %s", config_file_name)
-        self._create_config = ConfigParser.RawConfigParser()
+        self._create_config = configparser.RawConfigParser()
         try:
             self._create_config.read(config_file_name)
         except Exception as e:
@@ -146,7 +148,7 @@ class K8sDeployment:
     def save_runtime_config(self, config_file_name):
         self._log.info("Saving config %s for runrapid script...",
                        config_file_name)
-        self._runtime_config = ConfigParser.RawConfigParser()
+        self._runtime_config = configparser.RawConfigParser()
 
         # Section [DEFAULT]
 #        self._runtime_config.set("DEFAULT",
@@ -1,5 +1,3 @@
-#!/usr/bin/env python2.7
-
 ##
 ## Copyright (c) 2019 Intel Corporation
 ##
@@ -21,7 +19,7 @@ import time, yaml
 import logging
 from kubernetes import client, config
 
-from sshclient import SSHClient
+from rapid_sshclient import SSHClient
 
 class Pod:
     """Class which represents test pods.