Register with system bus in container environment
[platform/upstream/connman.git] / test / monitor-services
index 9476bf8..d570e5f 100755 (executable)
@@ -7,7 +7,7 @@ import dbus.mainloop.glib
 
 def extract_values(values):
        val = "{"
-       for key in values.keys():
+       for key in list(values.keys()):
                val += " " + key + "="
                if key in ["Servers", "Excludes"]:
                        val += extract_list(values[key])
@@ -42,27 +42,27 @@ def property_changed(name, value, path):
                val = int(value)
        else:
                val = str(value)
-       print "[%s] %s = %s" % (service, name, val)
+       print("[%s] %s = %s" % (service, name, val))
 
 def services_changed(services, removed):
        for i in services:
                service = i[0][i[0].rfind("/") + 1:]
-               print "[%s] changed" % (service)
-               for n in i[1].keys():
+               print("[%s] changed" % (service))
+               for n in list(i[1].keys()):
                        property_changed(n, i[1][n], i[0])
        for i in removed:
                service = i[i.rfind("/") + 1:]
-               print "[%s] removed" % (service)
+               print("[%s] removed" % (service))
 
 def technology_added(path, properties):
        technology = path[path.rfind("/") + 1:]
-       print "[%s] added" % (technology)
-       for n in properties.keys():
+       print("[%s] added" % (technology))
+       for n in list(properties.keys()):
                property_changed(n, properties[n], technology)
 
 def technology_removed(path):
        technology = path[path.rfind("/") + 1:]
-       print "[%s] removed" % (technology)
+       print("[%s] removed" % (technology))
 
 if __name__ == '__main__':
        dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)