Skip to content

Commit

Permalink
changing input args for genpolicy
Browse files Browse the repository at this point in the history
  • Loading branch information
SethHollandsworth committed Apr 15, 2024
1 parent 5c76447 commit fbd03e9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
6 changes: 0 additions & 6 deletions src/confcom/azext_confcom/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,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(
Expand Down
10 changes: 4 additions & 6 deletions src/confcom/azext_confcom/kata_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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,
)

Expand Down

0 comments on commit fbd03e9

Please sign in to comment.