From 0387c0bf7c1e29d98c93c232a6faa572dd533615 Mon Sep 17 00:00:00 2001 From: Amrityam Rout Date: Wed, 14 Jun 2023 15:56:10 +0200 Subject: [PATCH] [#2353459] Bug fix for config/example-values.yaml file not present in resc-helm-wizard while installing from pip --- deployment/resc-helm-wizard/MANIFEST.in | 2 +- deployment/resc-helm-wizard/setup.cfg | 2 +- .../src/resc_helm_wizard/helm_utilities.py | 4 ++-- deployment/resc-helm-wizard/tests/test_helm_utilities.py | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/deployment/resc-helm-wizard/MANIFEST.in b/deployment/resc-helm-wizard/MANIFEST.in index 23795825..c29123f3 100644 --- a/deployment/resc-helm-wizard/MANIFEST.in +++ b/deployment/resc-helm-wizard/MANIFEST.in @@ -1,3 +1,3 @@ exclude README.md exclude MANIFEST.in -include config/*.yaml \ No newline at end of file +include src/resc_helm_wizard/config/*.yaml \ No newline at end of file diff --git a/deployment/resc-helm-wizard/setup.cfg b/deployment/resc-helm-wizard/setup.cfg index d9a4f8c0..7f42370a 100644 --- a/deployment/resc-helm-wizard/setup.cfg +++ b/deployment/resc-helm-wizard/setup.cfg @@ -1,7 +1,7 @@ [metadata] name = resc_helm_wizard description = Repository Scanner - Helm Wizard -version = 1.0.3 +version = 1.0.4 author = ABN AMRO author_email = resc@nl.abnamro.com url = https://github.com/ABNAMRO/repository-scanner diff --git a/deployment/resc-helm-wizard/src/resc_helm_wizard/helm_utilities.py b/deployment/resc-helm-wizard/src/resc_helm_wizard/helm_utilities.py index fde3e57b..68c8dffb 100644 --- a/deployment/resc-helm-wizard/src/resc_helm_wizard/helm_utilities.py +++ b/deployment/resc-helm-wizard/src/resc_helm_wizard/helm_utilities.py @@ -74,7 +74,7 @@ def add_helm_repository(): """ Adds a helm repository """ - cmd = ["helm", "repo", "add", constants.HELM_REPO_NAME, constants.RESC_HELM_REPO_URL] + cmd = ["helm", "repo", "add", constants.HELM_REPO_NAME, constants.RESC_HELM_REPO_URL, "-n", constants.NAMESPACE] try: subprocess.run(cmd, check=True) except subprocess.CalledProcessError: @@ -86,7 +86,7 @@ def update_helm_repository(): """ Updates a helm repository """ - cmd = ["helm", "repo", "update", constants.HELM_REPO_NAME] + cmd = ["helm", "repo", "update", "-n", constants.NAMESPACE] try: subprocess.run(cmd, check=True) except subprocess.CalledProcessError: diff --git a/deployment/resc-helm-wizard/tests/test_helm_utilities.py b/deployment/resc-helm-wizard/tests/test_helm_utilities.py index fa1ffd36..67541b07 100644 --- a/deployment/resc-helm-wizard/tests/test_helm_utilities.py +++ b/deployment/resc-helm-wizard/tests/test_helm_utilities.py @@ -94,7 +94,7 @@ def test_get_version_from_downloaded_chart_failure(mock_check_output): @patch("subprocess.run") def test_add_helm_repository_success(mock_check_output): - cmd = ["helm", "repo", "add", constants.HELM_REPO_NAME, constants.RESC_HELM_REPO_URL] + cmd = ["helm", "repo", "add", constants.HELM_REPO_NAME, constants.RESC_HELM_REPO_URL, "-n", constants.NAMESPACE] add_helm_repository() assert mock_check_output.called mock_check_output.assert_called_once_with(cmd, check=True) @@ -102,7 +102,7 @@ def test_add_helm_repository_success(mock_check_output): @patch("logging.Logger.error") def test_add_helm_repository_failure(mock_error_log): - cmd = ["helm", "repo", "add", constants.HELM_REPO_NAME, constants.RESC_HELM_REPO_URL] + cmd = ["helm", "repo", "add", constants.HELM_REPO_NAME, constants.RESC_HELM_REPO_URL, "-n", constants.NAMESPACE] expected_error_log = "An error occurred while adding the helm repository" with mock.patch("subprocess.run") as mock_check_output, \ mock.patch("sys.exit") as mock_sys_exit: @@ -116,7 +116,7 @@ def test_add_helm_repository_failure(mock_error_log): @patch("subprocess.run") def test_update_helm_repository_success(mock_check_output): - cmd = ["helm", "repo", "update", constants.HELM_REPO_NAME] + cmd = ["helm", "repo", "update", "-n", constants.NAMESPACE] update_helm_repository() assert mock_check_output.called mock_check_output.assert_called_once_with(cmd, check=True) @@ -124,7 +124,7 @@ def test_update_helm_repository_success(mock_check_output): @patch("logging.Logger.error") def test_update_helm_repository_failure(mock_error_log): - cmd = ["helm", "repo", "update", constants.HELM_REPO_NAME] + cmd = ["helm", "repo", "update", "-n", constants.NAMESPACE] expected_error_log = "An error occurred while updating the helm repository" with mock.patch("subprocess.run") as mock_check_output, \ mock.patch("sys.exit") as mock_sys_exit: