From 8eb293fec4b9b4abee5bb26df80d08895a90dbf1 Mon Sep 17 00:00:00 2001 From: ghpzin Date: Fri, 6 Sep 2024 21:30:16 +0300 Subject: [PATCH] peering-manager: fix runtime with pyixapi 0.2.3 - add patch from merged upstream commit fixing pyixapi 0.2.3 compatibility: https://github.com/peering-manager/peering-manager/commit/ee558ff66e467412942559a8a92252e3fc009920 --- .../web-apps/peering-manager/default.nix | 6 ++++ .../fix-pyixapi-0.2.3-compatibility.patch | 30 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 pkgs/servers/web-apps/peering-manager/fix-pyixapi-0.2.3-compatibility.patch diff --git a/pkgs/servers/web-apps/peering-manager/default.nix b/pkgs/servers/web-apps/peering-manager/default.nix index a5dfa6884694..eb941b85853e 100644 --- a/pkgs/servers/web-apps/peering-manager/default.nix +++ b/pkgs/servers/web-apps/peering-manager/default.nix @@ -19,6 +19,12 @@ python3.pkgs.buildPythonApplication rec { format = "other"; + patches = [ + # Fix compatibility with pyixapi 0.2.3 + # https://github.com/peering-manager/peering-manager/commit/ee558ff66e467412942559a8a92252e3fc009920 + ./fix-pyixapi-0.2.3-compatibility.patch + ]; + propagatedBuildInputs = with python3.pkgs; [ django djangorestframework diff --git a/pkgs/servers/web-apps/peering-manager/fix-pyixapi-0.2.3-compatibility.patch b/pkgs/servers/web-apps/peering-manager/fix-pyixapi-0.2.3-compatibility.patch new file mode 100644 index 000000000000..c7df2eb46759 --- /dev/null +++ b/pkgs/servers/web-apps/peering-manager/fix-pyixapi-0.2.3-compatibility.patch @@ -0,0 +1,30 @@ +From ee558ff66e467412942559a8a92252e3fc009920 Mon Sep 17 00:00:00 2001 +From: Guillaume Mazoyer +Date: Wed, 21 Feb 2024 23:32:32 +0100 +Subject: [PATCH] Use pyixapi 0.2.3 + +--- +diff --git a/extras/models/ixapi.py b/extras/models/ixapi.py +index 65572c971e065e3deed69465a71a54b4e1372851..637a004043e0a044c65a5e37fbb2b3bf82965436 100644 +--- a/extras/models/ixapi.py ++++ b/extras/models/ixapi.py +@@ -7,7 +7,6 @@ + from django.db import models + from django.db.models import Q + from django.urls import reverse +-from django.utils.timezone import make_aware + + from peering_manager.models import ChangeLoggedModel + +@@ -117,9 +116,9 @@ def dial(self): + if auth: + # Save tokens if they've changed + self.access_token = api.access_token.encoded +- self.access_token_expiration = make_aware(api.access_token.expires_at) ++ self.access_token_expiration = api.access_token.expires_at + self.refresh_token = api.refresh_token.encoded +- self.refresh_token_expiration = make_aware(api.refresh_token.expires_at) ++ self.refresh_token_expiration = api.refresh_token.expires_at + self.save() + + return api