cnetworkmanager icon indicating copy to clipboard operation
cnetworkmanager copied to clipboard

Getting connection info by id fails

Open cemeyer opened this issue 15 years ago • 4 comments

Example:

$ cnetworkmanager --actcon
State     | Name        | AP | Devices | Default route
----------+-------------+----+---------+--------------
ACTIVATED | System eth0 |    | eth0    | *            
$ cnetworkmanager --con-info="System eth0"
Connection 'System eth0' not found
Traceback (most recent call last):
  File "/usr/bin/cnetworkmanager", line 250, in 
    cs = c.GetSettings()
AttributeError: 'NoneType' object has no attribute 'GetSettings'

This is with cnetworkmanager 0.21.1.

cemeyer avatar Sep 09 '09 02:09 cemeyer

Ok, if I specify KIND manually, I still get an exception:

$ cnetworkmanager "--con-info=system,System eth0"
Section        | Property    | Value                               
---------------+-------------+-------------------------------------
802-3-ethernet |             |                                     
               | mac-address | �C��                              
connection     |             |                                     
               | type        | 802-3-ethernet                      
               | uuid        | 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
               | id          | System eth0                         
ipv4           |             |                                     
               | routes      |                                     
               | addresses   |                                     
               | dns         |                                     
               | method      | auto                                
Traceback (most recent call last):
  File "/usr/bin/cnetworkmanager", line 253, in 
    secu = cs[type]["security"]
KeyError: 'security'

cemeyer avatar Sep 09 '09 10:09 cemeyer

I am using NetworkManager 0.7.1-8.git20090708 on Fedora 11.

cemeyer avatar Sep 09 '09 10:09 cemeyer

Yes, KIND defaults to "user" so you have to say "system" explicitly. That should probably try both in order. I need to fix that "KeyError: 'security'"

mvidner avatar Sep 09 '09 16:09 mvidner

Ah, ok. I didn't expect that behaviour from --help.

Also, looks like mac-address isn't getting printed correctly?

For the --terse behaviour, it would be a lot easier for scripts to parse if instead of the current format, it was something like this:

802-3-ethernet|mac-address|00:11:22:33:44:55
connection|type|802-3-ethernet
connection|uuid|foo
connection|id|System eth0
ipv4|routes|
ipv4|addresses|
...

cemeyer avatar Sep 09 '09 20:09 cemeyer