Refactor packages
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
96
packages/sas/viya4-ark/remove-kubeconfig-check.patch
Normal file
96
packages/sas/viya4-ark/remove-kubeconfig-check.patch
Normal file
@@ -0,0 +1,96 @@
|
||||
diff --git a/pre_install_report/library/pre_install_check.py b/pre_install_report/library/pre_install_check.py
|
||||
index 31b66d8..88a2d96 100644
|
||||
--- a/pre_install_report/library/pre_install_check.py
|
||||
+++ b/pre_install_report/library/pre_install_check.py
|
||||
@@ -218,21 +218,6 @@ class ViyaPreInstallCheck():
|
||||
output_dir)
|
||||
return
|
||||
|
||||
- def _read_environment_var(self, env_var):
|
||||
- """
|
||||
- This method verifies that the KUBECONFIG environment variable is set.
|
||||
-
|
||||
- :param env_var: Environment variable to check
|
||||
- """
|
||||
- try:
|
||||
- value_env_var = os.environ[env_var]
|
||||
- except Exception:
|
||||
- self.logger.exception("CalledProcessorError")
|
||||
- print(viya_messages.KUBECONF_ERROR)
|
||||
- sys.exit(viya_messages.BAD_ENV_RC_)
|
||||
-
|
||||
- return value_env_var
|
||||
-
|
||||
def _get_nested_info(self, nested_nodes, extracted_nodes, search_key):
|
||||
|
||||
try:
|
||||
diff --git a/pre_install_report/pre_install_report.py b/pre_install_report/pre_install_report.py
|
||||
index 1379c43..54fbc7e 100644
|
||||
--- a/pre_install_report/pre_install_report.py
|
||||
+++ b/pre_install_report/pre_install_report.py
|
||||
@@ -74,24 +74,6 @@ def _read_config_file(filename):
|
||||
sys.exit(viya_messages.SET_LIMTS_ERROR_RC_)
|
||||
|
||||
|
||||
-def read_environment_var(env_var):
|
||||
- """
|
||||
- This method verifies that the KUBECONFIG environment variable is set.
|
||||
-
|
||||
- :param env_var: Environment variable to check
|
||||
- """
|
||||
- try:
|
||||
- value_env_var = os.environ[env_var]
|
||||
- # Check if specified file exists
|
||||
- if not os.path.exists(value_env_var):
|
||||
- print(viya_messages.KUBECONF_FILE_ERROR.format(value_env_var))
|
||||
- sys.exit(viya_messages.BAD_ENV_RC_)
|
||||
- except Exception:
|
||||
- print(viya_messages.KUBECONF_ERROR)
|
||||
- sys.exit(viya_messages.BAD_ENV_RC_)
|
||||
- return value_env_var
|
||||
-
|
||||
-
|
||||
class PreInstallReportCommand(Command):
|
||||
"""
|
||||
Command implementation for the pre-install command to register
|
||||
@@ -198,7 +180,6 @@ def main(argv):
|
||||
|
||||
sas_logger = ViyaARKLogger(report_log_path, logging_level=logging_level, logger_name="pre_install_logger")
|
||||
logger = sas_logger.get_logger()
|
||||
- read_environment_var('KUBECONFIG')
|
||||
|
||||
try:
|
||||
kubectl = Kubectl(namespace=name_space)
|
||||
diff --git a/pre_install_report/test/test_pre_install_report.py b/pre_install_report/test/test_pre_install_report.py
|
||||
index ed805ec..f93ec58 100644
|
||||
--- a/pre_install_report/test/test_pre_install_report.py
|
||||
+++ b/pre_install_report/test/test_pre_install_report.py
|
||||
@@ -25,7 +25,6 @@ from pre_install_report.library.pre_install_check import ViyaPreInstallCheck
|
||||
from pre_install_report.library.pre_install_check_permissions import PreCheckPermissions
|
||||
from viya_ark_library.jinja2.sas_jinja2 import Jinja2TemplateRenderer
|
||||
from viya_ark_library.logging import ViyaARKLogger
|
||||
-from pre_install_report.pre_install_report import read_environment_var
|
||||
from pre_install_report.library.utils import viya_messages
|
||||
|
||||
_SUCCESS_RC_ = 0
|
||||
@@ -548,20 +547,6 @@ def test_get_calculated_aggregate_memory():
|
||||
assert str(round(total_calc_memoryGi.to('Gi'), 13)) == '62.5229606628418 Gi'
|
||||
|
||||
|
||||
-def test_kubconfig_file():
|
||||
- old_kubeconfig = os.environ.get('KUBECONFIG') # /Users/cat/doc
|
||||
- os.environ['KUBECONFIG'] = 'blah_nonexistentfile_blah'
|
||||
- new_kubeconfig = os.environ.get('KUBECONFIG') # /Users/cat/doc
|
||||
- assert new_kubeconfig == 'blah_nonexistentfile_blah'
|
||||
- try:
|
||||
- read_environment_var('KUBECONFIG')
|
||||
- except SystemExit as exc:
|
||||
- assert exc.code == viya_messages.BAD_ENV_RC_
|
||||
- pass
|
||||
- finally:
|
||||
- os.environ['KUBECONFIG'] = str(old_kubeconfig)
|
||||
-
|
||||
-
|
||||
def test_validated_k8s_server_version():
|
||||
|
||||
vpc = createViyaPreInstallCheck(viya_k8s_version_min,
|
Reference in New Issue
Block a user