Commit Graph

389 Commits

Author SHA1 Message Date
Jiří Klimeš
26f8889286 cli: consolidate active and configured connections (rh #997999)
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
2014-01-23 13:45:46 +01:00
Jiří Klimeš
6b19d530e8 cli: always get up-to-date dirty status 2014-01-21 16:39:43 +01:00
Jiří Klimeš
92939e6919 cli: fix crash when edited profile was removed by another client (rh #1011942)
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
2014-01-21 16:36:00 +01:00
Jiří Klimeš
07adfe4de4 cli: fix TAB-completion and 'goto' after saving connection
On 'save' we replace settings in the local connection, so we also need to
update stored setting pointers.
2014-01-20 17:38:11 +01:00
Dan Winship
e9fe63cdaa trivial: annotate/adjust some code to appease Coverity 2014-01-16 14:23:45 -05:00
Jiří Klimeš
a6432ef4d1 cli: fix printing error on incorrect 'nmcli -f blah dev show'
Don't print extra empty lines before the error.
2014-01-10 13:21:27 +01:00
Thomas Haller
446516bcfa cli/bash-completion: trivial rename of functions
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-10 12:12:13 +01:00
Thomas Haller
e59be00d93 cli/bash-completion: add second level help option
Commands now support help at the second level. Add completion for it.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-10 12:12:13 +01:00
Thomas Haller
b4d9958b76 cli/bash-completion: only complete active connections for nmcli con down
Only complete the ids/uuids for active connections in
`nmcli connection down <type> <TAB>`.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-10 12:12:13 +01:00
Thomas Haller
8c659b79ed cli/bash-completion: cleanup/refactor by making functions generic
Instead of having several bash functions that return some values
via nmcli, add few functions that accept parameters.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-10 12:12:13 +01:00
Thomas Haller
aa931ab1f2 cli/bash-completion: fix wrong completion for nmcli device wimax
wimax does not support these arguments. This was a copy&paste error from wifi.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-10 12:11:43 +01:00
Thomas Haller
630a1ccbce cli/bash-completion: remove not yet implemented device type 'adsl'
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-10 11:10:03 +01:00
Jiří Klimeš
e44bb5e6fc cli: add 'help' for second level commands (bgo #698237) (rh #1034119)
In addition to 'nmcli connection help', you can now use:
nmcli con up help
nmcli con down help
nmcli dev wifi help
etc.

The help option can also be in the form of --help/-h, or even shortened.

https://bugzilla.gnome.org/show_bug.cgi?id=698237
https://bugzilla.redhat.com/show_bug.cgi?id=1034119
2014-01-09 10:14:03 +01:00
Thomas Haller
3051a908a9 cli: fix leaks for getter functions (release GValue)
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-08 14:29:19 +01:00
Jiří Klimeš
3668fd7cbc cli: display MTU for devices 2013-12-20 11:37:54 +01:00
Jiří Klimeš
e3bd575758 cli: simplify getting device hardware addresses 2013-12-20 11:37:54 +01:00
Jiří Klimeš
f889440b96 cli: more compact format for device info (nmcli device show) (rh #998003)
https://bugzilla.redhat.com/show_bug.cgi?id=998003
2013-12-20 11:37:54 +01:00
Dan Winship
f1f4f32c02 cli: get IP/DHCP config directly from the NMActiveConnection (rh #1036132)
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.
2013-12-19 11:49:50 -05:00
Thomas Haller
7fa79fcc5e cli: add pppoe type to nmcli bash completion
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-18 16:50:59 +01:00
Jiří Klimeš
107fdd6b01 cli: support PPPoE connection types in 'nmcli con add' 2013-12-18 16:45:59 +01:00
Jiří Klimeš
80851c3550 cli: consider empty value as "*" for "Interface name [*]: " prompt (rh #953397)
And, do it right this time.

https://bugzilla.redhat.com/show_bug.cgi?id=953397
2013-12-18 16:10:48 +01:00
Jiří Klimeš
340542a2f2 Revert "cli: consider empty value as "*" for "Interface name: " prompt"
This reverts commit 3cb0bf6bc0.
It broke 'ifname' being required as a mandatory parameter as decided in
https://bugzilla.gnome.org/show_bug.cgi?id=698113
2013-12-18 16:05:37 +01:00
Jiří Klimeš
d79b56a7e9 cli: 'id' option for 'nmcli con add type vlan' is mandatory (rh #953397)
So update documentation accordingly.

https://bugzilla.redhat.com/show_bug.cgi?id=953397
2013-12-18 15:49:10 +01:00
Jiří Klimeš
abaa17edb9 cli: fix compilation without WiMAX 2013-12-17 14:55:13 +01:00
Jiří Klimeš
4ef8696c77 cli: allow '--field group.field' for nmcli con show conf <bla>
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
2013-12-17 13:52:11 +01:00
Jiří Klimeš
990f83b7d3 cli: allow '--field group.field' for nmcli con show active <bla>
Example:
$ nmcli -f general.name,ip4.address c s a myeth
GENERAL.NAME:                           myeth
IP4.ADDRESS[1]:                         ip = 10.34.25.228/23, gw = 10.34.25.254
2013-12-17 13:52:02 +01:00
Jiří Klimeš
94bb83a370 cli: allow specifying 'group.name' syntax for '--fields'
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
2013-12-17 13:51:34 +01:00
Jiří Klimeš
bec69e175c cli: fix bash-completion for nmcli connection load (rh #1036545)
https://bugzilla.redhat.com/show_bug.cgi?id=1036545
2013-12-17 13:23:38 +01:00
Jiří Klimeš
72922f2068 cli: fix description of connection parameters and specify some default values 2013-12-13 09:50:09 +01:00
Jiří Klimeš
df104771ae cli: support PPPoE connection type in nmcli connection editor 2013-12-11 16:54:17 +01:00
Jiří Klimeš
d40a499c01 cli: add active connections to 'nmcli device status' 2013-12-09 12:35:43 +01:00
Jiří Klimeš
62f07eea26 cli: fix nmcli help for connection object (rh #1036545)
https://bugzilla.redhat.com/show_bug.cgi?id=1036545
2013-12-02 15:40:11 +01:00
Jiří Klimeš
655af71c6d nmcli: fix connecting VLANs without an explicit interface-name (rh #1034908)
nm_connection_get_virtual_iface_name() doesn't work when determining virtual
connections, because for VLANs it can return NULL.

See also commit e1e4740648.

https://bugzilla.redhat.com/show_bug.cgi?id=1034908
2013-11-28 16:50:42 +01:00
Dan Williams
d35cb5b77c cli: add support for DCB settings 2013-11-27 10:05:43 -06:00
Dan Winship
461920bb96 cli: add NMC_RESULT_ERROR_NOT_FOUND and use as appropriate
This will allow callers to distinguish "no such connection" from
"connection failed to activate", etc.

https://bugzilla.redhat.com/show_bug.cgi?id=1022256
2013-11-22 13:51:25 -05:00
Jiří Klimeš
472ee8104d cli: initialize interface-name for new team connections in editor 2013-11-22 14:28:08 +01:00
Thomas Haller
7698d5dfc0 cli: bash completion completes filenames for team "config" property
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-22 14:10:34 +01:00
Jiří Klimeš
cdec23d314 cli: complete file names for properties whose value is a file name
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
2013-11-22 14:09:10 +01:00
Jiří Klimeš
a3c06afc12 cli: support file names for 'config' argument when creating team connections
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.
2013-11-22 14:09:10 +01:00
Thomas Haller
32b67cd1be cli: bash completion must not suggest IP options for adding slave types
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-18 16:38:07 +01:00
Jiří Klimeš
160d6f073e cli: add missing reason-to-string mappings for NMDeviceStateReason 2013-11-18 16:17:23 +01:00
Thomas Haller
df7406fcf2 cli: add 'config' option to bash completion when adding team-slave connection
Like 'team', 'team-slave' also understands the property 'config'.
Add it to bash completion for the 'connection add' command.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-18 12:12:20 +01:00
Thomas Haller
6241366f30 cli: adjust bash completion for nmcli connection load <file>...
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-15 13:39:42 -05:00
Dan Winship
9a532db182 cli: add "nmcli con load file..."
https://bugzilla.gnome.org/show_bug.cgi?id=709830
2013-11-15 13:39:40 -05:00
Jiří Klimeš
2a2af5825a cli: allow editing 'generic' connections 2013-11-14 13:53:44 +01:00
Jiří Klimeš
dbba05a3db cli: fix crash on editing 'lo' connection (rh #1030395)
https://bugzilla.redhat.com/show_bug.cgi?id=1030395
2013-11-14 13:53:21 +01:00
Thomas Haller
97935382f4 coverity: fix various warnings detected with Coverity
These are (most likely) only warnings and not severe bugs.
Some of these changes are mostly made to get a clean run of
Coverity without any warnings.

Error found by running Coverity scan

https://bugzilla.redhat.com/show_bug.cgi?id=1025894

Co-Authored-By: Jiří Klimeš <jklimes@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-13 15:29:24 +01:00
Thomas Haller
ab92a0d69c cli: fix reading IP config for *-slaves
Error found by running Coverity

https://bugzilla.redhat.com/show_bug.cgi?id=1025894

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-13 15:29:24 +01:00
Thomas Haller
0139ad37f7 cli: fix potential crash in nmcli when using strcmp
Error found by running Coverity

https://bugzilla.redhat.com/show_bug.cgi?id=1025894

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-13 15:29:24 +01:00
Thomas Haller
bbddc0e18a cli: fix bash completion for curser not at EOL (2)
Previous commit had an error in the following case:
  $ nmcli connection modify  '  <TAB>     id

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-11-13 15:02:23 +01:00