[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] pygrub: verify chosen kernel really exists
On Fri, 2012-06-22 at 19:37 +0100, Andrew Cooper wrote: > > diff -r 32034d1914a6 tools/pygrub/src/pygrub > --- a/tools/pygrub/src/pygrub > +++ b/tools/pygrub/src/pygrub > @@ -821,10 +821,15 @@ if __name__ == "__main__": > if not fs: > raise RuntimeError, "Unable to find partition containing > kernel" > > + # Does the chosen kernel really exist ? > + try: > + data = fs.open_file(chosencfg["kernel"]).read() If you make this use .exists() and left the open/read where it was that would be more in keeping with the intended meaning of the not_really flag. > + except: > + raise RuntimeError, "The chosen kernel does not exist" > + > if not_really: > bootcfg["kernel"] = "<kernel:%s>" % chosencfg["kernel"] > else: > - data = fs.open_file(chosencfg["kernel"]).read() > (tfd, bootcfg["kernel"]) = > tempfile.mkstemp(prefix="boot_kernel.", > > dir=output_directory) > os.write(tfd, data) _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |