After a discussion this looks valid to me: Because https://github.com/ansible/ansible/blob/v2.4.3.0-1/lib/ansible/modules/packaging/os/apt_repository.py#L542-L544 is in the same try: block of the file saving, any failure would get reported as a failure, but the file wouldn't be reverted to previous state before reporting failure on https://github.com/ansible/ansible/blob/v2.4.3.0-1/lib/ansible/modules/packaging/os/apt_repository.py#L547.
We have the state of before/after, so it should be used for a revert.
After a discussion this looks valid to me: /github. com/ansible/ ansible/ blob/v2. 4.3.0-1/ lib/ansible/ modules/ packaging/ os/apt_ repository. py#L542- L544 is in the same try: block of the file saving, any failure would get reported as a failure, but the file wouldn't be reverted to previous state before reporting failure on https:/ /github. com/ansible/ ansible/ blob/v2. 4.3.0-1/ lib/ansible/ modules/ packaging/ os/apt_ repository. py#L547.
Because https:/
We have the state of before/after, so it should be used for a revert.