Skip to content

Commit 56ba4de

Browse files
Merge pull request #214 from sassoftware/develop
Signed-off-by: Kevin Lingle <[email protected]>
2 parents 6661d23 + 32829d0 commit 56ba4de

File tree

5 files changed

+2
-53
lines changed

5 files changed

+2
-53
lines changed

pre_install_report/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ Download the latest version of this tool and update required packages with every
7575

7676
## Usage
7777

78-
**Note:** You must set your `KUBECONFIG` environment variable. `KUBECONFIG` must have administrator rights to the
79-
cluster where you intend to deploy your SAS Viya platform software.
78+
You may set `KUBECONFIG` environment variable. If not set, `kubectl` will use `.kube/config` by default.
79+
`KUBECONFIG` must have administrator rights to the cluster where you intend to deploy your SAS Viya platform software.
8080
To obtain a complete report use a `KUBECONFIG` with administrator rights in the cluster. Otherwise, the report will
8181
not be able to evaluate items such as memory, CPU cores, software versions and other node details. It is not useful
8282
for determining if you are ready to deploy your SAS Viya platform software.

pre_install_report/library/pre_install_check.py

-15
Original file line numberDiff line numberDiff line change
@@ -218,21 +218,6 @@ def check_details(self, kubectl,
218218
output_dir)
219219
return
220220

221-
def _read_environment_var(self, env_var):
222-
"""
223-
This method verifies that the KUBECONFIG environment variable is set.
224-
225-
:param env_var: Environment variable to check
226-
"""
227-
try:
228-
value_env_var = os.environ[env_var]
229-
except Exception:
230-
self.logger.exception("CalledProcessorError")
231-
print(viya_messages.KUBECONF_ERROR)
232-
sys.exit(viya_messages.BAD_ENV_RC_)
233-
234-
return value_env_var
235-
236221
def _get_nested_info(self, nested_nodes, extracted_nodes, search_key):
237222

238223
try:

pre_install_report/library/utils/viya_messages.py

-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
"sure that kubectl" \
1717
" is properly configured and the KUBECONFIG " \
1818
"environment variable has a valid value"
19-
KUBECONF_ERROR = "ERROR: KUBECONFIG environment var must be set for the script " \
20-
"to access the Kubernetes cluster."
2119
CHECK_NAMESPACE = ' ERROR: Check available permissions in namespace and if it is valid: '
2220
LIMIT_ERROR = 'ERROR: The value in the viya_deployment_settings.ini file is not valid: {} = {}'
2321
KUBELET_VERSION_ERROR = 'ERROR: Check the VIYA_K8S_VERSION_MIN value ' \

pre_install_report/pre_install_report.py

-19
Original file line numberDiff line numberDiff line change
@@ -74,24 +74,6 @@ def _read_config_file(filename):
7474
sys.exit(viya_messages.SET_LIMTS_ERROR_RC_)
7575

7676

77-
def read_environment_var(env_var):
78-
"""
79-
This method verifies that the KUBECONFIG environment variable is set.
80-
81-
:param env_var: Environment variable to check
82-
"""
83-
try:
84-
value_env_var = os.environ[env_var]
85-
# Check if specified file exists
86-
if not os.path.exists(value_env_var):
87-
print(viya_messages.KUBECONF_FILE_ERROR.format(value_env_var))
88-
sys.exit(viya_messages.BAD_ENV_RC_)
89-
except Exception:
90-
print(viya_messages.KUBECONF_ERROR)
91-
sys.exit(viya_messages.BAD_ENV_RC_)
92-
return value_env_var
93-
94-
9577
class PreInstallReportCommand(Command):
9678
"""
9779
Command implementation for the pre-install command to register
@@ -198,7 +180,6 @@ def main(argv):
198180

199181
sas_logger = ViyaARKLogger(report_log_path, logging_level=logging_level, logger_name="pre_install_logger")
200182
logger = sas_logger.get_logger()
201-
read_environment_var('KUBECONFIG')
202183

203184
try:
204185
kubectl = Kubectl(namespace=name_space)

pre_install_report/test/test_pre_install_report.py

-15
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
from pre_install_report.library.pre_install_check_permissions import PreCheckPermissions
2626
from viya_ark_library.jinja2.sas_jinja2 import Jinja2TemplateRenderer
2727
from viya_ark_library.logging import ViyaARKLogger
28-
from pre_install_report.pre_install_report import read_environment_var
2928
from pre_install_report.library.utils import viya_messages
3029

3130
_SUCCESS_RC_ = 0
@@ -548,20 +547,6 @@ def test_get_calculated_aggregate_memory():
548547
assert str(round(total_calc_memoryGi.to('Gi'), 13)) == '62.5229606628418 Gi'
549548

550549

551-
def test_kubconfig_file():
552-
old_kubeconfig = os.environ.get('KUBECONFIG') # /Users/cat/doc
553-
os.environ['KUBECONFIG'] = 'blah_nonexistentfile_blah'
554-
new_kubeconfig = os.environ.get('KUBECONFIG') # /Users/cat/doc
555-
assert new_kubeconfig == 'blah_nonexistentfile_blah'
556-
try:
557-
read_environment_var('KUBECONFIG')
558-
except SystemExit as exc:
559-
assert exc.code == viya_messages.BAD_ENV_RC_
560-
pass
561-
finally:
562-
os.environ['KUBECONFIG'] = str(old_kubeconfig)
563-
564-
565550
def test_validated_k8s_server_version():
566551

567552
vpc = createViyaPreInstallCheck(viya_k8s_version_min,

0 commit comments

Comments
 (0)