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