qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Michael Roth <mdroth@linux.vnet.ibm.com>
To: marcandre.lureau@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 1/4] qga: add QGA_CONF environment variable
Date: Thu, 01 Oct 2015 15:27:48 -0500	[thread overview]
Message-ID: <20151001202748.32707.78321@loki> (raw)
In-Reply-To: <1441997621-3284-2-git-send-email-marcandre.lureau@redhat.com>

Quoting marcandre.lureau@redhat.com (2015-09-11 13:53:38)
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Having a environment variable allows to override default configuration
> path, useful for testing. Note that this can't easily be an argument,
> since loading config is done before parsing the arguments.

I'd rather this be fixed by adding a config_parse_early() prior
config_load() to handle a command-line specification of config
file path, but I don't object to an environment variable to
specify it in lieu of that so:

> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>

> ---
>  qga/main.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/qga/main.c b/qga/main.c
> index d8e063a..18e1e1d 100644
> --- a/qga/main.c
> +++ b/qga/main.c
> @@ -945,10 +945,11 @@ static void config_load(GAConfig *config)
>  {
>      GError *gerr = NULL;
>      GKeyFile *keyfile;
> +    const char *conf = g_getenv("QGA_CONF") ?: QGA_CONF_DEFAULT;
> 
>      /* read system config */
>      keyfile = g_key_file_new();
> -    if (!g_key_file_load_from_file(keyfile, QGA_CONF_DEFAULT, 0, &gerr)) {
> +    if (!g_key_file_load_from_file(keyfile, conf, 0, &gerr)) {
>          goto end;
>      }
>      if (g_key_file_has_key(keyfile, "general", "daemon", NULL)) {
> -- 
> 2.4.3
> 

  reply	other threads:[~2015-10-01 21:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-11 18:53 [Qemu-devel] [PATCH v2 0/4] qga: add local tests on linux marcandre.lureau
2015-09-11 18:53 ` [Qemu-devel] [PATCH v2 1/4] qga: add QGA_CONF environment variable marcandre.lureau
2015-10-01 20:27   ` Michael Roth [this message]
2015-09-11 18:53 ` [Qemu-devel] [PATCH v2 2/4] qga: do not override configuration verbosity marcandre.lureau
2015-10-01 20:38   ` Michael Roth
2015-09-11 18:53 ` [Qemu-devel] [PATCH v2 3/4] qtest: add a few fd-level qmp helpers marcandre.lureau
2015-09-11 18:53 ` [Qemu-devel] [PATCH v2 4/4] tests: add a local test for guest agent marcandre.lureau
2015-10-01 21:36   ` Michael Roth
2015-10-01 22:24     ` Marc-André Lureau
2015-10-01 23:36       ` Michael Roth
2015-09-25 10:15 ` [Qemu-devel] [PATCH v2 0/4] qga: add local tests on linux Marc-André Lureau

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=20151001202748.32707.78321@loki \
    --to=mdroth@linux.vnet.ibm.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).