Re: [PATCH] core: Honor CLI arguments when config file is not found



On Tue, 2013-01-29 at 11:12 -0200, Jonh Wendell wrote:
> If the config file is not present, the Config object is
> returned empty, even if some configs were passed as command
> line arguments.
> 
> This patch honor these arguments in that case.
> 
> Signed-off-by: Jonh Wendell <jonh wendell oiwifi com br>

Thanks, I've slightly reworked this patch to reduce some of the code in
NMConfig and rebased on top of Thomas' for converting it to an object.
It's now pushed to the dcbw/config branch awaiting review.

Thanks!
Dan

> ---
>  src/nm-config.c |   19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/src/nm-config.c b/src/nm-config.c
> index 6e801d3..f96eeed 100644
> --- a/src/nm-config.c
> +++ b/src/nm-config.c
> @@ -268,6 +268,25 @@ nm_config_new (const char *cli_config_path,
>          config->path = g_strdup (NM_DEFAULT_SYSTEM_CONF_FILE);
>          fprintf (stderr, "No config file found or given; using %s\n",
>                   NM_DEFAULT_SYSTEM_CONF_FILE);
> +
> +        /* Honor CLI parameters */
> +        if (cli_plugins && *cli_plugins)
> +            config->plugins = g_strsplit_set (cli_plugins, ",", 0);
> +
> +        if (cli_log_level && *cli_log_level)
> +            config->log_level = g_strdup (cli_log_level);
> +
> +        if (cli_log_domains && *cli_log_domains)
> +            config->log_domains = g_strdup (cli_log_domains);
> +
> +        if (cli_connectivity_uri && *cli_connectivity_uri)
> +            config->connectivity_uri = g_strdup
> (cli_connectivity_uri);
> +
> +        if (cli_connectivity_interval >= 0)
> +            config->connectivity_interval =
> cli_connectivity_interval;
> +
> +        if (cli_connectivity_response && *cli_connectivity_response)
> +            config->connectivity_response = g_strdup
> (cli_connectivity_response);
>      }
>  
>      /* ignore error if config file not found */
> _______________________________________________
> networkmanager-list mailing list
> networkmanager-list gnome org
> https://mail.gnome.org/mailman/listinfo/networkmanager-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]