fabric/fabric — pull request #524 by sjmh (2012-01-06 05:30:07+00:00)
Title: Fixes #518. Modifies AliasDict to allow for nested roles.

Here's a second shot at this.

I modified AliasDict to no longer require the 'aliases' attribute to allow nesting, while keeping it's value setting 'shortcut' abilities used by outputs. I decided against trying to use 'aliases' because:

a) It allowed for a seamless integration with the current role merge. No code in task_utils.py had to be modified.
b) The 'aliases' doesn't seem to gel well with the the idea of nested roles. How would you determine which roles should be in the 'aliases' attribute and which should be in the main dict? If you only put hosts in the dict, then you'd have to duplicate the hosts in the values for each key in the aliases attribute.

The only caveat to the implementation is that you cannot re-assign a key to a non-iterable if the key's value is already an iterable. This didn't seem to be too big of an issue ( you can simply delete and assign ) and it does allow for reassignment to another iterable.

I put in a few more test cases as well to ensure that the nesting of the roles was working properly as well as fixing the cases for outputs to allow for the new syntax.

Comments, flames, accusing fingers are welcome. :)