diff --git a/verify-repo-metadata.py b/verify-repo-metadata.py index 6c2561a2..228cc10c 100755 --- a/verify-repo-metadata.py +++ b/verify-repo-metadata.py @@ -1,52 +1,52 @@ #!/usr/bin/python3 import os import sys import yaml import argparse # Gather the command line arguments we need parser = argparse.ArgumentParser(description='Verifies the metadata files') parser.add_argument('--metadata-path', help='Path to the metadata to check', required=True) args = parser.parse_args() # Make sure our configuration file exists if not os.path.exists( args.metadata_path ): print("Unable to locate specified metadata location: %s".format(args.metadata_path)) sys.exit(1) # Start going over the location in question... for currentPath, subdirectories, filesInFolder in os.walk( args.metadata_path, topdown=False, followlinks=False ): # Determine the location the repository will be at in Gitlab gitlabLocation = currentPath[len(args.metadata_path):] # Do we have a metadata.yaml file? if 'metadata.yaml' not in filesInFolder: # We're not interested then.... continue # Now that we know we have something to work with.... # Lets load the current metadata up metadataPath = os.path.join( currentPath, 'metadata.yaml' ) metadataFile = open( metadataPath, 'r' ) metadata = yaml.load( metadataFile ) # check sanity of the description and make sure that it is less then 250 # (part of gitlab restriction) if metadata['description'] is not None and len(metadata['description']) > 250: print("Invalid size of description in the " + currentPath) # check the description and ensure that it is not empty # currently warning, but still best to list it out if metadata['description'] is not None and len(metadata['description']) == 0: - print("Empty metadata in the " + currentPath) + print("Empty description in the " + currentPath) # Make sure that identifier is not empty identifier = metadata.get('identifier') if identifier is None: print("Fatal error: Empty identifier in the " + currentPath) sys.exit(1) # All done! sys.exit(0)