Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
104
Merge Requests
104
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos
Commits
1fbd79a6
Commit
1fbd79a6
authored
Mar 18, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refuse to run 'slapos node' commands as non root
parent
d83b4de8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
slapos/entry.py
slapos/entry.py
+9
-1
No files found.
slapos/entry.py
View file @
1fbd79a6
...
@@ -55,6 +55,9 @@ USER_SLAPOS_CONFIGURATION = os.environ.get(
...
@@ -55,6 +55,9 @@ USER_SLAPOS_CONFIGURATION = os.environ.get(
'SLAPOS_CLIENT_CONFIGURATION'
,
'SLAPOS_CLIENT_CONFIGURATION'
,
os
.
environ
.
get
(
'SLAPOS_CONFIGURATION'
,
'~/.slapos/slapos.cfg'
))
os
.
environ
.
get
(
'SLAPOS_CONFIGURATION'
,
'~/.slapos/slapos.cfg'
))
class
UsageError
(
Exception
):
pass
class
EntryPointNotImplementedError
(
NotImplementedError
):
class
EntryPointNotImplementedError
(
NotImplementedError
):
def
__init__
(
self
,
*
args
,
**
kw_args
):
def
__init__
(
self
,
*
args
,
**
kw_args
):
NotImplementedError
.
__init__
(
self
,
*
args
,
**
kw_args
)
NotImplementedError
.
__init__
(
self
,
*
args
,
**
kw_args
)
...
@@ -115,7 +118,11 @@ def dispatch(command, is_node_command):
...
@@ -115,7 +118,11 @@ def dispatch(command, is_node_command):
If configuration file is not given: define it arbitrarily, and so on.
If configuration file is not given: define it arbitrarily, and so on.
"""
"""
if
is_node_command
:
if
is_node_command
:
# XXX-Cedric: should we check if we are root?
# check root
if
os
.
getuid
()
!=
0
:
raise
UsageError
(
'Root rights are needed'
)
if
command
==
'register'
:
if
command
==
'register'
:
call
(
register
)
call
(
register
)
elif
command
==
'software'
:
elif
command
==
'software'
:
...
@@ -221,3 +228,4 @@ Node subcommands usage:
...
@@ -221,3 +228,4 @@ Node subcommands usage:
'forum. Please also make sure that SlapOS Node is up to '
'forum. Please also make sure that SlapOS Node is up to '
'date.'
%
exception
)
'date.'
%
exception
)
sys
.
exit
(
1
)
sys
.
exit
(
1
)
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