problem in getting state of VPN connection using DBus

Ariyan ariyanster at gmail.com
Tue Jun 26 05:32:08 PDT 2012


I'm trying to get state of a VPN connection via DBus in Python.
Here is my code:

    name="testVPN"
    proxy =
dbus.SystemBus().get_object('org.freedesktop.NetworkManagerUserSettings',
'/org/freedesktop/NetworkManagerSettings')
    iface = dbus.Interface(proxy, 'org.freedesktop.NetworkManagerSettings')
    connections = iface.ListConnections()
    for connection in connections:
        proxy =
dbus.SystemBus().get_object('org.freedesktop.NetworkManagerUserSettings',
connection)
        iface = dbus.Interface(proxy,
'org.freedesktop.NetworkManagerSettings.Connection')
        con_settings = iface.GetSettings()['connection']
        if con_settings['type'] == 'vpn' and con_settings['id'] == name:
            state=dbus.Interface(proxy,
'org.freedesktop.DBus.Properties').Get('org.freedesktop.NetworkManager.VPN.Connection',
'VpnState')



This finds VPN connection correctly but in the last line (when trying to
get `VpnState` property) it raises this Exception:

    dbus.exceptions.DBusException: org.freedesktop.DBus.Error.AccessDenied:
Rejected send message, 1 matched rules; type="method_call", sender=":1.169"
(uid=0 pid=20580 comm="python) interface="org.freedesktop.DBus.Properties"
member="Get" error name="(unset)" requested_reply=0 destination=":1.36"
(uid=1000 pid=3457 comm="nm-applet))


What is the problem?
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20120626/9f7aa426/attachment.html>


More information about the dbus mailing list