Skip to content

Commit

Permalink
remove variable for institution ID since relative imports don't work …
Browse files Browse the repository at this point in the history
…based on the script's invocation method
  • Loading branch information
mwestphall committed Jun 7, 2024
1 parent 9458e9b commit cc2edfa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
11 changes: 4 additions & 7 deletions src/webapp/automerge_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import os
import re

from webapp.models import GlobalData

try:
from urllib.request import urlopen
except ImportError:
Expand All @@ -23,8 +21,7 @@

import xml.etree.ElementTree as et

INSTITUTIONS_API = GlobalData().config.get('INSTITUTIONS_API')
INSTITUTIONS_TLD = INSTITUTIONS_API.replace('/api','') # direct users to homepage rather than api
INSTITUTIONS_API = "https://topology-institutions.osg-htc.org"

# NOTE: throughout this program, git shas are of type str, while paths and
# filenames are of type bytes. The motivation behind this is to handle
Expand Down Expand Up @@ -138,7 +135,7 @@ def main(args):
if invalid_institutions:
errors += [
f"Unrecognized InstitutionID in project(s) {', '.join(invalid_institutions)}. "
f"See {INSTITUTIONS_TLD} for known ID list."
f"See {INSTITUTIONS_API} for known ID list."
]
else:
orgs_added = None
Expand Down Expand Up @@ -226,10 +223,10 @@ def get_organizations_at_version(sha):
return set( p.get("Organization") for p in projects )

def get_invalid_institution_ids(sha, fnames):
valid_institutions = requests.get(f'{INSTITUTIONS_API}/institution_ids').json()
valid_institutions = requests.get(f'{INSTITUTIONS_API}/api/institution_ids').json()
institution_ids = [i['id'] for i in valid_institutions]
projects = { fname : parse_yaml_at_version(sha, fname, {}) for fname in fnames }
return [fname for fname, yaml in projects.items() if not yaml.get("InstitutionID", "") in institution_ids]
return [fname.decode() for fname, yaml in projects.items() if not yaml.get("InstitutionID", "") in institution_ids]


def commit_is_merged(sha_a, sha_b):
Expand Down
3 changes: 1 addition & 2 deletions src/webhook_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,14 +285,13 @@ def pull_request_hook():
set_webhook_pr_state(pull_num, head_sha, webhook_state)

# only comment on errors if DT files modified or contact unknown
osg_bot_msg = "No reported errors"
if ret in reportable_errors:
osg_bot_msg = webhook_status_messages.automerge_status_messages[ret]
body = osg_bot_msg.format(**locals())
action = 'REQUEST_CHANGES' if ret in rejectable_errors else 'COMMENT'
publish_pr_review(pull_num, body, action, head_sha)

return Response(f'Thank You')
return Response('Thank You')


def runcmd(cmd, input=None, **kw):
Expand Down

0 comments on commit cc2edfa

Please sign in to comment.