Commit Graph

23 Commits

Author SHA1 Message Date
Thomas Haller
64f1e78e28 cli: drop NMCTriStateValue for NMTernary 2018-08-10 10:38:19 +02:00
Beniamino Galvani
53c2951f61 device: configure SR-IOV 2018-07-11 16:16:22 +02:00
Thomas Haller
6f8f7ad597 cli: rework enum-to-string function to not return translated text
There are cases, where we need the untranslated text.

There is no change of behavior of this patch, because all
callers now explicitly call gettext().
2018-07-09 15:43:55 +02:00
Beniamino Galvani
1f7780cba9 cli: fix property matching
@ret was not initialized when there was only one partial match.

Also, refactor the code to return all matching values.

Fixes: 3fd9bf9d7d

https://github.com/NetworkManager/NetworkManager/pull/123
2018-05-28 11:33:40 +02:00
Lubomir Rintel
3fd9bf9d7d clients: fix an error message in case of property ambiguity
Before:

  $ nmcli c modify Dukkha ipv4.ignore no
  Error: invalid property 'ignore': 'ignore' is ambiguous (ignore-auto-routes x (null)).

After:

  $ nmcli c modify Dukkha ipv4.ignore no
  Error: invalid property 'ignore': 'ignore' is ambiguous (ignore-auto-routes x ignore-auto-dns).
2018-05-24 18:39:11 +02:00
Thomas Haller
2f50c8d915 clients/common: add nmc_objects_sort_by_path() helper 2018-05-14 17:53:03 +02:00
Thomas Haller
684bf31150 all: unify spelling of translators hint in source code
Use the same form everywhere: "TRANSLATORS" instead of "Translators".
The manual also seems to prefer the upper-case form [1].

  $ sed 's/\<Translators\>: /TRANSLATORS: /g' $(git grep -l Translators) -i

[1] https://www.gnu.org/software/gettext/manual/gettext.html
2018-04-13 10:00:09 +02:00
Francesco Giudici
38844e6c5e client: fix nmc_string_is_valid ambiguous detection
when input matched the heading of two allowed values the match was
reported as ambiguous without checking if there was a perfect match
following: fixed.

Example of a failing input:
const char **allowed = [ "ipv4, ipv6, ip" ];
const char *input = "ip";

"ip" was detected as ambiguous.
2018-02-12 10:42:58 +01:00
Beniamino Galvani
aa820e9386 all: add more meaningful error code for unsupported IP method
Add a new device state reason code for unsupported IP method. It is
returned, for example, when users select manual IP configuration for
WWAN connections:

 # nmcli connection mod Gsm ipv4.method manual ipv4.address 1.2.3.4/32
 # nmcli connection up Gsm
 Error: Connection activation failed: The selected IP method is not
 supported

compared to the old:

 Error: Connection activation failed: IP configuration could not be
 reserved (no available address, timeout, etc.)

Note that we could instead fail the connection validation if the
method is not supported by the connection type, but adding such
limitation now could make existing connections invalid.

https://bugzilla.redhat.com/show_bug.cgi?id=1459529
2017-12-21 10:02:07 +01:00
Lubomir Rintel
9d95e1f175 clients/cli: use a nicer password prompt
Makes sense in order for the user to know that they're actually typing
the password (edited just to illustrate the point, the actual output was
shamefully messy and perhaps needs fixing too):

  $ nmcli c up Wrathmosphere
  Passwords or encryption keys are required to access the wireless network 'Wrathmosphere'.
  Password (802-1x.password): *********
2017-12-18 14:47:37 +01:00
Lubomir Rintel
9e4de97967 libnm-core: move detection of UTF-8 capable terminals to clients/
Having it in libnm doesn't make any sense and prevents using it for more
internal functionality.

Too bad nm_utils_wifi_strength_bars() is already a public API.
No problem -- replace it with a compatible yet dumber equivalent.
2017-12-18 14:47:37 +01:00
Thomas Haller
5d3736ac65 cli: drop nmc_strsplit_set()
In most cases, it copies the entire strv needlessly.
We can do better.

Also, the max_tokens argument is handled wrongly (albeit
not used anywhere anymore).
2017-12-12 15:19:43 +01:00
Beniamino Galvani
12a49cbdc7 device: add a new state-reason for DAD failures 2017-11-09 22:26:17 +01:00
Lubomir Rintel
d0cb2050f3 all: add OVSDB connection failure device state reason 2017-10-30 17:40:09 +01:00
Lubomir Rintel
4391ba82dd cli/trivial: drop default branch from some cases
This way not handling a known enum value will be caught by a compiler
warning.
2017-10-30 17:38:37 +01:00
Beniamino Galvani
1824cc9e3f clients: move get_effective_activation_state() to nm-clients-utils.c 2017-10-16 17:26:49 +02:00
Beniamino Galvani
aa964ae969 build: move nm-client-utils.c to libnmc-base.a
In a later commit we'll add a new generic client function used by
nmcli and nmtui. nm-client-utils.c seems the right place for it, so
move the file to the base library that is used by both clients.

While at it, also put in that file some functions that will be needed
by nmtui.
2017-10-16 17:25:35 +02:00
Thomas Haller
8c87a4b8a8 clients: replace nmc_string_to_int() by _nm_utils_ascii_str_to_int64() 2017-05-23 13:37:10 +02:00
Thomas Haller
9a3e35cc0e clients: don't use nmc_string_to_int_base() and nmc_string_to_uint_base() util
They are redundant.
2017-05-23 13:37:10 +02:00
Thomas Haller
0b7e9c3bef cli: move prompting for boolean values to meta data
This changes behavior, in that yes|no prompt and answer is no longer
localized.

For command line arguments, I think it is always wrong for nmcli to
behave differently based on the localization. That is, input properties
on command line should not be translated.

One could make an argument, that in interactive mode that is different
and the user can be prompted in the his language.

But I think for consistency, it is wrong to ask for localized nmcli input.
2017-04-12 14:12:19 +02:00
Thomas Haller
bb40abb3de cli: move nmc_bond_validate_mode() to "clients/common/nm-client-utils.h"
"clients/common/nm-client-utils.h" already contains other nmc_* validation functions.
It's the better place for nmc_bond_validate_mode()
2017-04-05 16:53:06 +02:00
Thomas Haller
d1c6d64e6a shared: move _nm_utils_strv_cleanup() to shared utils 2017-04-05 16:53:06 +02:00
Thomas Haller
23298bfc88 cli: move utils function from common.h to nm-meta-setting-desc.c
These functions are only used by nm-meta-setting-desc.c. Make them internal.
Unfortunately, they are part of "common.h" which cannot be used without
the rest of nmcli. Still todo.
2017-03-30 13:09:58 +02:00