Skip to content
Snippets Groups Projects
Commit 9d7d6928 authored by Bo-Chun Chen's avatar Bo-Chun Chen
Browse files

Utilize logger from rc_util

parent 859e1b74
No related branches found
No related tags found
6 merge requests!147Merge previous default branch feat-cod-rmq into main,!85kill nginx process running under user from login node,!51Fix acct create wait,!39WIP:Feat cod rmq,!38WIP: Feat cod rmq,!21Feat git commit agent
......@@ -3,8 +3,7 @@ import os
import sh
import sys
import json
import argparse
import logging
import rc_util
from rc_rmq import RCRMQ
task = 'git_commit'
......@@ -17,17 +16,8 @@ repo_location = os.path.expanduser('~/git/rc-users')
users_dir = repo_location + '/users'
groups_dir = repo_location + '/groups'
# Default logger level
logger_lvl = logging.WARNING
# Parse arguments
parser = argparse.ArgumentParser()
parser.add_argument('-v', '--verbose', action='store_true', help='verbose output')
parser.add_argument('-n', '--dry-run', action='store_true', help='enable dry run mode')
args = parser.parse_args()
if args.verbose:
logger_lvl = logging.DEBUG
args = rc_util.get_args()
logger = rc_util.get_logger(args)
if not args.dry_run:
git = sh.git.bake('-C', repo_location)
......@@ -37,11 +27,6 @@ else:
git = sh.echo.bake('git', '-C', repo_location)
ldapsearch = sh.echo.bake('ldapsearch')
# Logger
logging.basicConfig(format='%(asctime)s [%(module)s] - %(message)s', level=logger_lvl)
logger = logging.getLogger(__name__)
def git_commit(ch, method, properties, body):
msg = json.loads(body)
username = msg['username']
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment