diff --git a/lib/charms/operator_libs_linux/v0/apt.py b/lib/charms/operator_libs_linux/v0/apt.py index 6d14514..92fa63d 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."