[SE-2497] Avoid sending deployment failure emails if deployment triggered by OpenCraft members
Avoid sending deployment failure emails if deployment triggered by OpenCraft members. Apply changes made in #633 to implement conditional email sending.
Dependencies: None
Merge deadline: None
Testing instructions:
Assuming you already installed and setup OCIM locally and you registered to your local OCIM installation as a regular user would do.
- Create a new deployment from the new interface, make it fail and check email is sent
- Redeploy instances using instance_redeploy command and check that email is not sent
- Create a new deployment from the manage site and check that no email is sent if it fails
Author notes and concerns:
- Added logging for skipped emails to ensure no email sending skipped without any traces.
- Unit tests are not really unit tests for this scenario, since the signal itself is not tested and during the instance tests, the signal is not mocked, but I can live with this. The possible solution: refactor the tests for the
OpenEdxInstance
model but that would blow up the scope of this task. This is valid for the management command test as well.
Closes #633