[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] tools/pygrub: store kernels in /var/run/pygrub
On 17/04/14 11:52, Olaf Hering wrote: > Move location of temporary bootfiles from /var/run/xend/boot to > /var/run/pygrub. If the directory does not exist create it, unless > --output-directory=<dir> was specified. > > The reason for this change is that all entrys below /var/run have to be > created at runtime in case /var/run is cleared on every boot. > > Signed-off-by: Olaf Hering <olaf@xxxxxxxxx> > --- > > New code not runtime tested as pygrub, just as hello_world.py... I don't think it is valid in the slightest for programs like this to be mkdir()ing their environment. It is very much a packaging responsibility. > > tools/pygrub/src/pygrub | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > > diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub > index 54fecee..a89fd49 100644 > --- a/tools/pygrub/src/pygrub > +++ b/tools/pygrub/src/pygrub > @@ -14,6 +14,7 @@ > # > > import os, sys, string, struct, tempfile, re, traceback > +import errno > import copy > import logging > import platform > @@ -757,7 +758,7 @@ if __name__ == "__main__": > debug = False > not_really = False > output_format = "sxp" > - output_directory = "/var/run/xend/boot" > + output_directory = None > > # what was passed in > incfg = { "kernel": None, "ramdisk": None, "args": "" } > @@ -813,6 +814,16 @@ if __name__ == "__main__": > if debug: > logging.basicConfig(level=logging.DEBUG) > > + if output_directory is None: > + output_directory = "/var/run/pygrub" > + try: > + os.mkdir(output_directory, 0700) > + except OSError as exc: This is only valid for python 2.5 (or possibly 2.6). You want except OSError,exc: for 2.4 compatibility. ~Andrew > + if exc.errno == errno.EEXIST and os.path.isdir(output_directory): > + pass > + else: > + raise > + > if output is None or output == "-": > fd = sys.stdout.fileno() > else: > > _______________________________________________ > Xen-devel mailing list > Xen-devel@xxxxxxxxxxxxx > http://lists.xen.org/xen-devel _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |