#!/usr/bin/python3

import sys
import argparse
from SystemLib import ogHelp
from ImageLib import ogIsImageLocked

parser = argparse.ArgumentParser (add_help=False)
parser.add_argument ('container', nargs='?', default=None)
parser.add_argument ('imgfile', nargs='?', default=None)

if 2 == len (sys.argv) and 'help' == sys.argv[1]:
    #parser.print_help() sale en inglés aunque la locale indique otra cosa
    ogHelp ('ogIsImageLocked', 'ogIsImageLocked [str_repo] path_image', ['ogIsImageLocked /opt/opengnsys/images/aula1/win7.img', 'ogIsImageLocked REPO /aula1/win7.img'])
    sys.exit (0)

args = parser.parse_args()

ret = ogIsImageLocked (args.container, args.imgfile)
if ret is not None:
    if   ret == True: sys.exit (0)
    elif ret == False: sys.exit (1)
    else: print (ret)
