andsens / build-debian-cloud

This project has been superseeded by andsens/bootstrap-vz and is no longer maintained - Script to create Debian Squeeze & Wheezy Amazon Machine Images (AMIs) and Google Compute Engine images
Other
116 stars 43 forks source link

Rename before=[] and after=[] #107

Closed andsens closed 10 years ago

andsens commented 10 years ago

The task properties before and after are really confusing. The description of these properties would be.

before describes which tasks the task at hand should run before, while after describes the ones it should run after.

However, one could also write the opposite, and it would still make sense (though being completely wrong).

before describes tasks that should run before the task at hand, while after describes the ones that should run after it.

Point is, the property names do not clarify anything, they actually just make it confusing. Additionally the before is currently place over the after line, instead the task order should be reflected in the reading order.

We could use run_after and run_before, but the essential problem is that the words describe the relation between the task at hand and the tasks in the lists instead of describing what the tasks in the lists are. I think predecessors and successors are a better fit. The MapPartitions would then look like this.

class MapPartitions(Task):
        description = 'Mapping volume partitions'
        phase = phases.volume_preparation
        predecessors = [PartitionVolume]
        successors = [filesystem.Format]

        def run(self, info):
                info.volume.partition_map.map(info.volume)