From e74c568b07b50b97873fb4ee1d776dedefbd54d6 Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Fri, 1 Oct 2021 23:05:04 +0200 Subject: New upstream version 1.32.12 --- examples/python/dbus/create-bond.py | 18 +++++++++++------- examples/python/dbus/vpn.py | 11 ++--------- 2 files changed, 13 insertions(+), 16 deletions(-) (limited to 'examples/python/dbus') diff --git a/examples/python/dbus/create-bond.py b/examples/python/dbus/create-bond.py index 4ebec24a..fe35fcc0 100755 --- a/examples/python/dbus/create-bond.py +++ b/examples/python/dbus/create-bond.py @@ -40,8 +40,8 @@ def create_bond(bond_name): "autoconnect-slaves": 1, } ) - s_ip4 = dbus.Dictionary({"method": "auto"}) - s_ip6 = dbus.Dictionary({"method": "ignore"}) + s_ip4 = dbus.Dictionary({"method": "disabled"}) + s_ip6 = dbus.Dictionary({"method": "disabled"}) con = dbus.Dictionary( {"bond": s_bond, "connection": s_con, "ipv4": s_ip4, "ipv6": s_ip6} @@ -97,18 +97,22 @@ print("Activating bond: %s (%s)" % (bond_name, ac)) loop = GLib.MainLoop() -def properties_changed(props): - if "State" in props: - if props["State"] == 2: +def properties_changed(interface_name, changed_properties, invalidated_properties): + if ( + interface_name == "org.freedesktop.NetworkManager.Connection.Active" + and "State" in changed_properties + ): + state = changed_properties["State"] + if state == 2: print("Successfully connected") loop.quit() - if props["State"] == 3 or props["State"] == 4: + if state == 3 or state == 4: print("Bond activation failed") loop.quit() obj = bus.get_object("org.freedesktop.NetworkManager", ac) -iface = dbus.Interface(obj, "org.freedesktop.NetworkManager.Connection.Active") +iface = dbus.Interface(obj, "org.freedesktop.DBus.Properties") iface.connect_to_signal("PropertiesChanged", properties_changed) loop.run() diff --git a/examples/python/dbus/vpn.py b/examples/python/dbus/vpn.py index f86bf1ad..794fb022 100755 --- a/examples/python/dbus/vpn.py +++ b/examples/python/dbus/vpn.py @@ -10,11 +10,8 @@ # The uuid of the connection to activate CONNECTION_UUID = "c08142a4-00d9-45bd-a3b1-7610fe146374" -# UID to use. Note that NM only allows the owner of the connection to activate it. -# UID=1000 -UID = 0 - -import sys, os, dbus +import dbus +import sys from dbus.mainloop.glib import DBusGMainLoop from gi.repository import GLib @@ -127,10 +124,6 @@ def activate_connection(connection_path, device_path): ) -# Change the UID first if required -if UID != 0: - os.setuid(UID) - # Are we configured? if not len(CONNECTION_UUID): print("missing connection UUID") -- cgit 1.3.0-6-gf8a5 From 88c227d90a6b7b388c5c85d72802a0ca8f05ed5c Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Thu, 13 Jan 2022 22:30:39 +0100 Subject: New upstream version 1.34.0 --- examples/python/dbus/add-connection-compat.py | 2 +- examples/python/dbus/add-connection.py | 2 +- examples/python/dbus/create-bond.py | 2 +- examples/python/dbus/update-ip4-method.py | 2 +- examples/python/dbus/wifi-active-ap.py | 2 +- examples/python/dbus/wifi-hotspot.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'examples/python/dbus') diff --git a/examples/python/dbus/add-connection-compat.py b/examples/python/dbus/add-connection-compat.py index d5218514..9463ec68 100755 --- a/examples/python/dbus/add-connection-compat.py +++ b/examples/python/dbus/add-connection-compat.py @@ -11,7 +11,7 @@ # add-connection.py, which only supports NM 1.0 and later. # # Configuration settings are described at -# https://developer.gnome.org/NetworkManager/1.0/ref-settings.html +# https://networkmanager.dev/docs/api/latest/ref-settings.html # import socket, struct, dbus, uuid diff --git a/examples/python/dbus/add-connection.py b/examples/python/dbus/add-connection.py index cfb46de2..7c0d1f5c 100755 --- a/examples/python/dbus/add-connection.py +++ b/examples/python/dbus/add-connection.py @@ -12,7 +12,7 @@ # NetworkManager as well. # # Configuration settings are described at -# https://developer.gnome.org/NetworkManager/1.0/ref-settings.html +# https://networkmanager.dev/docs/api/latest/ref-settings.html # import dbus, uuid diff --git a/examples/python/dbus/create-bond.py b/examples/python/dbus/create-bond.py index fe35fcc0..618c6696 100755 --- a/examples/python/dbus/create-bond.py +++ b/examples/python/dbus/create-bond.py @@ -8,7 +8,7 @@ # This example configures a Bond from ethernet devices and activates it # # NetworkManager D-Bus API: -# https://developer.gnome.org/NetworkManager/stable/spec.html +# https://networkmanager.dev/docs/api/latest/spec.html # import dbus, sys, uuid diff --git a/examples/python/dbus/update-ip4-method.py b/examples/python/dbus/update-ip4-method.py index d84e01b2..e52846bb 100755 --- a/examples/python/dbus/update-ip4-method.py +++ b/examples/python/dbus/update-ip4-method.py @@ -11,7 +11,7 @@ # for a similar example using the backward-compatible properties # # Configuration settings are described at -# https://developer.gnome.org/NetworkManager/1.0/ref-settings.html +# https://networkmanager.dev/docs/api/latest/ref-settings.html # import dbus, sys diff --git a/examples/python/dbus/wifi-active-ap.py b/examples/python/dbus/wifi-active-ap.py index bc8f1ea5..52ee73b9 100755 --- a/examples/python/dbus/wifi-active-ap.py +++ b/examples/python/dbus/wifi-active-ap.py @@ -8,7 +8,7 @@ # This example prints the current wifi access point # # Configuration settings are described at -# https://developer.gnome.org/NetworkManager/1.0/ref-settings.html +# https://networkmanager.dev/docs/api/latest/ref-settings.html # import dbus, sys diff --git a/examples/python/dbus/wifi-hotspot.py b/examples/python/dbus/wifi-hotspot.py index a441e7e9..b75d8b2e 100755 --- a/examples/python/dbus/wifi-hotspot.py +++ b/examples/python/dbus/wifi-hotspot.py @@ -8,7 +8,7 @@ # This example starts or stops a wifi hotspot # # Configuration settings are described at -# https://developer.gnome.org/NetworkManager/1.0/ref-settings.html +# https://networkmanager.dev/docs/api/latest/ref-settings.html # import dbus, sys, time -- cgit 1.3.0-6-gf8a5