If you do what I describe then your #5 would fail and the script would set it back to the original.
The issue is that MAAS should verify that it can communicate to that BMC. The ultimate workflow would be this.
1. Save the password
2. Change the password
3. Update MAAS with that password
4. MAAS performs a power check
5. Script polls MAAS until a valid power check occurred
6. If #5 fails revert back to #1.
If you do what I describe then your #5 would fail and the script would set it back to the original.
The issue is that MAAS should verify that it can communicate to that BMC. The ultimate workflow would be this.
1. Save the password
2. Change the password
3. Update MAAS with that password
4. MAAS performs a power check
5. Script polls MAAS until a valid power check occurred
6. If #5 fails revert back to #1.