Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changing input args for genpolicy #51

Merged
merged 1 commit into from
Jun 18, 2024
Merged

Conversation

SethHollandsworth
Copy link
Owner

Upcoming change to genpolicy splits the -i flag into two separate flags so the paths to the rules.rego and genpolicy-settings.json are decoupled. This allows for that and makes it so custom settings files don't need to be copied to the same folder as rules.rego

@hgarvison hgarvison self-requested a review April 15, 2024 20:16
@SethHollandsworth SethHollandsworth force-pushed the main branch 3 times, most recently from 291d8bd to 2a895ff Compare April 19, 2024 18:44
@SethHollandsworth SethHollandsworth force-pushed the kata_config_path branch 2 times, most recently from 1d0f8d3 to 6e39e89 Compare June 17, 2024 15:17
Copy link
Collaborator

@ksayid ksayid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SethHollandsworth SethHollandsworth force-pushed the kata_config_path branch 3 times, most recently from 875ab69 to 8f2b530 Compare June 18, 2024 17:10
Copy link
Collaborator

@ksayid ksayid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

python is so flexible that I think there are little ways to make kata_genpolicy a little shorter. it's already really readable, so just sharing in case you're interested:

  • using extend() instead of successive append()s
  • using or instead of if-else
    ex:
    settings_file_path = settings_file_name or os.path.join(DATA_FOLDER, "genpolicy-settings.json")
    rules_file_path = rules_file_name or os.path.join(DATA_FOLDER, "rules.rego")

    arg_list.extend(["-j", settings_file_path, "-p", rules_file_path])
  • single line if-else
containerd_arg = "-d" + (f"={containerd_socket_path}" if containerd_socket_path else "")

@SethHollandsworth
Copy link
Owner Author

@ksayid I agree with extend(). We can put that in another PR. I think we've used it in other spots for the same reason. The other one I'd argue is a little less readable, to me at least

@SethHollandsworth SethHollandsworth merged commit 2d97d10 into main Jun 18, 2024
SethHollandsworth pushed a commit that referenced this pull request Aug 14, 2024
* build: add cicd pipeline (#7)

* build: move update version logic to workflow (#8)

* build: Run CI on multiple python version (#38)

* build: Run CI in Python 3.8-3.11

* build: remove pull request event for CI to avoid duplicate runs

* test: add test cases for commands (#40)

* fix: error when register API with long description spec (#41)

* test: add test cases for optional parameters (#42)

* feat!: remove file name param (#43)

* fix: error not thrown when import spec with >3MB file (#44)

* feat!: remove state param for deployment commands (#46)

* fix: API title created by register command is not same with provided spec (#47)

* feat!: redesign parameters to specify APIM instance for import-from-apim command (#45)

* test: clean up legacy test cases (#48)

* test: add test cases for command examples (#49)

* docs: update help message per feedback (#50)

* build: bump version to 1.0.0 and add changelog (#51)

* fix: some parameters should be required in import-specification and deployment command (#53)

* feat!: rename parameter names to align with other Azure CLI command experience (#52)

* test: enable test for import-from-apim (#54)

* test: fix show service test case (#55)

* docs: update changelog for 1.0.0 (#56)

* Update HISTORY.rst - jukasper

updated changelog

* Update HISTORY.rst

* Update HISTORY.rst

* Update HISTORY.rst

* Update HISTORY.rst

* Update HISTORY.rst

* Update HISTORY.rst

* Update HISTORY.rst

* Update HISTORY.rst

* Update HISTORY.rst

* Update HISTORY.rst

* Update HISTORY.rst

* Update HISTORY.rst

* Update HISTORY.rst

* Update HISTORY.rst

* Update HISTORY.rst

* Update HISTORY.rst

* docs: update readme for apic-extension (#57)

* fix: cannot run create command against existing resource (#58)

* fix: cannot run create command against existing resource

* style: fix style

* build: remove cicd pipeline (#59)

* build: resolve review comments (#60)

---------

Co-authored-by: Julia Kasper <[email protected]>
@SethHollandsworth SethHollandsworth deleted the kata_config_path branch November 20, 2024 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants