[PATCH 2/3] Define the _device attribute in constructor

Anne Mulhern amulhern at redhat.com
Thu Jan 22 14:24:40 UTC 2015





----- Original Message -----
> From: "Vratislav Podzimek" <vpodzime at redhat.com>
> To: anaconda-patches at lists.fedorahosted.org
> Sent: Wednesday, January 21, 2015 5:50:35 AM
> Subject: [PATCH 2/3] Define the _device attribute in constructor
> 
> That's how good guys do it.
> 
> Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
> ---
>  blivet/formats/fs.py | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
> index ad2542a..4bee167 100644
> --- a/blivet/formats/fs.py
> +++ b/blivet/formats/fs.py
> @@ -1443,6 +1443,10 @@ class NFS(FS):
>      _type = "nfs"
>      _modules = ["nfs"]
>  
> +    def __init__(self, *args, **kwargs):
> +        super(NFS, self).__init__(*args, **kwargs)
> +        self._device = None
> +
>      def _deviceCheck(self, devspec):
>          if devspec is not None and ":" not in devspec:
>              raise ValueError("device must be of the form <host>:<path>")
> --
> 2.1.0
> 
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> 

I believe that:

Superclass ctr is automatically invoked if there is no ctr defined,
and DeviceFormat.__init__() sets self._device to None if no device passed
via constructor.

So, the only reason for this code to exist would be to enforce that NFS filesystem
format should always have a device of None, even if a device is passed.

I don't see why that should be the case for NFS.

- mulhern



More information about the anaconda-patches mailing list