-
Notifications
You must be signed in to change notification settings - Fork 143
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
DNM - Extend hidden_fields to allow more complicated field definitions #880
base: main
Are you sure you want to change the base?
DNM - Extend hidden_fields to allow more complicated field definitions #880
Conversation
Merge Failed. This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset. |
This allows us to ignore e.g. the last-applied-configuration annotation by specifying `metadata.annotations[kubectl.kubernetes.io/last-applied-configuration]`
Needed to cope with multiple levels of bracketed keys e.g. spec.template.spec[securityContext][runAsUser] and implementing that lead to a much simpler version that finds the first key and the rest, and deals with just those two. Added more tests to cover some of the new supported cases.
Ensure test correctly captures that hidden fields should be hidden in diffs too
example: @yurnov ➜ /workspaces/kubernetes.core (hide-fields) $ flake8 plugins/ @yurnov ➜ /workspaces/kubernetes.core (hide-fields) $ black --diff plugins/ --- /workspaces/kubernetes.core/plugins/module_utils/k8s/service.py 2025-02-03 09:02:53.501654+00:00 +++ /workspaces/kubernetes.core/plugins/module_utils/k8s/service.py 2025-02-03 09:03:33.328340+00:00 @@ -653,14 +653,14 @@ rbracket = hidden_field.find("]") dot = hidden_field.find(".") if lbracket == 0: # skip past right bracket and any following dot - rest = hidden_field[rbracket + 1:] + rest = hidden_field[rbracket + 1 :] if rest and rest[0] == ".": rest = rest[1:] - return (hidden_field[lbracket + 1: rbracket], rest) + return (hidden_field[lbracket + 1 : rbracket], rest) if lbracket != -1 and (dot == -1 or lbracket < dot): return (hidden_field[:lbracket], hidden_field[lbracket:]) split = hidden_field.split(".", 1) would reformat /workspaces/kubernetes.core/plugins/module_utils/k8s/service.py All done! ✨ 🍰 ✨ 1 file would be reformatted, 73 files would be left unchanged. @yurnov ➜ /workspaces/kubernetes.core (hide-fields) $ black plugins/ reformatted /workspaces/kubernetes.core/plugins/module_utils/k8s/service.py All done! ✨ 🍰 ✨ 1 file reformatted, 73 files left unchanged. @yurnov ➜ /workspaces/kubernetes.core (hide-fields) $ flake8 plugins/ plugins/module_utils/k8s/service.py:658:41: E203 whitespace before ':' plugins/module_utils/k8s/service.py:661:42: E203 whitespace before ':' @yurnov ➜ /workspaces/kubernetes.core (hide-fields) $
…-lint and yamllint close ansible-collections#874
ac4781d
to
28a8e38
Compare
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 3m 38s |
SUMMARY
Fixes corner case from #872
ISSUE TYPE