andymcc/ansible-lxc-rpc — pull request #3 by matthewoliver (2014-10-09 06:01:52+00:00)
Title: Add a validation step before any rings are touched

This change changes the algorithm a little, the ring builder now
gathers all the information about what rings to build and instead
of calling build_ring straight away it adds the options for the call
to a ring_calls list.
Once all build calls are added to this list we loop through and call
build_rings but with validate=True, which is like a dry run. When an
error is detected a RingValidationError is raised.

The errors its looking for is:

- Modification of zone or region in existing drives.
- Change of part_power.
- And any exceptions raised while attempting to print integers.

If this validation step passes (no error raised) the we loop and call
build_ring again without the validate option.

The benefit of this approach is all the rings are "validated" before
any buildfiles are modified/created. So if a user gets an error we
know the current state of the rings/builders are untouched.

A validation error causes the script to return a 2. Seeing as this
is >0 ansible _should_ see it as a failure.