hobo: handle new required --exists parameter (#7550)

This commit is contained in:
Frédéric Péters 2015-08-24 15:43:14 +02:00
parent 6e4d431567
commit 30ef526b60
1 changed files with 8 additions and 0 deletions

View File

@ -42,6 +42,8 @@ class CmdCheckHobos(Command):
Command.__init__(self, [
make_option('--ignore-timestamp', action='store_true',
dest='ignore_timestamp', default=False),
make_option('--exists', action='store_true',
dest='exists', default=False),
])
def execute(self, base_options, sub_options, args):
@ -72,6 +74,12 @@ class CmdCheckHobos(Command):
pub.app_dir = os.path.join(global_app_dir,
self.get_instance_path(service))
if sub_options.exists:
if os.path.exists(pub.app_dir):
sys.exit(0)
else:
sys.exit(1)
if not os.path.exists(pub.app_dir):
print 'initializing instance in', pub.app_dir
os.mkdir(pub.app_dir)