From 1d0f8d3f8500a6efdd9f38b95dd53d5e55957c8e Mon Sep 17 00:00:00 2001 From: sethho Date: Thu, 11 Apr 2024 12:08:57 -0400 Subject: [PATCH] changing input args for genpolicy --- src/confcom/HISTORY.rst | 5 +++++ src/confcom/azext_confcom/custom.py | 6 ------ src/confcom/azext_confcom/data/internal_config.json | 2 +- src/confcom/azext_confcom/kata_proxy.py | 10 ++++------ src/confcom/setup.py | 2 +- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/confcom/HISTORY.rst b/src/confcom/HISTORY.rst index 12de3e42279..e3512cd73ac 100644 --- a/src/confcom/HISTORY.rst +++ b/src/confcom/HISTORY.rst @@ -2,6 +2,11 @@ Release History =============== +0.3.6 +++++++ +* updating genpolicy version up through 3.2.0.azl0.genpolicy2 +* changing genpolicy flags to give full path to config files instead of path as a flag + 0.3.5 ++++++ * making diff mode more robust diff --git a/src/confcom/azext_confcom/custom.py b/src/confcom/azext_confcom/custom.py index 714913e80d7..1e56ffdda36 100644 --- a/src/confcom/azext_confcom/custom.py +++ b/src/confcom/azext_confcom/custom.py @@ -165,12 +165,6 @@ def katapolicygen_confcom( use_cached_files: bool = False, settings_file_name: str = None, ): - - if settings_file_name: - if "genpolicy-settings.json" in settings_file_name: - error_out("Cannot use default settings file names") - os_util.copy_file(settings_file_name, DATA_FOLDER) - kata_proxy = KataPolicyGenProxy() output = kata_proxy.kata_genpolicy( diff --git a/src/confcom/azext_confcom/data/internal_config.json b/src/confcom/azext_confcom/data/internal_config.json index cb701934b77..7423bac2f76 100644 --- a/src/confcom/azext_confcom/data/internal_config.json +++ b/src/confcom/azext_confcom/data/internal_config.json @@ -1,5 +1,5 @@ { - "version": "0.3.5", + "version": "0.3.6", "hcsshim_config": { "maxVersion": "1.0.0", "minVersion": "0.0.1" diff --git a/src/confcom/azext_confcom/kata_proxy.py b/src/confcom/azext_confcom/kata_proxy.py index d17655257e9..7630837ee66 100644 --- a/src/confcom/azext_confcom/kata_proxy.py +++ b/src/confcom/azext_confcom/kata_proxy.py @@ -112,7 +112,7 @@ def kata_genpolicy( ) -> List[str]: policy_bin_str = str(self.policy_bin) # get path to data and rules folder - arg_list = [policy_bin_str, "-y", yaml_path, "-i", DATA_FOLDER] + arg_list = [policy_bin_str, "-y", yaml_path, "-p", os.path.join(DATA_FOLDER, "rules.rego")] if config_map_file is not None: arg_list.append("-c") @@ -127,16 +127,14 @@ def kata_genpolicy( if use_cached_files: arg_list.append("-u") + arg_list.append("-j") if settings_file_name: - arg_list.append("-j") - # only take the last part of the path for the settings file - settings_file_name = os.path.basename(settings_file_name) arg_list.append(settings_file_name) + else: + arg_list.append(os.path.join(DATA_FOLDER, "genpolicy-settings.json")) item = subprocess.run( arg_list, - # stdout=sys.stdout, - # stderr=sys.stderr, check=False, ) diff --git a/src/confcom/setup.py b/src/confcom/setup.py index 5fc4e2cf340..feb291ff4ba 100644 --- a/src/confcom/setup.py +++ b/src/confcom/setup.py @@ -18,7 +18,7 @@ logger.warn("Wheel is not available, disabling bdist_wheel hook") -VERSION = "0.3.5" +VERSION = "0.3.6" # The full list of classifiers is available at # https://pypi.python.org/pypi?%3Aaction=list_classifiers