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
27b0be38
Commit
27b0be38
authored
Jun 24, 2010
by
Martín Ferrari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config.run_as attribute and get_nodes
parent
b5ef8214
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
6 deletions
+18
-6
src/netns/__init__.py
src/netns/__init__.py
+18
-6
No files found.
src/netns/__init__.py
View file @
27b0be38
#!/usr/bin/env python
# vim:ts=4:sw=4:et:ai:sts=4
import
os
import
os
,
pwd
from
netns.node
import
Node
class
__Config
(
object
):
def
__init__
(
self
):
self
.
run_as
=
None
self
.
_run_as
=
65535
try
:
self
.
_run_as
=
pwd
.
getpwnam
(
'nobody'
)[
2
]
except
:
pass
def
_set_run_as
(
self
,
uid
):
if
type
(
uid
)
!=
int
:
uid
=
pwd
.
getpwnam
(
uid
)[
2
]
if
uid
==
0
:
raise
AttributeError
(
"Cannot run as root by default"
)
self
.
_run_as
=
uid
def
_get_run_as
(
self
):
return
self
.
_run_as
run_as
=
property
(
_get_run_as
,
_set_run_as
,
None
,
"Default uid to run applications as"
)
config
=
__Config
()
__nodes
=
set
()
def
get_nodes
():
return
set
(
__nodes
)
get_nodes
=
Node
.
get_nodes
def
set_cleanup_hooks
(
on_exit
=
False
,
on_signals
=
[]):
pass
...
...
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