Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
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
Cédric Le Ninivin
slapos.core
Commits
e55c2054
Commit
e55c2054
authored
Mar 18, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
print to stderr instead of exception
parent
1fbd79a6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
5 deletions
+4
-5
slapos/entry.py
slapos/entry.py
+2
-4
slapos/format.py
slapos/format.py
+2
-1
No files found.
slapos/entry.py
View file @
e55c2054
...
@@ -55,8 +55,6 @@ USER_SLAPOS_CONFIGURATION = os.environ.get(
...
@@ -55,8 +55,6 @@ 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
):
...
@@ -119,9 +117,9 @@ def dispatch(command, is_node_command):
...
@@ -119,9 +117,9 @@ def dispatch(command, is_node_command):
"""
"""
if
is_node_command
:
if
is_node_command
:
# check root
if
os
.
getuid
()
!=
0
:
if
os
.
getuid
()
!=
0
:
raise
UsageError
(
'Root rights are needed'
)
sys
.
stderr
.
write
(
'This command must be run as root.
\
n
'
)
sys
.
exit
()
if
command
==
'register'
:
if
command
==
'register'
:
call
(
register
)
call
(
register
)
...
...
slapos/format.py
View file @
e55c2054
...
@@ -1241,7 +1241,8 @@ class Config(object):
...
@@ -1241,7 +1241,8 @@ class Config(object):
if
root_needed
and
os
.
getuid
()
!=
0
:
if
root_needed
and
os
.
getuid
()
!=
0
:
message
=
"Root rights are needed"
message
=
"Root rights are needed"
self
.
logger
.
error
(
message
)
self
.
logger
.
error
(
message
)
raise
UsageError
(
message
)
sys
.
stderr
.
write
(
message
+
'
\
n
'
)
sys
.
exit
()
if
self
.
log_file
:
if
self
.
log_file
:
if
not
os
.
path
.
isdir
(
os
.
path
.
dirname
(
self
.
log_file
)):
if
not
os
.
path
.
isdir
(
os
.
path
.
dirname
(
self
.
log_file
)):
...
...
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