Hi Martin,

On 7/18/19 6:49 AM, Martin Hundebøll wrote:
Collect the setup commands and print them to stdout at the end of the
script. This allows users to evaluate the standard output to apply
settings.
---
  test/process-context-settings | 12 +++++++++---
  1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/test/process-context-settings b/test/process-context-settings
index 7ffb12b3..ee3f17d3 100755
--- a/test/process-context-settings
+++ b/test/process-context-settings
@@ -1,6 +1,5 @@
  #!/usr/bin/python3
-import os
  import sys
  import dbus
@@ -11,6 +10,8 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'), modems = manager.GetModems() +commands = []
+
  for path, properties in modems:
        if "org.ofono.ConnectionManager" not in properties["Interfaces"]:
                continue
@@ -48,7 +49,7 @@ for path, properties in modems:
cmd = "ip address add dev " + interface + " " + address
                        cmd += "/32"
-                       os.system(cmd);
+                       commands.append(cmd)
for i in settings["DomainNameServers"]:
                                print("    Nameserver is %s" % (i),
@@ -56,5 +57,10 @@ for path, properties in modems:
cmd = "ip route add " + i
                                cmd +=" dev " + interface
-                               os.system(cmd);
+
+                               commands.append(cmd)
+
                print('', file=sys.stderr)
+
+
+print("\n".join(commands))


Can we actually keep the current behavior of executing all the generated commands? process-context-settings is used in testing and it is a pain to unlearn the old way. Perhaps you can add a command line option to only print the commands. E.g. --dry-run or --print-only or something.

Regards,
-Denis
_______________________________________________
ofono mailing list
[email protected]
https://lists.ofono.org/mailman/listinfo/ofono

Reply via email to