policycoreutils: sandbox: check for paths up front

When launching a sandbox x environment we should check up front to make
sure that the seunshare and sandboxsh files exist and bail politely if
they do not exist.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
This commit is contained in:
Eric Paris 2011-08-10 16:28:36 -04:00
parent 1701e786ea
commit 74bb5c01d6
1 changed files with 9 additions and 0 deletions

View File

@ -174,6 +174,15 @@ class Sandbox:
def __x_callback(self, option, opt, value, parser): def __x_callback(self, option, opt, value, parser):
self.__mount = True self.__mount = True
setattr(parser.values, option.dest, True) setattr(parser.values, option.dest, True)
if not os.path.exists(SEUNSHARE):
raise ValueError(_("""
%s is required for the action you want to perform.
""") % SEUNSHARE)
if not os.path.exists(SANDBOXSH):
raise ValueError(_("""
%s is required for the action you want to perform.
""") % SANDBOXSH)
def __validdir(self, option, opt, value, parser): def __validdir(self, option, opt, value, parser):
if not os.path.isdir(value): if not os.path.isdir(value):