From 38f1df2524c13a4bf7c6afc7aa5ea06e85ab2acd Mon Sep 17 00:00:00 2001 From: Bo-Chun Louis Chen <louistw@uab.edu> Date: Fri, 14 May 2021 11:51:29 -0500 Subject: [PATCH] Fix F841 local variable never used --- agent_template.py | 2 ++ prod_rmq_agents/dir_verify.py | 2 +- prod_rmq_agents/get-next-uid-gid.py | 2 +- prod_rmq_agents/git_commit.py | 2 +- prod_rmq_agents/notify_user.py | 2 +- prod_rmq_agents/subscribe_mail_lists.py | 2 +- prod_rmq_agents/task_manager.py | 2 +- 7 files changed, 8 insertions(+), 6 deletions(-) diff --git a/agent_template.py b/agent_template.py index 07400ae..7858bdb 100644 --- a/agent_template.py +++ b/agent_template.py @@ -13,9 +13,11 @@ def on_message(ch, method, properties, body): # Retrieve routing key routing_key = method.routing_key + print(routing_key) # Retrieve message msg = json.loads(body) + print(msg) # Do Something print("[{}]: Callback called.".format(task)) diff --git a/prod_rmq_agents/dir_verify.py b/prod_rmq_agents/dir_verify.py index 162dad9..4b768c9 100644 --- a/prod_rmq_agents/dir_verify.py +++ b/prod_rmq_agents/dir_verify.py @@ -51,7 +51,7 @@ def dir_verify(ch, method, properties, body): " wrong" ) - except Exception as exception: + except Exception: msg["success"] = False msg["errmsg"] = "Exception raised, check the logs for stack trace" logger.error("", exc_info=True) diff --git a/prod_rmq_agents/get-next-uid-gid.py b/prod_rmq_agents/get-next-uid-gid.py index 2695ce6..42d6cc8 100644 --- a/prod_rmq_agents/get-next-uid-gid.py +++ b/prod_rmq_agents/get-next-uid-gid.py @@ -80,7 +80,7 @@ def resolve_uid_gid(ch, method, properties, body): create_account(msg) msg["task"] = task msg["success"] = True - except Exception as exception: + except Exception: msg["success"] = False msg["errmsg"] = ( "Exception raised during account creation, check logs for stack" diff --git a/prod_rmq_agents/git_commit.py b/prod_rmq_agents/git_commit.py index 38d6f8e..c8665c1 100644 --- a/prod_rmq_agents/git_commit.py +++ b/prod_rmq_agents/git_commit.py @@ -111,7 +111,7 @@ def git_commit(ch, method, properties, body): logger.info("Added ldif files and committed to git repo") msg["success"] = True - except Exception as exception: + except Exception: logger.error("", exc_info=True) # Send confirm message diff --git a/prod_rmq_agents/notify_user.py b/prod_rmq_agents/notify_user.py index 5e26547..d204bad 100644 --- a/prod_rmq_agents/notify_user.py +++ b/prod_rmq_agents/notify_user.py @@ -87,7 +87,7 @@ def notify_user(ch, method, properties, body): logger.debug(f"User {username} inserted into database") msg["success"] = True - except Exception as exception: + except Exception: logger.error("", exc_info=True) msg["errmsg"] = errmsg if errmsg else "Unexpected error" diff --git a/prod_rmq_agents/subscribe_mail_lists.py b/prod_rmq_agents/subscribe_mail_lists.py index 8003ea7..a70d007 100644 --- a/prod_rmq_agents/subscribe_mail_lists.py +++ b/prod_rmq_agents/subscribe_mail_lists.py @@ -61,7 +61,7 @@ def mail_list_subscription(ch, method, properties, body): s.quit() msg["task"] = task msg["success"] = True - except Exception as exception: + except Exception: logger.error("", exc_info=True) # Acknowledge message diff --git a/prod_rmq_agents/task_manager.py b/prod_rmq_agents/task_manager.py index 9ad0b78..e2e3edc 100644 --- a/prod_rmq_agents/task_manager.py +++ b/prod_rmq_agents/task_manager.py @@ -259,7 +259,7 @@ def task_manager(ch, method, properties, body): logger.debug(f"Notify level {task_name}? {success}") - except Exception as exception: + except Exception: logger.error("", exc_info=True) if send: -- GitLab