From e255df36cef0ca55979de42e9265d223cc676c4f Mon Sep 17 00:00:00 2001 From: ramazanim Date: Mon, 24 Jun 2024 13:44:08 -0400 Subject: [PATCH 01/11] fixed datepicker issue --- app/logic/emailHandler.py | 5 ++++- app/templates/admin/createEvent.html | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/logic/emailHandler.py b/app/logic/emailHandler.py index 7a6ffedb4..75d8c4503 100644 --- a/app/logic/emailHandler.py +++ b/app/logic/emailHandler.py @@ -280,4 +280,7 @@ def replaceStaticPlaceholders(eventId, email_body): event_link="{event_link}", recipient_name="{recipient_name}", relative_time=event.relativeTime) - return new_body \ No newline at end of file + return new_body + + + diff --git a/app/templates/admin/createEvent.html b/app/templates/admin/createEvent.html index 22e88b3c6..8fce30497 100644 --- a/app/templates/admin/createEvent.html +++ b/app/templates/admin/createEvent.html @@ -29,7 +29,7 @@ {% block scripts %} {{super()}} - + {% endblock %} @@ -70,7 +70,7 @@

{{page_title}}

-
From 37b8bb8bd01d213499e9b8e66f71dcd0ddc1eaee Mon Sep 17 00:00:00 2001 From: ramazanim Date: Mon, 24 Jun 2024 15:07:05 -0400 Subject: [PATCH 02/11] Enhanced logging in import_users.py for better traceability and error diagnosis using logging module --- app/scripts/import_users.py | 207 ++++++++++++++++++++---------------- 1 file changed, 114 insertions(+), 93 deletions(-) diff --git a/app/scripts/import_users.py b/app/scripts/import_users.py index a6cb4f0f5..1a202e91a 100644 --- a/app/scripts/import_users.py +++ b/app/scripts/import_users.py @@ -1,3 +1,4 @@ +import logging import pyodbc from ldap3 import Server, Connection, ALL import peewee @@ -6,23 +7,29 @@ from app.models.user import User from app.logic.utils import getUsernameFromEmail +# Configure logging +logging.basicConfig( + filename='/home/celts/cron.log', + level=logging.INFO, + format='%(asctime)s - %(levelname)s - %(message)s' +) + def main(): """ This function runs the updateRecords function once the script is run. """ - print("Don't forget to put the correct Tracy and LDAP passwords in app/config/local-override.yml") - - print("\nGetting Updated Names, Majors, and Class Levels\n--------------------------------------------------\n") + logging.info("Script started.") + logging.warning("Don't forget to put the correct Tracy and LDAP passwords in app/config/local-override.yml") + logging.info("Getting Updated Names, Majors, and Class Levels") addToDb(getStudentData()) - print("done.") + logging.info("Finished updating student data.") addToDb(getFacultyStaffData()) - print("done.") - - print("\n\nGetting Preferred Names\n--------------------------\n") + logging.info("Finished updating faculty and staff data.") + logging.info("Getting Preferred Names from LDAP") ldap = getLdapConn() - print("LDAP Connected.") + logging.info("LDAP Connected.") people = fetchLdapList(ldap, alphaRange('a','d')) people += fetchLdapList(ldap, alphaRange('e','j')) @@ -30,28 +37,35 @@ def main(): people += fetchLdapList(ldap, alphaRange('q','z')) updateFromLdap(people) - print("Update Complete.") + logging.info("Update from LDAP Complete.") -def alphaRange(start,end): +def alphaRange(start, end): return [chr(i) for i in range(ord(start), ord(end)+1)] def getLdapConn(): - server = Server ('berea.edu', port=389, use_ssl=False, get_info='ALL') - conn = Connection (server, user=app.config['ldap']['user'], password=app.config['ldap']['password']) - if not conn.bind(): - print(conn.result) - raise Exception("BindError") - - return conn + try: + server = Server('berea.edu', port=389, use_ssl=False, get_info=ALL) + conn = Connection(server, user=app.config['ldap']['user'], password=app.config['ldap']['password']) + if not conn.bind(): + logging.error(f"LDAP bind failed: {conn.result}") + raise Exception("BindError") + return conn + except Exception as e: + logging.error(f"Failed to connect to LDAP: {e}") + raise def fetchLdapList(conn, startletters): - # Get the givennames from LDAP - we have to segment them to make sure each request is under 1500 - conn.search('dc=berea,dc=edu', - f"(|" + "".join(map(lambda s: f"(givenname={s}*)", startletters)) + ")", - attributes = ['samaccountname', 'givenname', 'sn', 'employeeid'] - ) - print(f"Found {len(conn.entries)} {startletters[0]}-{startletters[-1]} in AD"); - return conn.entries + try: + conn.search( + 'dc=berea,dc=edu', + f"(|" + "".join(map(lambda s: f"(givenname={s}*)", startletters)) + ")", + attributes=['samaccountname', 'givenname', 'sn', 'employeeid'] + ) + logging.info(f"Found {len(conn.entries)} entries for {startletters[0]}-{startletters[-1]} in AD") + return conn.entries + except Exception as e: + logging.error(f"Failed to fetch LDAP list for {startletters[0]}-{startletters[-1]}: {e}") + raise def updateFromLdap(people): for person in people: @@ -59,12 +73,13 @@ def updateFromLdap(people): preferred = str(get_key(person, 'givenname')).strip() if preferred: - count = User.update(firstName=preferred).where(User.bnumber == bnumber).execute() - if count: - print(f"Updating {bnumber} name to {preferred}") + try: + count = User.update(firstName=preferred).where(User.bnumber == bnumber).execute() + if count: + logging.info(f"Updated {bnumber} name to {preferred}") + except Exception as e: + logging.error(f"Failed to update user {bnumber} with preferred name {preferred}: {e}") -# Return the value for a key or None -# Can't use .get() because it's a ldap3.abstract.entry.Entry instead of a Dict def get_key(entry, key): if key in entry: return entry[key] @@ -78,81 +93,87 @@ def getMssqlCursor(): "host": app.config["tracy"]["host"], "db": app.config["tracy"]["name"] } - pyodbc_uri = 'DRIVER=FreeTDS;SERVER={};PORT=1433;DATABASE={};UID={};PWD={};TDS_Version=8.0;'.format(details['host'],details['db'],details['user'],details['password']) - - pyconn = pyodbc.connect(pyodbc_uri) # connects a tcp based client socket to a tcp based server socket - return pyconn.cursor() # allows python to execute sql database commands + pyodbc_uri = 'DRIVER=FreeTDS;SERVER={};PORT=1433;DATABASE={};UID={};PWD={};TDS_Version=8.0;'.format( + details['host'], details['db'], details['user'], details['password'] + ) + try: + pyconn = pyodbc.connect(pyodbc_uri) + logging.info("Connected to Tracy database.") + return pyconn.cursor() + except Exception as e: + logging.error(f"Failed to connect to Tracy database: {e}") + raise def addToDb(userList): for user in userList: try: User.insert(user).execute() - + logging.info(f"Inserted user {user['bnumber']}") except peewee.IntegrityError as e: - if user['username']: - (User.update(firstName = user['firstName'], lastName = user['lastName'], email = user['email'], major = user['major'], classLevel = user['classLevel']) - .where(user['bnumber'] == User.bnumber)).execute() - else: - print(f"No username for {user['bnumber']}!", user) - + try: + if user['username']: + (User.update( + firstName=user['firstName'], + lastName=user['lastName'], + email=user['email'], + major=user['major'], + classLevel=user['classLevel'] + ).where(User.bnumber == user['bnumber'])).execute() + logging.info(f"Updated user {user['bnumber']}") + else: + logging.warning(f"No username for {user['bnumber']}!", user) + except Exception as e: + logging.error(f"Failed to update user {user['bnumber']}: {e}") except Exception as e: - print(e) + logging.error(f"Failed to insert or update user {user['bnumber']}: {e}") def getFacultyStaffData(): - """ - This function pulls all the faculty and staff data from Tracy and formats for our table - - Tracy's STUSTAFF table has the following columns: - 1. PIDM - 2. ID - 3. FIRST_NAME - 4. LAST_NAME - 5. EMAIL - 6. CPO - 7. ORG - 8. DEPT_NAME - """ - print("Retrieving Faculty data from Tracy...",end="") - c = getMssqlCursor() - return [ - { "username": getUsernameFromEmail(row[4].strip()), - "bnumber": row[1].strip(), - "email": row[4].strip(), - "phoneNumber": None, - "firstName": row[2].strip(), - "lastName": row[3].strip(), - "isStudent": False, - "isFaculty": True, - "isStaff": False, - "major": None, - "classLevel": None, - "cpoNumber": row[5].strip(), - } - for row in c.execute('select * from STUSTAFF') - ] + logging.info("Retrieving Faculty and Staff data from Tracy...") + try: + c = getMssqlCursor() + return [ + { + "username": getUsernameFromEmail(row[4].strip()), + "bnumber": row[1].strip(), + "email": row[4].strip(), + "phoneNumber": None, + "firstName": row[2].strip(), + "lastName": row[3].strip(), + "isStudent": False, + "isFaculty": True, + "isStaff": False, + "major": None, + "classLevel": None, + "cpoNumber": row[5].strip(), + } + for row in c.execute('select * from STUSTAFF') + ] + except Exception as e: + logging.error(f"Failed to retrieve Faculty and Staff data: {e}") + raise def getStudentData(): - """ - This function pulls all the student data from Tracy and formats for our table - """ - print("Retrieving Student data from Tracy...",end="") - c = getMssqlCursor() - return [ - { "username": getUsernameFromEmail(row[9].strip()), - "bnumber": row[1].strip(), - "email": row[9].strip(), - "phoneNumber": None, - "firstName": row[2].strip(), - "lastName": row[3].strip(), - "isStudent": True, - "major": row[6].strip(), - "classLevel": row[4].strip(), - "cpoNumber": row[10].strip(), - } - for row in c.execute('select * from STUDATA') - ] + logging.info("Retrieving Student data from Tracy...") + try: + c = getMssqlCursor() + return [ + { + "username": getUsernameFromEmail(row[9].strip()), + "bnumber": row[1].strip(), + "email": row[9].strip(), + "phoneNumber": None, + "firstName": row[2].strip(), + "lastName": row[3].strip(), + "isStudent": True, + "major": row[6].strip(), + "classLevel": row[4].strip(), + "cpoNumber": row[10].strip(), + } + for row in c.execute('select * from STUDATA') + ] + except Exception as e: + logging.error(f"Failed to retrieve Student data: {e}") + raise if __name__ == '__main__': main() - - From bcf935d3310bbf019c9cdf83ddcf9253187a17eb Mon Sep 17 00:00:00 2001 From: Lawrence Hoerst Date: Wed, 6 Nov 2024 15:16:47 -0500 Subject: [PATCH 03/11] Instantiated a logger so configuration isn't trumped by other files --- app/scripts/import_users.py | 63 +++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/app/scripts/import_users.py b/app/scripts/import_users.py index 23b3d0b58..fa27ac84d 100644 --- a/app/scripts/import_users.py +++ b/app/scripts/import_users.py @@ -8,28 +8,31 @@ from app.logic.utils import getUsernameFromEmail # Configure logging -logging.basicConfig( - filename='/home/celts/cron.log', - level=logging.INFO, - format='%(asctime)s - %(levelname)s - %(message)s' -) +logger = logging.getLogger(__name__) +logger.setLevel(logger.INFO) +fileHandler = logging.FileHandler('/home/celts/cron.log') +fileHandler.setLevel(logger.INFO) +formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s') +fileHandler.setFormatter(formatter) +logger.addHandler(fileHandler) + def main(): """ This function runs the updateRecords function once the script is run. """ - logging.info("Script started.") - logging.warning("Don't forget to put the correct Tracy and LDAP passwords in app/config/local-override.yml") + logger.info("Script started.") + logger.warning("Don't forget to put the correct Tracy and LDAP passwords in app/config/local-override.yml") - logging.info("Getting Updated Names, Majors, and Class Levels") + logger.info("Getting Updated Names, Majors, and Class Levels") addToDb(getStudentData()) - logging.info("Finished updating student data.") + logger.info("Finished updating student data.") addToDb(getFacultyStaffData()) - logging.info("Finished updating faculty and staff data.") + logger.info("Finished updating faculty and staff data.") - logging.info("Getting Preferred Names from LDAP") + logger.info("Getting Preferred Names from LDAP") ldap = getLdapConn() - logging.info("LDAP Connected.") + logger.info("LDAP Connected.") people = fetchLdapList(ldap, alphaRange('a','d')) people += fetchLdapList(ldap, alphaRange('e','j')) @@ -37,7 +40,7 @@ def main(): people += fetchLdapList(ldap, alphaRange('q','z')) updateFromLdap(people) - logging.info("Update from LDAP Complete.") + logger.info("Update from LDAP Complete.") def alphaRange(start, end): return [chr(i) for i in range(ord(start), ord(end)+1)] @@ -47,11 +50,11 @@ def getLdapConn(): server = Server('berea.edu', port=389, use_ssl=False, get_info=ALL) conn = Connection(server, user=app.config['ldap']['user'], password=app.config['ldap']['password']) if not conn.bind(): - logging.error(f"LDAP bind failed: {conn.result}") + logger.error(f"LDAP bind failed: {conn.result}") raise Exception("BindError") return conn except Exception as e: - logging.error(f"Failed to connect to LDAP: {e}") + logger.error(f"Failed to connect to LDAP: {e}") raise def fetchLdapList(conn, startletters): @@ -61,10 +64,10 @@ def fetchLdapList(conn, startletters): f"(|" + "".join(map(lambda s: f"(givenname={s}*)", startletters)) + ")", attributes=['samaccountname', 'givenname', 'sn', 'employeeid'] ) - logging.info(f"Found {len(conn.entries)} entries for {startletters[0]}-{startletters[-1]} in AD") + logger.info(f"Found {len(conn.entries)} entries for {startletters[0]}-{startletters[-1]} in AD") return conn.entries except Exception as e: - logging.error(f"Failed to fetch LDAP list for {startletters[0]}-{startletters[-1]}: {e}") + logger.error(f"Failed to fetch LDAP list for {startletters[0]}-{startletters[-1]}: {e}") raise def updateFromLdap(people): @@ -76,9 +79,9 @@ def updateFromLdap(people): try: count = User.update(firstName=preferred).where(User.bnumber == bnumber).execute() if count: - logging.info(f"Updated {bnumber} name to {preferred}") + logger.info(f"Updated {bnumber} name to {preferred}") except Exception as e: - logging.error(f"Failed to update user {bnumber} with preferred name {preferred}: {e}") + logger.error(f"Failed to update user {bnumber} with preferred name {preferred}: {e}") def get_key(entry, key): if key in entry: @@ -98,17 +101,17 @@ def getMssqlCursor(): ) try: pyconn = pyodbc.connect(pyodbc_uri) - logging.info("Connected to Tracy database.") + logger.info("Connected to Tracy database.") return pyconn.cursor() except Exception as e: - logging.error(f"Failed to connect to Tracy database: {e}") + logger.error(f"Failed to connect to Tracy database: {e}") raise def addToDb(userList): for user in userList: try: User.insert(user).execute() - logging.info(f"Inserted user {user['bnumber']}") + logger.info(f"Inserted user {user['bnumber']}") except peewee.IntegrityError as e: try: if user['username']: @@ -120,16 +123,16 @@ def addToDb(userList): classLevel=user['classLevel'], cpoNumber=user['cpoNumber'] ).where(User.bnumber == user['bnumber'])).execute() - logging.info(f"Updated user {user['bnumber']}") + logger.info(f"Updated user {user['bnumber']}") else: - logging.warning(f"No username for {user['bnumber']}!", user) + logger.warning(f"No username for {user['bnumber']}!", user) except Exception as e: - logging.error(f"Failed to update user {user['bnumber']}: {e}") + logger.error(f"Failed to update user {user['bnumber']}: {e}") except Exception as e: - logging.error(f"Failed to insert or update user {user['bnumber']}: {e}") + logger.error(f"Failed to insert or update user {user['bnumber']}: {e}") def getFacultyStaffData(): - logging.info("Retrieving Faculty and Staff data from Tracy...") + logger.info("Retrieving Faculty and Staff data from Tracy...") try: c = getMssqlCursor() return [ @@ -150,11 +153,11 @@ def getFacultyStaffData(): for row in c.execute('select * from STUSTAFF') ] except Exception as e: - logging.error(f"Failed to retrieve Faculty and Staff data: {e}") + logger.error(f"Failed to retrieve Faculty and Staff data: {e}") raise def getStudentData(): - logging.info("Retrieving Student data from Tracy...") + logger.info("Retrieving Student data from Tracy...") try: c = getMssqlCursor() return [ @@ -173,7 +176,7 @@ def getStudentData(): for row in c.execute('select * from STUDATA') ] except Exception as e: - logging.error(f"Failed to retrieve Student data: {e}") + logger.error(f"Failed to retrieve Student data: {e}") raise if __name__ == '__main__': From ebc04272ddd78a7401be8d79fadc438922917e58 Mon Sep 17 00:00:00 2001 From: Lawrence Hoerst Date: Fri, 8 Nov 2024 09:33:14 -0500 Subject: [PATCH 04/11] Logger objects don't have the const attributes. Those are in logging --- .gitignore | 1 + app/scripts/import_users.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index dc6a53c59..9b6e06caa 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ app/static/files/ local-override.yml geckodriver.log .coverage +cron.log diff --git a/app/scripts/import_users.py b/app/scripts/import_users.py index fa27ac84d..7dc3ddce8 100644 --- a/app/scripts/import_users.py +++ b/app/scripts/import_users.py @@ -9,9 +9,9 @@ # Configure logging logger = logging.getLogger(__name__) -logger.setLevel(logger.INFO) +logger.setLevel(logging.INFO) fileHandler = logging.FileHandler('/home/celts/cron.log') -fileHandler.setLevel(logger.INFO) +fileHandler.setLevel(logging.INFO) formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s') fileHandler.setFormatter(formatter) logger.addHandler(fileHandler) @@ -22,7 +22,7 @@ def main(): This function runs the updateRecords function once the script is run. """ logger.info("Script started.") - logger.warning("Don't forget to put the correct Tracy and LDAP passwords in app/config/local-override.yml") + logger.info("Don't forget to put the correct Tracy and LDAP passwords in app/config/local-override.yml") logger.info("Getting Updated Names, Majors, and Class Levels") addToDb(getStudentData()) From 00e0682dc3b289885a2e2cbecc38b67bd7a782b4 Mon Sep 17 00:00:00 2001 From: Stevenson Date: Fri, 20 Dec 2024 11:32:02 -0500 Subject: [PATCH 05/11] Define different log levels and send output to stdout --- app/scripts/import_users.py | 55 +++++++++++++++++++++++++++++-------- 1 file changed, 44 insertions(+), 11 deletions(-) diff --git a/app/scripts/import_users.py b/app/scripts/import_users.py index 7dc3ddce8..b64b60eba 100644 --- a/app/scripts/import_users.py +++ b/app/scripts/import_users.py @@ -1,5 +1,7 @@ import logging import pyodbc +import sys +import argparse from ldap3 import Server, Connection, ALL import peewee @@ -7,15 +9,30 @@ from app.models.user import User from app.logic.utils import getUsernameFromEmail +# Argument parser for log levels +def parseArgs(): + parser = argparse.ArgumentParser(description="Import users script with logging.") + parser.add_argument( + '--log-level', + default='INFO', + choices=['DEBUG', 'INFO', 'WARNING', 'ERROR'], + help='Set the logging level' + ) + return parser.parse_args() + +arguments = parseArgs() +logLevels = getattr(logging, arguments.log_level.upper(), logging.INFO) + # Configure logging logger = logging.getLogger(__name__) -logger.setLevel(logging.INFO) -fileHandler = logging.FileHandler('/home/celts/cron.log') -fileHandler.setLevel(logging.INFO) +logger.setLevel(logLevels) + +consoleHandler = logging.StreamHandler(sys.stdout) +consoleHandler.setLevel(logLevels) formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s') -fileHandler.setFormatter(formatter) -logger.addHandler(fileHandler) +consoleHandler.setFormatter(formatter) +logger.addHandler(consoleHandler) def main(): """ @@ -23,11 +40,21 @@ def main(): """ logger.info("Script started.") logger.info("Don't forget to put the correct Tracy and LDAP passwords in app/config/local-override.yml") - + logger.info("Getting Updated Names, Majors, and Class Levels") - addToDb(getStudentData()) + + studentData = addToDb(getStudentData()) + studentAdded = studentData[0] + studentUpdated = studentData[1] + logger.info(f"{studentAdded} students were added.") + logger.info(f"{studentUpdated} students were updated.") logger.info("Finished updating student data.") - addToDb(getFacultyStaffData()) + + facultyStaffData = addToDb(getFacultyStaffData()) + facultyStaffAdded = facultyStaffData[0] + facultyStaffUpdated = facultyStaffData[1] + logger.info(f"{facultyStaffAdded} faculties/staffs were added.") + logger.info(f"{facultyStaffUpdated} faculties/staffs were updated.") logger.info("Finished updating faculty and staff data.") logger.info("Getting Preferred Names from LDAP") @@ -79,7 +106,7 @@ def updateFromLdap(people): try: count = User.update(firstName=preferred).where(User.bnumber == bnumber).execute() if count: - logger.info(f"Updated {bnumber} name to {preferred}") + logger.debug(f"Updated {bnumber} name to {preferred}") except Exception as e: logger.error(f"Failed to update user {bnumber} with preferred name {preferred}: {e}") @@ -108,10 +135,13 @@ def getMssqlCursor(): raise def addToDb(userList): + usersAdded = 0 + usersUpdated = 0 for user in userList: try: User.insert(user).execute() - logger.info(f"Inserted user {user['bnumber']}") + logger.debug(f"Inserted user {user['bnumber']}") + userAdded += 1 except peewee.IntegrityError as e: try: if user['username']: @@ -123,13 +153,16 @@ def addToDb(userList): classLevel=user['classLevel'], cpoNumber=user['cpoNumber'] ).where(User.bnumber == user['bnumber'])).execute() - logger.info(f"Updated user {user['bnumber']}") + logger.debug(f"Updated user {user['bnumber']}") + userUpdated += 1 else: logger.warning(f"No username for {user['bnumber']}!", user) except Exception as e: logger.error(f"Failed to update user {user['bnumber']}: {e}") except Exception as e: logger.error(f"Failed to insert or update user {user['bnumber']}: {e}") + + return [usersAdded, usersUpdated] def getFacultyStaffData(): logger.info("Retrieving Faculty and Staff data from Tracy...") From 595c74633151bd9e048dc4208c5578352b1b52ec Mon Sep 17 00:00:00 2001 From: Stevenson Date: Fri, 20 Dec 2024 11:37:44 -0500 Subject: [PATCH 06/11] dd --- app/scripts/import_users.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/scripts/import_users.py b/app/scripts/import_users.py index b64b60eba..b00c56cc5 100644 --- a/app/scripts/import_users.py +++ b/app/scripts/import_users.py @@ -9,6 +9,7 @@ from app.models.user import User from app.logic.utils import getUsernameFromEmail + # Argument parser for log levels def parseArgs(): parser = argparse.ArgumentParser(description="Import users script with logging.") @@ -34,6 +35,7 @@ def parseArgs(): logger.addHandler(consoleHandler) + def main(): """ This function runs the updateRecords function once the script is run. From b6fc0ecd200f4b734b7c3c504b8173285b709daa Mon Sep 17 00:00:00 2001 From: Stevenson Date: Fri, 20 Dec 2024 13:26:36 -0500 Subject: [PATCH 07/11] Fixed ci python 3.7 issue --- .github/workflows/actionTests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/actionTests.yml b/.github/workflows/actionTests.yml index 7cbd44350..5e7ea40b2 100644 --- a/.github/workflows/actionTests.yml +++ b/.github/workflows/actionTests.yml @@ -18,7 +18,7 @@ jobs: pull-requests: write strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11"] # each step can define `env` vars, but it's easiest to define them on the build level env: From 8fbb6f7b8bec1a7575c0b47cabcd3cae1ada5019 Mon Sep 17 00:00:00 2001 From: Stevenson Date: Fri, 20 Dec 2024 14:05:54 -0500 Subject: [PATCH 08/11] Added python 3.12 to ci --- .github/workflows/actionTests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/actionTests.yml b/.github/workflows/actionTests.yml index 5e7ea40b2..297dd8259 100644 --- a/.github/workflows/actionTests.yml +++ b/.github/workflows/actionTests.yml @@ -18,7 +18,7 @@ jobs: pull-requests: write strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] # each step can define `env` vars, but it's easiest to define them on the build level env: From 3e5bd088c5380a70770ce42b4f6e8ea1c6fe3c93 Mon Sep 17 00:00:00 2001 From: Stevenson Date: Fri, 20 Dec 2024 15:01:03 -0500 Subject: [PATCH 09/11] Remove python 3.12 from ci --- .github/workflows/actionTests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/actionTests.yml b/.github/workflows/actionTests.yml index 297dd8259..5e7ea40b2 100644 --- a/.github/workflows/actionTests.yml +++ b/.github/workflows/actionTests.yml @@ -18,7 +18,7 @@ jobs: pull-requests: write strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.8", "3.9", "3.10", "3.11"] # each step can define `env` vars, but it's easiest to define them on the build level env: From 3c76f03f7e8f06fefea059f36b7dc099640b5b32 Mon Sep 17 00:00:00 2001 From: Stevenson Date: Mon, 23 Dec 2024 13:37:14 -0500 Subject: [PATCH 10/11] Fixed bug in ldap --- app/scripts/import_users.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/scripts/import_users.py b/app/scripts/import_users.py index b00c56cc5..478aa4b7b 100644 --- a/app/scripts/import_users.py +++ b/app/scripts/import_users.py @@ -143,7 +143,7 @@ def addToDb(userList): try: User.insert(user).execute() logger.debug(f"Inserted user {user['bnumber']}") - userAdded += 1 + usersAdded += 1 except peewee.IntegrityError as e: try: if user['username']: @@ -156,7 +156,7 @@ def addToDb(userList): cpoNumber=user['cpoNumber'] ).where(User.bnumber == user['bnumber'])).execute() logger.debug(f"Updated user {user['bnumber']}") - userUpdated += 1 + usersUpdated += 1 else: logger.warning(f"No username for {user['bnumber']}!", user) except Exception as e: From 1bca5e17c541485d27d16d4e24e6b8204fd1ef73 Mon Sep 17 00:00:00 2001 From: Lawrence Hoerst Date: Fri, 17 Jan 2025 15:28:33 -0500 Subject: [PATCH 11/11] Added TDS driver dependencies and config file creation to the Dockerfile --- .devcontainer/Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 1f5d76aff..d47696d51 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -8,7 +8,11 @@ RUN date RUN pip install --upgrade pip RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ - && apt-get -y install --no-install-recommends default-mysql-client ack bash-completion unixodbc unixodbc-dev + && apt-get -y install --no-install-recommends default-mysql-client ack bash-completion unixodbc unixodbc-dev \ + build-essential libssl-dev libffi-dev freetds-dev freetds-bin unixodbc-dev tdsodbc + +RUN sudo bash -c "echo -e '[FreeTDS]\nDescription=FreeTDS Driver\nDriver=/usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so\ +\nSetup=/usr/lib/x86_64-linux-gnu/odbc/libtdsS.so' >> /etc/odbcinst.ini" COPY requirements.txt /tmp/pip-tmp/ RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt && rm -rf /tmp/pip-tmp