Skip to content
Snippets Groups Projects
Commit 73b1237d authored by Roy de Goei's avatar Roy de Goei
Browse files

Update parameters for validatesip command line

parent 272fb755
No related branches found
No related tags found
No related merge requests found
Pipeline #29579 passed with warnings
...@@ -5,7 +5,8 @@ from lofar.lta.sip.validator import main ...@@ -5,7 +5,8 @@ from lofar.lta.sip.validator import main
def parse_args(): def parse_args():
parser = ArgumentParser(description='validates sip over the xsd') parser = ArgumentParser(description='validates sip over the xsd')
parser.add_argument('sip', help='xml sip to validate') parser.add_argument('--sip', nargs='?', default='', help='xml SIP file to validate')
parser.add_argument('--xsd', nargs='?', default=None, help='Alternative xsd schema file for validation')
return parser.parse_args() return parser.parse_args()
......
...@@ -109,14 +109,17 @@ def check_consistency_of_file(xmlpath): ...@@ -109,14 +109,17 @@ def check_consistency_of_file(xmlpath):
return check_consistency(sip) return check_consistency(sip)
def main(xml): def main(xml, xsd_file):
""" """
validates given xml against the SIP XSD and does consistency check validates given xml against the SIP XSD and does consistency check
""" """
try: try:
xml = xml xml = xml
if xsd_file is None:
xsd = DEFAULT_SIP_XSD_PATH xsd = DEFAULT_SIP_XSD_PATH
else:
xsd = xsd_file
valid = validate(xml, xsd) valid = validate(xml, xsd)
consistent = check_consistency_of_file(xml) consistent = check_consistency_of_file(xml)
return valid and consistent return valid and consistent
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment