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

Fix datatime issue when inventory key contains a date #1266

Merged
merged 2 commits into from
Nov 12, 2024

Conversation

ademariag
Copy link
Contributor

Fixes issue with datatime in inventory keys

./kapitan searchvar gen_google_container_cluster
Traceback (most recent call last):
  File "/opt/venv/bin/kapitan", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/kapitan/cli.py", line 645, in main
    args.func(args)
  File "/opt/venv/lib/python3.11/site-packages/kapitan/utils.py", line 330, in searchvar
    value = deep_get(data, keys)
            ^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/kapitan/utils.py", line 81, in lru_decorator
    _args = tuple([json.dumps(arg, sort_keys=True) if type(arg) in (list, dict) else arg for arg in args])
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/kapitan/utils.py", line 81, in <listcomp>
    _args = tuple([json.dumps(arg, sort_keys=True) if type(arg) in (list, dict) else arg for arg in args])
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/__init__.py", line 238, in dumps
    **kw).encode(obj)
          ^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/encoder.py", line 200, in encode
    chunks = self.iterencode(o, _one_shot=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/encoder.py", line 258, in iterencode
    return _iterencode(o, 0)

Proposed Changes

Docs and Tests

  • Tests added
  • Updated documentation

@ademariag ademariag merged commit fa35b29 into master Nov 12, 2024
8 checks passed
@ademariag ademariag deleted the fix-datatime-issue-inventory branch November 12, 2024 16:02
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.

1 participant