Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nemu3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
nemu3
Commits
3f8d003b
Commit
3f8d003b
authored
Jul 07, 2010
by
Martín Ferrari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename subprocess to avoid more clashes
parent
2ed2f600
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
11 additions
and
15 deletions
+11
-15
src/netns/node.py
src/netns/node.py
+0
-4
src/netns/protocol.py
src/netns/protocol.py
+5
-5
src/netns/subprocess_.py
src/netns/subprocess_.py
+0
-0
t/test_interfaces.py
t/test_interfaces.py
+1
-0
t/test_subprocess.py
t/test_subprocess.py
+2
-2
t/test_util.py
t/test_util.py
+3
-4
No files found.
src/netns/node.py
View file @
3f8d003b
...
...
@@ -48,10 +48,6 @@ class Node(object):
assert
nexthop
or
interface
def
add_default_route
(
self
,
nexthop
,
interface
=
None
):
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
):
return
set
()
...
...
src/netns/protocol.py
View file @
3f8d003b
...
...
@@ -7,7 +7,7 @@ try:
except
ImportError
:
from
yaml
import
Loader
,
Dumper
import
base64
,
os
,
passfd
,
re
,
signal
,
socket
,
sys
,
traceback
,
unshare
,
yaml
import
netns.subprocess
import
netns.subprocess
_
# ============================================================================
# Server-side protocol implementation
...
...
@@ -298,7 +298,7 @@ class Server(object):
def
do_PROC_RUN
(
self
,
cmdname
):
try
:
# self._proc['close_fds'] = True # forced
chld
=
netns
.
subprocess
.
spawn
(
**
self
.
_proc
)
chld
=
netns
.
subprocess
_
.
spawn
(
**
self
.
_proc
)
except
:
(
t
,
v
,
tb
)
=
sys
.
exc_info
()
r
=
[
"Failure starting process: %s"
%
str
(
v
)]
...
...
@@ -330,9 +330,9 @@ class Server(object):
self
.
reply
(
500
,
"Process does not exist."
)
return
if
cmdname
==
'PROC POLL'
:
ret
=
netns
.
subprocess
.
poll
(
pid
)
ret
=
netns
.
subprocess
_
.
poll
(
pid
)
else
:
ret
=
netns
.
subprocess
.
wait
(
pid
)
ret
=
netns
.
subprocess
_
.
wait
(
pid
)
if
ret
!=
None
:
self
.
_children
.
remove
(
pid
)
...
...
@@ -443,7 +443,7 @@ class Client(object):
"""Start a subprocess in the slave; the interface resembles
subprocess.Popen, but with less functionality. In particular
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
:
executable
=
argv
[
0
]
...
...
src/netns/subprocess.py
→
src/netns/subprocess
_
.py
View file @
3f8d003b
File moved
t/test_interfaces.py
View file @
3f8d003b
...
...
@@ -98,6 +98,7 @@ class TestInterfaces(unittest.TestCase):
prefix_len
=
64
)
devs
=
get_devs_netns
(
node0
)
print
devs
self
.
assertTrue
(
{
'addr'
:
'10.0.0.1'
,
'plen'
:
24
,
'bcast'
:
'10.0.0.255'
,
'family'
:
'inet'
...
...
t/test_subprocess.py
View file @
3f8d003b
#!/usr/bin/env python
# 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
from
netns.subprocess
import
*
from
netns.subprocess
_
import
*
def
_stat
(
path
):
try
:
...
...
t/test_util.py
View file @
3f8d003b
...
...
@@ -2,7 +2,7 @@
# vim:ts=4:sw=4:et:ai:sts=4
import
re
,
subprocess
,
sys
import
netns.subprocess
import
netns.subprocess
_
def
process_ipcmd
(
str
):
cur
=
None
...
...
@@ -59,9 +59,8 @@ def get_devs():
return process_ipcmd(outdata)
def get_devs_netns(node):
(outdata, errdata) = netns.subprocess.backticks_raise(node,
["ip", "addr", "list"])
return process_ipcmd(outdata)
out = netns.subprocess_.backticks_raise(node, ["ip", "addr", "list"])
return process_ipcmd(out)
# Unittest from Python 2.6 doesn'
t
have
these
decorators
def
skip
(
text
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment