From 3745426e7712674cd54c6de943283536fc990d42 Mon Sep 17 00:00:00 2001 From: James Garner Date: Wed, 4 Dec 2024 17:42:25 +1300 Subject: [PATCH] fix: don't warn about key file on remove --- lib/charms/operator_libs_linux/v0/apt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/charms/operator_libs_linux/v0/apt.py b/lib/charms/operator_libs_linux/v0/apt.py index 6d14514f..92fa63de 100644 --- a/lib/charms/operator_libs_linux/v0/apt.py +++ b/lib/charms/operator_libs_linux/v0/apt.py @@ -1467,7 +1467,7 @@ def _add_repository( ) -> None: line = _repo_to_line(repo, include_signed_by=False) key_file = repo.gpg_key - if key_file and not os.path.exists(key_file): + if key_file and not remove and not os.path.exists(key_file): msg = ( "Adding repository '{line}' with add-apt-repository." " Key file '{key_file}' does not exist."