Handle connection profiles in a single 'show' command instead of 'show active'
and 'show configured'.
nmcli con show [--active] [[id|uuid|path|apath] <bla>]
nmcli con show : display all connection profiles
nmcli con show --active : only display active connection profiles
(filters out inactive profiles)
nmcli con show myeth : display details of "myeth" profile, and also active
connection info (if the profile is active)
nmcli -f profile con show myeth : only display "myeth"'s static configuration
nmcli -f active con show myeth : only display active details of "myeth"
nmcli -f connection.id,ipv4,general con show myeth
: display "connection.id"a property
"ipv4" setting and "GENERAL" group
of active data
https://bugzilla.redhat.com/show_bug.cgi?id=997999
Use g_weak_ref_get() that either returns an object with reference increment or
returns NULL.
That fixes the problem. However, in the long run we should rework the editor
loop trying to merge that with GMainLoop, which could help for various issues.
https://bugzilla.redhat.com/show_bug.cgi?id=1011942
Now that NMActiveConnection has IP and DHCP config info, use that
directly in "nmcli con show active" rather than getting it from the
connection's device; this way, we get the right info for VPN
connections as well.
That means you can display single property.
Example:
$ nmcli -f connection.id,802-3-ethernet.mtu s c my-eth-profile
connection.id: my-eth-profile
802-3-ethernet.mtu: auto
and use it for 'nmcli device show'.
This allows filtering output not only for whole groups, but also for individual
fields in commands that print data in groups (sections).
Example:
$ nmcli -f general.device,general.driver,ipv4,ipv6.address device show eth0
GENERAL.DEVICE: eth0
GENERAL.DRIVER: e1000e
IP4.ADDRESS[1]: ip = 10.0.5.228/23, gw = 10.0.5.254
IP4.ADDRESS[2]: ip = 5.5.5.5/32, gw = 5.5.5.1
IP4.DNS[1]: 192.168.122.1
IP4.DNS[2]: 8.8.8.8
IP4.DOMAIN[1]: mycompany.com
Note:
Tilde expansion is enabled, so ~/abc<TAB> expands the string to /home/joe/abc.
However, when user did not use the completion and typed "~/myfile" manually,
the path could not be opened.
nmcli 802-1x.ca-cert> set ~/newca.crt
Error: failed to set 'ca-cert' property: Failed to open file '~/newca.crt': No such file or directory
nmcli con add type team config /home/cimrman/team-config.json
libteam (and in turn NetworkManager) configures team devices via plain config
data in JSON format. However, it is useful and more user-friendly for nmcli to
accept also a file name that contains the config data, and read it. Thus the
user is not forced to type whole (possibly long) config on the command line.
Move the checks for nmc_arg_is_help to the beginning of the
checks for command matches.
Up to now, no command begins with 'h', so this has no behavioral
change whatsoever. But imagine a command that begins with 'h'
(for example `nmcli general hostname`), in that case `nmcli general h`
should still show the help, as users might be accustomed to this
abbreviation.
Signed-off-by: Thomas Haller <thaller@redhat.com>
This command allows activating the edited connection.
Monitoring the progress of the activation is a bit complicated by the fact
that the callback activate_connection_editor_cb() is invoked in main loop
thread, and not in the editor thread itself.
https://bugzilla.redhat.com/show_bug.cgi?id=1004883
Plugins may have problems with preserving some properties on write/read cycle,
may add ipv{4,6} settings when they are not present in the connection, etc.
That makes local and remote connection differ.
So we copy remote connection into the local to get rid of such problems.
Note:
68f12b4e9c and
f03635e5ac
commits ensure that all connection (except slaves) have IPv{4,6} settings.
https://bugzilla.redhat.com/show_bug.cgi?id=997958
When freeing one of the collections such as GArray, GPtrArray, GSList,
etc. it is common that the items inside the connections must be
freed/unrefed too.
The previous code often iterated over the collection first with
e.g. g_ptr_array_foreach and passing e.g. g_free as GFunc argument.
For one, this has the problem, that g_free has a different signature
GDestroyNotify then the expected GFunc. Moreover, this can be
simplified either by setting a clear function
(g_ptr_array_set_clear_func) or by passing the destroy function to the
free function (g_slist_free_full).
Signed-off-by: Thomas Haller <thaller@redhat.com>
- completion now works for command shortcuts too
nmcli> g ethe<TAB>
- completion now allows leading spaces
nmcli> desc wifi.ss<TAB>
- fix completion of settings when property is already there
nmcli> set con<TAB>.id
- fix completion of properties in setting.property
nmcli> des con.inter<TAB> bla
The session now looks like this:
There are optional arguments for 'bond' connection type.
Do you want to provide them? (yes/no) [yes]
Bonding mode [balance-rr]:
Bonding monitoring mode (miimon or arp) [miimon]: miimon
Bonding miimon [100]:
Bonding downdelay [0]:
Bonding updelay [0]:
...when answered arp...
Bonding arp-interval [0]:
Bonding arp-ip-target [none]:
https://bugzilla.redhat.com/show_bug.cgi?id=1007355