[PATCH 2/3] Define the _device attribute in constructor
Vratislav Podzimek
vpodzime at redhat.com
Fri Jan 23 08:26:47 UTC 2015
On Thu, 2015-01-22 at 09:24 -0500, Anne Mulhern wrote:
>
>
>
> ----- 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.
I see that my yesterday's reply got lost somewhere, but it was something
like:
Good catch, you're right. The issue is that the self._device attribute
is not defined in DeviceFormat.__init__, it's only set via the
self.device property which has the '# pylint: disable'. However, that
only covers that particular case. Sending a new patch instead of this
one that fixes the issue properly.
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list