The global policy also makes no sense and so remove that, too
[platform/upstream/connman.git] / test / set-policy
1 #!/usr/bin/python
2
3 import sys
4 import dbus
5
6 if (len(sys.argv) < 3):
7         print "Usage: %s <device> <policy>" % (sys.argv[0])
8         sys.exit(1)
9
10 bus = dbus.SystemBus()
11
12 manager = dbus.Interface(bus.get_object("org.moblin.connman", "/"),
13                                         "org.moblin.connman.Manager")
14
15 properties = manager.GetProperties()
16
17 for path in properties["Devices"]:
18         device = dbus.Interface(bus.get_object("org.moblin.connman", path),
19                                                 "org.moblin.connman.Device")
20
21         properties = device.GetProperties()
22
23         if properties["Interface"] != sys.argv[1]:
24                 continue;
25
26         print "Setting policy \"%s\" for %s" % (sys.argv[2], path)
27
28         device.SetProperty("Policy", sys.argv[2])