Commit 3f8d003b authored by Martín Ferrari's avatar Martín Ferrari

Rename subprocess to avoid more clashes

parent 2ed2f600
...@@ -48,10 +48,6 @@ class Node(object): ...@@ -48,10 +48,6 @@ class Node(object):
assert nexthop or interface assert nexthop or interface
def add_default_route(self, nexthop, interface = None): def add_default_route(self, nexthop, interface = None):
return self.add_route('0.0.0.0', 0, nexthop, interface) return self.add_route('0.0.0.0', 0, nexthop, interface)
def start_process(self, args):
return netns.subprocess.start_process(node, args)
def run_process(self, args):
return ("", "")
def get_routes(self): def get_routes(self):
return set() return set()
......
...@@ -7,7 +7,7 @@ try: ...@@ -7,7 +7,7 @@ try:
except ImportError: except ImportError:
from yaml import Loader, Dumper from yaml import Loader, Dumper
import base64, os, passfd, re, signal, socket, sys, traceback, unshare, yaml import base64, os, passfd, re, signal, socket, sys, traceback, unshare, yaml
import netns.subprocess import netns.subprocess_
# ============================================================================ # ============================================================================
# Server-side protocol implementation # Server-side protocol implementation
...@@ -298,7 +298,7 @@ class Server(object): ...@@ -298,7 +298,7 @@ class Server(object):
def do_PROC_RUN(self, cmdname): def do_PROC_RUN(self, cmdname):
try: try:
# self._proc['close_fds'] = True # forced # self._proc['close_fds'] = True # forced
chld = netns.subprocess.spawn(**self._proc) chld = netns.subprocess_.spawn(**self._proc)
except: except:
(t, v, tb) = sys.exc_info() (t, v, tb) = sys.exc_info()
r = ["Failure starting process: %s" % str(v)] r = ["Failure starting process: %s" % str(v)]
...@@ -330,9 +330,9 @@ class Server(object): ...@@ -330,9 +330,9 @@ class Server(object):
self.reply(500, "Process does not exist.") self.reply(500, "Process does not exist.")
return return
if cmdname == 'PROC POLL': if cmdname == 'PROC POLL':
ret = netns.subprocess.poll(pid) ret = netns.subprocess_.poll(pid)
else: else:
ret = netns.subprocess.wait(pid) ret = netns.subprocess_.wait(pid)
if ret != None: if ret != None:
self._children.remove(pid) self._children.remove(pid)
...@@ -443,7 +443,7 @@ class Client(object): ...@@ -443,7 +443,7 @@ class Client(object):
"""Start a subprocess in the slave; the interface resembles """Start a subprocess in the slave; the interface resembles
subprocess.Popen, but with less functionality. In particular subprocess.Popen, but with less functionality. In particular
stdin/stdout/stderr can only be None or a open file descriptor. stdin/stdout/stderr can only be None or a open file descriptor.
See netns.subprocess.spawn for details.""" See netns.subprocess_.spawn for details."""
if executable == None: if executable == None:
executable = argv[0] executable = argv[0]
......
...@@ -98,6 +98,7 @@ class TestInterfaces(unittest.TestCase): ...@@ -98,6 +98,7 @@ class TestInterfaces(unittest.TestCase):
prefix_len = 64) prefix_len = 64)
devs = get_devs_netns(node0) devs = get_devs_netns(node0)
print devs
self.assertTrue( { self.assertTrue( {
'addr': '10.0.0.1', 'plen': 24, 'addr': '10.0.0.1', 'plen': 24,
'bcast': '10.0.0.255', 'family': 'inet' 'bcast': '10.0.0.255', 'family': 'inet'
......
#!/usr/bin/env python #!/usr/bin/env python
# vim:ts=4:sw=4:et:ai:sts=4 # vim:ts=4:sw=4:et:ai:sts=4
import netns, netns.subprocess, test_util import netns, netns.subprocess_, test_util
import grp, os, pwd, signal, socket, sys, time, unittest import grp, os, pwd, signal, socket, sys, time, unittest
from netns.subprocess import * from netns.subprocess_ import *
def _stat(path): def _stat(path):
try: try:
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# vim:ts=4:sw=4:et:ai:sts=4 # vim:ts=4:sw=4:et:ai:sts=4
import re, subprocess, sys import re, subprocess, sys
import netns.subprocess import netns.subprocess_
def process_ipcmd(str): def process_ipcmd(str):
cur = None cur = None
...@@ -59,9 +59,8 @@ def get_devs(): ...@@ -59,9 +59,8 @@ def get_devs():
return process_ipcmd(outdata) return process_ipcmd(outdata)
def get_devs_netns(node): def get_devs_netns(node):
(outdata, errdata) = netns.subprocess.backticks_raise(node, out = netns.subprocess_.backticks_raise(node, ["ip", "addr", "list"])
["ip", "addr", "list"]) return process_ipcmd(out)
return process_ipcmd(outdata)
# Unittest from Python 2.6 doesn't have these decorators # Unittest from Python 2.6 doesn't have these decorators
def skip(text): def skip(text):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment