tools: add retired-on check

We don't currently do any linting at all for the legacy projects,
this patch adds some basic linting.

Change-Id: If1173779525d0c247b3d3367f0e14de27ad2985e
This commit is contained in:
Mohammed Naser 2019-05-27 09:33:27 +02:00
parent 5ae8e3d962
commit a2a884c03d

View File

@ -24,6 +24,11 @@ parser.add_argument(
default='./reference/projects.yaml',
help='projects.yaml file path (%(default)s)',
)
parser.add_argument(
'-l', '--legacy-projects',
default='./reference/legacy.yaml',
help='legact.yaml file path (%(default)s)'
)
parser.add_argument(
'-g', '--gerrit',
default=('http://git.openstack.org/cgit/openstack-infra/project-config/'
@ -40,7 +45,8 @@ args = parser.parse_args()
with open(args.projects, 'r', encoding='utf-8') as f:
projects = yaml.safe_load(f.read())
with open(args.legacy_projects, 'r', encoding='utf-8') as f:
legacy_projects = yaml.safe_load(f.read())
if os.path.exists(args.project_config):
projects_yaml = '%s/gerrit/projects.yaml' % args.project_config
@ -64,4 +70,27 @@ for team_name, team_data in projects.items():
repo_name, deliverable_name, team_name))
errors += 1
for team_name, team_data in legacy_projects.items():
# Check if the team has been retired
if 'retired-on' in team_data:
continue
deliverables = team_data.get('deliverables')
# Team has no deliverables, retired with no retired-on date
if not deliverables:
print('{} team has no deliverables with no retired-on date'.format(
team_name
))
errors += 1
continue
# In this case, team is not retired but has retired projects
for deliverable_name, deliverable_data in deliverables.items():
# Retired-on date missing for a deliverable
if 'retired-on' not in deliverable_data:
print('{} is missing a retired-on date'.format(deliverable_name))
errors += 1
continue
sys.exit(1 if errors else 0)