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

Make each users data package have unique manifest ID #54

Merged
merged 2 commits into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.2.0
current_version = 1.3.0
commit = False
tag = False

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "takrmapi"
version = "1.2.0"
version = "1.3.0"
description = "RASENMAEHER integration API for TAK server"
authors = ["Eero af Heurlin <rambo@iki.fi>", "Ari Karhunen <FIXME@example.com>"]
homepage = "https://github.com/pvarki/python-tak-rmapi"
Expand Down
2 changes: 1 addition & 1 deletion src/takrmapi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
""" RASENMAEHER integration API for TAK server """
__version__ = "1.2.0" # NOTE Use `bump2version --config-file patch` to bump versions correctly
__version__ = "1.3.0" # NOTE Use `bump2version --config-file patch` to bump versions correctly
12 changes: 8 additions & 4 deletions src/takrmapi/tak_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
import shutil
import logging
from pathlib import Path
import aiohttp
import uuid


import aiohttp
from OpenSSL import crypto # FIXME: Move to python-cryptography for cert parsing
from jinja2 import Template
from libpvarki.schemas.product import UserCRUDRequest
Expand Down Expand Up @@ -188,7 +189,9 @@ async def create_mission_zip(self, app_version: str = "", walk_dir: str = "") ->
with open(org_file, "r", encoding="utf-8") as filehandle:
template = Template(filehandle.read())

rendered_template = await self.render_tak_manifest_template(template=template)
rendered_template = await self.render_tak_manifest_template(
template=template, app_version=app_version
)
new_dst_file = dst_file.replace(".tpl", "")
if new_dst_file.endswith("manifest.xml"):
await self.tak_manifest_extra(rendered_template, tmp_folder)
Expand All @@ -207,10 +210,11 @@ async def create_mission_zip(self, app_version: str = "", walk_dir: str = "") ->
# await remove_tmp_dir(tmp_folder)
return f"{tmp_folder}.zip"

async def render_tak_manifest_template(self, template: Template) -> str:
async def render_tak_manifest_template(self, template: Template, app_version: str) -> str:
"""Render tak manifest template"""
pkguid = uuid.uuid5(uuid.NAMESPACE_URL, f"{config.TAK_SERVER_FQDN}/{self.user.user.uuid}/{app_version}")
return template.render(
tak_server_uid_name=config.TAK_SERVER_FQDN,
tak_server_uid_name=str(pkguid),
tak_server_name=config.TAK_SERVER_NAME,
tak_server_address=config.TAK_SERVER_FQDN,
client_cert_name=self.user.callsign,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_takrmapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

def test_version() -> None:
"""Make sure version matches expected"""
assert __version__ == "1.2.0"
assert __version__ == "1.3.0"
Loading