[PATCH 3/5] Pass information about old and new device as a dictionary

Vratislav Podzimek vpodzime at redhat.com
Thu Apr 10 20:15:21 UTC 2014


On Thu, 2014-04-10 at 11:52 -0700, Brian C. Lane wrote:
> On Fri, Apr 04, 2014 at 09:54:21PM +0200, Vratislav Podzimek wrote:
> 
> 
> > -    def _try_replace_device(self, device_type, size, fs_type, disks, mountpoint,
> > -                            label, raid_level, encrypted, name, container_name,
> > -                            container_encrypted, container_raid_level, container_size,
> > -                            device, selector, old_device_type, old_disks, old_fs_type,
> > -                            old_mountpoint, old_label, old_raid_level, old_encrypted,
> > -                            old_name, old_container_name, old_container_encrypted,
> > -                            old_container_raid_level, old_container_size):
> 
> This is certainly an improvement. I wonder if we can do better than
> passing a dict though. A problem with using dict is that you lose all
> the information about what the method expects from what it is being
> passed -- you end up having to look at the code to see what keys are
> being used.
> 
> An object dedicated to holding all of this information, with docstrings,
> enforcement of keys (required keys, extra keys allowed/disallowed) might
> make it easier to maintain in the future. A subclass of dataholder with
> pre-defined keys like a named tuple maybe?
Yeah, I was thinking about something like that. Adding it to my "Custom
Spoke TODO". 

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list