Skip to content

Commit

Permalink
Updated validate.py to optionally accept a specific distro (#9992)
Browse files Browse the repository at this point in the history
* Updated validate.py to optionally accept a specific distro

* Updated to include errors
  • Loading branch information
craigloewen-msft committed Apr 19, 2023
1 parent 832904b commit 7f45ed0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions distributions/validate.py
Expand Up @@ -61,7 +61,7 @@ def is_unique(collection: list):

if __name__ == "__main__":
if len(sys.argv) < 2:
print(f'Usage: {sys.argv[0]} /path/to/file', file=sys.stderr)
print(f'Usage: {sys.argv[0]} /path/to/file [distroName]', file=sys.stderr)
exit(1)

with open(sys.argv[1]) as fd:
Expand All @@ -70,8 +70,15 @@ def is_unique(collection: list):
distros = content['Distributions']
assert is_unique([e.get('StoreAppId') for e in distros if e])
assert is_unique([e.get('Name') for e in distros if e])

if len(sys.argv) > 2:
# Filter the distros to only the one we want to validate
content = { "Distributions": [e for e in content['Distributions'] if e['Name'] == sys.argv[2]] }
if not content['Distributions']:
raise RuntimeError(f'No distro found for name {sys.argv[2]}')


for e in content['Distributions']:
validate_distro(e)

print("All checks completed successfully")
print("All checks completed successfully")

0 comments on commit 7f45ed0

Please sign in to comment.