From d9f90b7fd7fe63631cc7bdb5fabe6de7c57468e6 Mon Sep 17 00:00:00 2001 From: Matthijs Mekking Date: Tue, 29 Jul 2025 09:22:00 +0200 Subject: [PATCH] Allow for lifetime not set in state file When migrating to dnssec-policy, keys that do not match will not have a lifetime set. Adjust the test code to allow for that. Setting '-' in a key properties string signals lifetime is expected not to be set. (cherry picked from commit 89e90c30f89fc129b31b76768881f266087bf08a) --- bin/tests/system/isctest/kasp.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bin/tests/system/isctest/kasp.py b/bin/tests/system/isctest/kasp.py index cb6b56c808..13bdbf9e24 100644 --- a/bin/tests/system/isctest/kasp.py +++ b/bin/tests/system/isctest/kasp.py @@ -237,13 +237,13 @@ class KeyProperties: self.timing["PublishCDS"] = self.timing["Published"] + ipubc - if self.metadata["Lifetime"] != 0: + if "Lifetime" in self.metadata and self.metadata["Lifetime"] != 0: self.timing["DeleteCDS"] = ( self.timing["PublishCDS"] + self.metadata["Lifetime"] ) def Iret(self, config): - if self.metadata["Lifetime"] == 0: + if "Lifetime" not in self.metadata or self.metadata["Lifetime"] == 0: return iret = Iret(config, zsk=self.key.is_zsk(), ksk=self.key.is_ksk()) @@ -277,7 +277,7 @@ class KeyProperties: self.IpubC(config) # Set Retired timing metadata if key has lifetime. - if self.metadata["Lifetime"] != 0: + if "Lifetime" in self.metadata and self.metadata["Lifetime"] != 0: self.timing["Retired"] = self.timing["Active"] + self.metadata["Lifetime"] self.Iret(config) @@ -1493,8 +1493,9 @@ def policy_to_properties(ttl, keys: List[str]) -> List[KeyProperties]: keyprop.properties["dnskey_ttl"] = ttl keyprop.metadata["Algorithm"] = line[2] keyprop.metadata["Length"] = line[3] - keyprop.metadata["Lifetime"] = 0 - if line[1] != "unlimited": + if line[1] == "unlimited": + keyprop.metadata["Lifetime"] = 0 + elif line[1] != "-": keyprop.metadata["Lifetime"] = int(line[1]) for i in range(4, len(line)):