[master/rhel7] Ensure media being verified is always unmounted
Vratislav Podzimek
vpodzime at redhat.com
Tue Feb 25 10:27:08 UTC 2014
On Mon, 2014-02-24 at 17:47 -0500, David Shea wrote:
> On 02/24/2014 02:26 PM, David Shea wrote:
> > Exceptions raised in verifyMedia could cause rmdir to be called on the
> > temporary mountpoint before the media is unmounted, causing another
> > error.
> >
> > Resolves: rhbz#1050943
> > ---
> > pyanaconda/image.py | 11 +++++++----
> > 1 file changed, 7 insertions(+), 4 deletions(-)
> >
> > diff --git a/pyanaconda/image.py b/pyanaconda/image.py
> > index 3c154d3..159583f 100644
> > --- a/pyanaconda/image.py
> > +++ b/pyanaconda/image.py
> > @@ -209,11 +209,14 @@ def opticalInstallMedia(devicetree):
> > except FSError:
> > continue
> >
> > - if not verifyMedia(mountpoint):
> > - dev.format.unmount()
> > - continue
> > + try:
> > + if not verifyMedia(mountpoint):
> > + dev.format.unmount()
> > + continue
> >
> > - dev.format.unmount()
> > + dev.format.unmount()
> > + finally:
> > + dev.format.unmount()
> > finally:
> > os.rmdir(mountpoint)
> >
>
> Obviously I should remove the two old unmount calls if I'm adding a new
> one. Fixed locally.
Exactly, the one in the finally block is enough. Otherwise this looks
good to me.
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list