The Big Rename - why?
Update
Due to unforeseen circumstances I will not be able to continue work on this until Monday, so we will have to extend the freeze until Tuesday the 17th.
The following message will be put on the patches affected by the freeze.
big-rename-2-update-message.txt (Source)
Due to unforeseen circumstances I will not be able to continue work on this until Monday, so we will have to extend the freeze until Tuesday the 17th. On Tuesday 2015-11-17 this -2 will be removed, and code review as normal will continue. I apologise for the delay, and will get this completed ASAP. Further updates will be posted to http://graham.hayes.ie/posts/the-big-rename/
The Big Rename
So from tomorrow (2015-11-10) until Friday (2015-11-13) Designate will be frozen for new code.
I send an email to the openstack-dev list before the summit [2] so, it shouldn't be a surprise (I hope)
So, why are we doing this?
When Designate started it had a v1 API, which used the term domains for DNS Domains. This was pre Keystone's Domain support, but unfortunately they also decided to use it. AS Designate was not even incubated at the time, there was not much we could do, but continue on.
When we started the v2 API, we decided to avoid confusion and expose "Domains" as "Zones".
This worked for a while, but as we worked on the V2 API, we had to write code to translate the internal code (which referenced Domains) to Zones. this caused code like:
def _render_object(cls, object, *args, **kwargs): # The dict we will return to be rendered to JSON / output format r_obj = {} # Loop over all fields that are supposed to be output for key, value in cls.MODIFICATIONS['fields'].items(): # Get properties for this field field_props = cls.MODIFICATIONS['fields'][key] # Check if it has to be renamed if field_props.get('rename', False): obj = getattr(object, field_props.get('rename')) # if rename is specified we need to change the key obj_key = field_props.get('rename') else: # if not, move on obj = getattr(object, key, None) obj_key = key
and
big-rename-error-render.py (Source)
@classmethod def _rename_path_segment(cls, obj_adapter, object, path_segment): # Check if the object is a list - lists will just have an index as a # value, ands this can't be renamed if issubclass(obj_adapter.ADAPTER_OBJECT, objects.ListObjectMixin): obj_adapter = cls.get_object_adapter( cls.ADAPTER_FORMAT, obj_adapter.ADAPTER_OBJECT.LIST_ITEM_TYPE.obj_name()) # Return the segment as is, and the next adapter (which is the # LIST_ITEM_TYPE) return path_segment, obj_adapter for key, value in obj_adapter.MODIFICATIONS.get( 'fields', {}).items(): # Check if this field as actually a nested object if object.FIELDS.get(path_segment, {}).get('relation', False): obj_cls = object.FIELDS.get(path_segment).get('relation_cls') obj_adapter = cls.get_object_adapter( cls.ADAPTER_FORMAT, obj_cls) object = objects.DesignateObject.obj_cls_from_name(obj_cls)() # Recurse down into this object path_segment, obj_adapter = cls._rename_path_segment( obj_adapter, object, path_segment) # No need to continue the loop break if not isinstance( value.get( 'rename', NotSpecifiedSential()), NotSpecifiedSential)\ and path_segment == value.get('rename'): # Just do the rename path_segment = key return path_segment, obj_adapter
which proved to be quite fragile. (Yes that last bit of code is trying to walk the error path of a JSONSchema Error and rename the path to the new terminology)
We are also logging messages about domains - which could prove to be quite confusing when we remove the v1 API and users are only interacting with zones.
So tomorrow morning-ish (UTC) we will start to rename every occurrence of "domain" in the code base to "zone" (without breaking Keystone domain support).
Anything that does not have the "the-big-rename" topic on Gerrit will be getting a procedural -2 from me or the designate-core team.
big-rename-2-message.txt (Source)
Currently Designate is undergoing a code freeze to allow us re-factor the code base, as announced here: - http://lists.openstack.org/pipermail/openstack-dev/2015-October/077442.html All code that is not in the "the-big-rename" topic will be getting this procedural -2. More information can be found here: - http://graham.hayes.ie/posts/the-big-rename/ On Friday 2015-11-13 this -2 will be removed, and code review as normal will continue. This re-factor will break the majority of patches that are outstanding, and you may need to manually rebase your patch when we remove the -2.
Comments
Comments powered by Disqus