summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMartin Hundebøll <martin@geanix.com>2019-07-18 13:49:35 +0200
committerDenis Kenzior <denkenz@gmail.com>2019-07-19 01:22:00 -0500
commit1c168e83388fb04338330086c4f0f0640c096dfc (patch)
treeff206472f7eb4e5925f7988916d3efa5d48b79f7 /test
parent777ae04611abf1c002376e567ffeb0faf985edc8 (diff)
downloadofono-1c168e83388fb04338330086c4f0f0640c096dfc.tar.gz
test: process-context-settings: print settings to stderr
Prepare the test to print commands to execute and let the caller evaluate those. In that way, more commands can be added to also set up name servers and default routes without secretly breaking the existing system network setup.
Diffstat (limited to 'test')
-rwxr-xr-xtest/process-context-settings20
1 files changed, 13 insertions, 7 deletions
diff --git a/test/process-context-settings b/test/process-context-settings
index a536a771..7ffb12b3 100755
--- a/test/process-context-settings
+++ b/test/process-context-settings
@@ -1,6 +1,7 @@
#!/usr/bin/python3
import os
+import sys
import dbus
bus = dbus.SystemBus()
@@ -23,13 +24,14 @@ for path, properties in modems:
if properties["Active"] == dbus.Boolean(0):
continue
- print("Configuring %s" % (path))
+ print("Configuring %s" % (path), file=sys.stderr)
settings = properties["Settings"]
interface = settings["Interface"]
if settings["Method"] == "dhcp":
- print(" Run DHCP on interface %s" % (interface))
+ print(" Run DHCP on interface %s" % (interface),
+ file=sys.stderr)
else:
address = settings["Address"]
try:
@@ -37,18 +39,22 @@ for path, properties in modems:
except:
gateway = "0.0.0.0";
- print(" Interface is %s" % (interface))
- print(" IP address is %s" % (address))
- print(" Gateway is %s" % (gateway))
+ print(" Interface is %s" % (interface),
+ file=sys.stderr)
+ print(" IP address is %s" % (address),
+ file=sys.stderr)
+ print(" Gateway is %s" % (gateway),
+ file=sys.stderr)
cmd = "ip address add dev " + interface + " " + address
cmd += "/32"
os.system(cmd);
for i in settings["DomainNameServers"]:
- print(" Nameserver is %s" % (i))
+ print(" Nameserver is %s" % (i),
+ file=sys.stderr)
cmd = "ip route add " + i
cmd +=" dev " + interface
os.system(cmd);
- print('')
+ print('', file=sys.stderr)