diff options
author | Francesco Giudici <fgiudici@redhat.com> | 2016-04-18 18:50:56 +0200 |
---|---|---|
committer | Francesco Giudici <fgiudici@redhat.com> | 2016-04-28 09:35:20 +0200 |
commit | 3c67a1ec5e8ef35169bba961faff6bfdfacc1cfa (patch) | |
tree | ad5133335bf887128c6e4f0ec09b51c593df4f63 /clients | |
parent | 0589e659ca1aab76be9ca11e705bef56c3b03f45 (diff) | |
download | NetworkManager-3c67a1ec5e8ef35169bba961faff6bfdfacc1cfa.tar.gz |
cli: remove version check against NM
When performing NM package upgrade the new version of nmcli will be immediately
available while NM daemon will not, as it would not restart in order to avoid
to disrupt connectivity. This could create issues with tools leveraging
on nmcli output (till reboot). As apart from this case it is very unlikely
that a user can have this nmcli / NM daemon version mismatch situation,
the check could cause more harm than benefit in real user case
scenarios.
https://bugzilla.redhat.com/show_bug.cgi?id=1291785
Diffstat (limited to 'clients')
-rw-r--r-- | clients/cli/agent.c | 3 | ||||
-rw-r--r-- | clients/cli/connections.c | 3 | ||||
-rw-r--r-- | clients/cli/devices.c | 3 | ||||
-rw-r--r-- | clients/cli/general.c | 3 | ||||
-rw-r--r-- | clients/cli/nmcli-completion | 5 | ||||
-rw-r--r-- | clients/cli/nmcli.c | 4 | ||||
-rw-r--r-- | clients/cli/nmcli.h | 3 | ||||
-rw-r--r-- | clients/cli/utils.c | 45 | ||||
-rw-r--r-- | clients/cli/utils.h | 1 |
9 files changed, 3 insertions, 67 deletions
diff --git a/clients/cli/agent.c b/clients/cli/agent.c index 0e39ba9721..b8a56d2381 100644 --- a/clients/cli/agent.c +++ b/clients/cli/agent.c @@ -207,9 +207,6 @@ do_agent (NmCli *nmc, int argc, char **argv) nmc->return_value = NMC_RESULT_ERROR_NM_NOT_RUNNING; return nmc->return_value; } - /* Compare NM and nmcli versions */ - if (!nmc_versions_match (nmc)) - return nmc->return_value; if (argc == 0) { nmc->return_value = do_agent_all (nmc, 0, NULL); diff --git a/clients/cli/connections.c b/clients/cli/connections.c index 3fca37f5a1..ee9fe0850b 100644 --- a/clients/cli/connections.c +++ b/clients/cli/connections.c @@ -11051,9 +11051,6 @@ do_connections (NmCli *nmc, int argc, char **argv) nmc->return_value = NMC_RESULT_ERROR_NM_NOT_RUNNING; return nmc->return_value; } - /* Compare NM and nmcli versions */ - if (!nmc_versions_match (nmc)) - return nmc->return_value; /* Get the connection list */ nmc->connections = nm_client_get_connections (nmc->client); diff --git a/clients/cli/devices.c b/clients/cli/devices.c index 449fa7db7d..ec8d235b9c 100644 --- a/clients/cli/devices.c +++ b/clients/cli/devices.c @@ -3670,9 +3670,6 @@ do_devices (NmCli *nmc, int argc, char **argv) nmc->return_value = NMC_RESULT_ERROR_NM_NOT_RUNNING; return nmc->return_value; } - /* Compare NM and nmcli versions */ - if (!nmc_versions_match (nmc)) - return nmc->return_value; if (argc == 0) { if (!nmc_terse_option_check (nmc->print_output, nmc->required_fields, &error)) diff --git a/clients/cli/general.c b/clients/cli/general.c index 15e73e2810..0704688ff5 100644 --- a/clients/cli/general.c +++ b/clients/cli/general.c @@ -345,9 +345,6 @@ show_nm_status (NmCli *nmc, const char *pretty_header_name, const char *print_fl return FALSE; } - if (!nmc_versions_match (nmc)) - return FALSE; - state = nm_client_get_state (nmc->client); startup = nm_client_get_startup (nmc->client); connectivity = nm_client_get_connectivity (nmc->client); diff --git a/clients/cli/nmcli-completion b/clients/cli/nmcli-completion index 7f79180f43..1b1dce3322 100644 --- a/clients/cli/nmcli-completion +++ b/clients/cli/nmcli-completion @@ -178,9 +178,6 @@ _nmcli_compl_OPTIONS() pretty) _nmcli_array_delete_at words 0 ;; - nocheck) - _nmcli_array_delete_at words 0 - ;; ask) _nmcli_array_delete_at words 0 ;; @@ -804,7 +801,7 @@ _nmcli() local COMMAND_CONNECTION_ACTIVE="" HELP_ONLY_AS_FIRST= - local LONG_OPTIONS=(terse pretty mode fields colors escape nocheck ask show-secrets wait version help) + local LONG_OPTIONS=(terse pretty mode fields colors escape ask show-secrets wait version help) _nmcli_compl_OPTIONS i=$? diff --git a/clients/cli/nmcli.c b/clients/cli/nmcli.c index a7f2116175..7e788654d5 100644 --- a/clients/cli/nmcli.c +++ b/clients/cli/nmcli.c @@ -89,7 +89,6 @@ usage (const char *prog_name) " -c[olors] auto|yes|no whether to use colors in output\n" " -f[ields] <field1,field2,...>|all|common specify fields to output\n" " -e[scape] yes|no escape columns separators in values\n" - " -n[ocheck] don't check nmcli and NetworkManager versions\n" " -a[sk] ask for missing parameters\n" " -s[how-secrets] allow displaying passwords\n" " -w[ait] <seconds> set timeout waiting for finishing operations\n" @@ -254,7 +253,7 @@ parse_command_line (NmCli *nmc, int argc, char **argv) } nmc->required_fields = g_strdup (argv[1]); } else if (matches (opt, "-nocheck") == 0) { - nmc->nocheck_ver = TRUE; + /* ignore for backward compatibility */ } else if (matches (opt, "-ask") == 0) { nmc->ask = TRUE; } else if (matches (opt, "-show-secrets") == 0) { @@ -545,7 +544,6 @@ nmc_init (NmCli *nmc) nmc->required_fields = NULL; nmc->output_data = g_ptr_array_new_full (20, g_free); memset (&nmc->print_fields, '\0', sizeof (NmcPrintFields)); - nmc->nocheck_ver = FALSE; nmc->ask = FALSE; nmc->show_secrets = FALSE; nmc->use_colors = NMC_USE_COLOR_AUTO; diff --git a/clients/cli/nmcli.h b/clients/cli/nmcli.h index 1b9a08b800..9048a69f7e 100644 --- a/clients/cli/nmcli.h +++ b/clients/cli/nmcli.h @@ -59,7 +59,7 @@ typedef enum { /* NetworkManager is not running */ NMC_RESULT_ERROR_NM_NOT_RUNNING = 8, - /* nmcli and NetworkManager versions mismatch */ + /* No more used, keep to preserve API */ NMC_RESULT_ERROR_VERSIONS_MISMATCH = 9, /* Connection/Device/AP not found */ @@ -152,7 +152,6 @@ typedef struct _NmCli { char *required_fields; /* Required fields in output: '--fields' option */ GPtrArray *output_data; /* GPtrArray of arrays of NmcOutputField structs - accumulates data for output */ NmcPrintFields print_fields; /* Structure with field indices to print */ - gboolean nocheck_ver; /* Don't check nmcli and NM versions: option '--nocheck' */ gboolean ask; /* Ask for missing parameters: option '--ask' */ gboolean show_secrets; /* Whether to display secrets (both input and output): option '--show-secrets' */ gboolean in_editor; /* Whether running the editor - nmcli con edit' */ diff --git a/clients/cli/utils.c b/clients/cli/utils.c index d05ea2851a..87b37bb1a5 100644 --- a/clients/cli/utils.c +++ b/clients/cli/utils.c @@ -1359,48 +1359,3 @@ print_data (NmCli *nmc) } } -/* -* Compare versions of nmcli and NM daemon. -* Return: TRUE - the versions match (when only major and minor match, print a warning) -* FALSE - versions mismatch -*/ -gboolean -nmc_versions_match (NmCli *nmc) -{ - const char *nm_ver = NULL; - const char *dot; - gboolean match = FALSE; - - g_return_val_if_fail (nmc != NULL, FALSE); - - /* --nocheck option - don't compare the versions */ - if (nmc->nocheck_ver) - return TRUE; - - nmc->get_client (nmc); - nm_ver = nm_client_get_version (nmc->client); - if (nm_ver) { - if (!strcmp (nm_ver, VERSION)) - match = TRUE; - else { - dot = strchr (nm_ver, '.'); - if (dot) { - dot = strchr (dot + 1, '.'); - if (dot && !strncmp (nm_ver, VERSION, dot-nm_ver)) { - g_printerr (_("Warning: nmcli (%s) and NetworkManager (%s) versions don't match. Use --nocheck to suppress the warning.\n"), - VERSION, nm_ver); - match = TRUE; - } - } - } - } - - if (!match) { - g_string_printf (nmc->return_text, _("Error: nmcli (%s) and NetworkManager (%s) versions don't match. Force execution using --nocheck, but the results are unpredictable."), - VERSION, nm_ver ? nm_ver : _("unknown")); - nmc->return_value = NMC_RESULT_ERROR_VERSIONS_MISMATCH; - } - - return match; -} - diff --git a/clients/cli/utils.h b/clients/cli/utils.h index 8047fe7fb3..224acb0cb3 100644 --- a/clients/cli/utils.h +++ b/clients/cli/utils.h @@ -105,6 +105,5 @@ NmcOutputField *nmc_dup_fields_array (NmcOutputField fields[], size_t size, guin void nmc_empty_output_fields (NmCli *nmc); void print_required_fields (NmCli *nmc, const NmcOutputField field_values[]); void print_data (NmCli *nmc); -gboolean nmc_versions_match (NmCli *nmc); #endif /* NMC_UTILS_H */ |