juju/juju — pull request #878 by dimitern (2014-10-02 11:39:14+00:00)
Title: uniter: open-port and close-port now sandboxed and validated

An important improvement in supporting opening and
closing port ranges for charms is to also provide
sandboxing for these operations. This PR implements
an internal caching of all pending port ranges to
open or close for the unit, as well as existing ports
opened on the unit's assigned machine by other units.
Each time open-port or close-port is called, we validate
the given range against other existing ranges on the
machine and other pending ranges and returns errors
when there's a conflict. Ports are only actually opened
or closed when the current hook is committed.

NOTE: This was proposed as WIP as dimitern:#5 and was
reviewed as http://reviews.vapour.ws/r/125/. After
fixing some suggestions from reviews, now proposing
against juju:master