Re: Ethernet connection not listed through DBus/ListConnections
- From: daniel åkerud <daniel akerud gmail com>
- To: networkmanager-list gnome org
- Subject: Re: Ethernet connection not listed through DBus/ListConnections
- Date: Wed, 3 Jun 2009 00:02:55 +0200
On Wed, May 27, 2009 at 5:56 PM, daniel åkerud
<daniel akerud gmail com> wrote:
I am trying to automatically connect to a VPN (PPTP) connection through DBus. I have used the script posted by Tambet Ingo as a starting point, found here:
http://www.nabble.com/dbus-and-OpenVPN-Autostart-td21905375.html
The problem is that my Ethernet connection ("Auto Eth1"), that is required to be connected before the VPN, is not listed through the org.freedesktop.NetworkManagerUserSettings.ListConnections function.
So how do I get the last parameter to ActivateConnection? I.e.:
iface.ActivateConnection('org.freedesktop.NetworkManagerUserSettings',
vpn_connection, # = "/org/freedesktop/NetworkManagerSettings/0" which is my VPN
dbus.ObjectPath("/"),
active_connection, # where to get?
reply_handler=reply_handler,
error_handler=error_handler)
I do have the UUID for both connections, found under
cat /etc/NetworkManager/system-connections/Auto eth1
and
cat ~/.gconf/system/networking/connections/2/connection/%gconf.xml
respectively.
I am using network-manager-0.7.1~rc4.1.cf199a964 under Ubuntu 9.04.
Any and all help appreciated.
BR/D
Problem solved! I have found the missing connection! :)
For anyone that might have the same problem in the future, the script above does not take into
account that connections live in two different services, UserSettings and
SystemSettings. Furthermore, these connection have the same name,
complicating things further. Anyhow, I have made a script that takes
this into account and successfully connects to my VPN. Just add your UUIDs, and run it. Example output:
The code can be found here:
http://pastebin.com/m11349e32
$ python nm-vpn-restart.py
connections:
org.freedesktop.NetworkManagerSystemSettings: add286bb-da7c-4f39-8a2f-13d5233818d6 - Auto ham0 (802-3-ethernet)
org.freedesktop.NetworkManagerSystemSettings: 12c5b1af-6f44-448e-ba46-be54176efb21 - Auto eth1 (802-3-ethernet)
org.freedesktop.NetworkManagerSystemSettings: 904a6063-5962-41a3-893c-fbfb30d15de9 - Auto eth0 (802-3-ethernet)
org.freedesktop.NetworkManagerUserSettings: 2ce0ec46-ae6b-4d46-9128-78dd8c421345 - Relakks (vpn)
connecting to:
'(dbus.ObjectPath('/org/freedesktop/NetworkManagerSettings/0'), 'org.freedesktop.NetworkManagerUserSettings')'
with active connection:
'(dbus.ObjectPath('/org/freedesktop/NetworkManagerSettings/0'), 'org.freedesktop.NetworkManagerSystemSettings')'
<<SUCCESS>>
And you can see in the Network Manager GUI that is connecting to the VPN.
/Daniel Åkerud
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]