alphagov/vcloud-tools — pull request #82 by mikepea (2013-12-21 17:32:58+00:00)
Title: Restructure Vapp class to be immutable

* Improve vapp_spec readability and highlight public Class and Instance interface
* Remove now-unneccessary reload() method, since we no longer keep state to reload
* Move methods that find or create Vapps into the class, returning vapp instances

The main purpose of this commit is to remove any mutable state from the class, specifically the handling of @vcloud_attributes.

Previously, we were in effect caching the output of get_vapp into @vcloud_attributes, but not really handling the fact that the state of the Vapp could change underneath us. Notionally the reload() method allowed us to update our inner state, but not consistently.

Also have removed @fog_interface from the state, since this hold onto Fog objects and (tbc) does not handle the case when a session token expires (Fog may do this automatically though)

In the process, have also been pushed the methods that find and create Vapps into the class, effectively as factory methods. They should definitely not be instance methods, but arguably can be later farmed out into a separate vapp factory class.