All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Olaf Hering <olaf@aepfle.de>
Cc: Ian.Jackson@eu.citrix.com, Ian.Campbell@citrix.com,
	xen-devel@lists.xen.org
Subject: Re: [PATCH] tools/pygrub: store kernels in /var/run/pygrub
Date: Thu, 17 Apr 2014 11:57:07 +0100	[thread overview]
Message-ID: <534FB383.5060806@citrix.com> (raw)
In-Reply-To: <1397731926-29636-1-git-send-email-olaf@aepfle.de>

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@aepfle.de>
> ---
>
> 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@lists.xen.org
> http://lists.xen.org/xen-devel

  reply	other threads:[~2014-04-17 10:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-17 10:52 [PATCH] tools/pygrub: store kernels in /var/run/pygrub Olaf Hering
2014-04-17 10:57 ` Andrew Cooper [this message]
2014-04-17 11:07   ` Olaf Hering
2014-04-17 11:33   ` David Vrabel
2014-04-17 18:18 ` Ian Jackson
2014-04-22  8:45   ` Ian Campbell
2014-04-22 12:55   ` Olaf Hering
2014-04-22 13:55     ` Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=534FB383.5060806@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=olaf@aepfle.de \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.