Skip to content

Commit

Permalink
Upgrade jsonnet and gojsonnet to 0.20.0 (#1006)
Browse files Browse the repository at this point in the history
  • Loading branch information
antonincms and ramaro committed Aug 22, 2023
1 parent c37f883 commit f594981
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
6 changes: 4 additions & 2 deletions kapitan/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,14 @@ def search_imports(cwd, import_str, search_paths):
- search_paths is the location where to look for import_str if not in cwd
The only supported parameters are cwd and import_str, so search_paths
needs to be closured.
This function returns a tuple[str, bytes] since jsonnet 0.19.0 require the
content of the file to be provided as a bytes type instead of a str.
"""
basename = os.path.basename(import_str)
full_import_path = os.path.normpath(os.path.join(cwd, import_str))

if full_import_path in JSONNET_CACHE:
return full_import_path, JSONNET_CACHE[full_import_path]
return full_import_path, JSONNET_CACHE[full_import_path].encode()

if not os.path.exists(full_import_path):
# if import_str not found, search in install_path
Expand Down Expand Up @@ -246,7 +248,7 @@ def search_imports(cwd, import_str, search_paths):
normalised_path_content = f.read()
JSONNET_CACHE[normalised_path] = normalised_path_content

return normalised_path, normalised_path_content
return normalised_path, normalised_path_content.encode()


def inventory(search_paths, target, inventory_path=None):
Expand Down
8 changes: 4 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ gitpython = "^3.1.30"
google-api-python-client = "^2.15.0"
hvac = "^0.11.0"
jinja2 = "^3.0.1"
jsonnet = "^0.18.0"
jsonnet = "^0.20.0"
jsonschema = "^4.17.3"
kadet = "^0.2.2"
python-gnupg = "^0.4.7"
Expand All @@ -61,7 +61,7 @@ certifi = "*"
gitdb = "^4.0.10"
packaging = "^23.0"
typing-extensions = "^4.0.0"
gojsonnet = { version = "^0.17.0", optional = true }
gojsonnet = { version = "^0.20.0", optional = true }
docker = { version = "^5.0.0", optional = true }

[tool.poetry.extras]
Expand Down

0 comments on commit f594981

Please sign in to comment.