Skip to content
Snippets Groups Projects
Commit 286b320d authored by Eesaan Atluri's avatar Eesaan Atluri
Browse files

Use rc_util class methods for logging and arg parsing in bright account create agent

parent ced31774
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,!45Revert 29 feat add user bright cm,!39WIP:Feat cod rmq,!29Feat add user bright cm
...@@ -3,6 +3,7 @@ import sys ...@@ -3,6 +3,7 @@ import sys
import json import json
import logging import logging
import argparse import argparse
import rc_util
from os import popen from os import popen
from rc_rmq import RCRMQ from rc_rmq import RCRMQ
...@@ -12,22 +13,10 @@ task = 'bright_account' ...@@ -12,22 +13,10 @@ task = 'bright_account'
rc_rmq = RCRMQ({'exchange': 'RegUsr', 'exchange_type': 'topic'}) rc_rmq = RCRMQ({'exchange': 'RegUsr', 'exchange_type': 'topic'})
# Parse arguments # Parse arguments
parser = argparse.ArgumentParser() args = rc_util.get_args()
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()
#Default Log level
log_lvl = logging.WARNING
if args.verbose:
log_lvl = logging.DEBUG
if args.dry_run:
log_lvl = logging.INFO
# Logger # Logger
logging.basicConfig(format='%(asctime)s %(levelname)s [%(module)s] - %(message)s', level=log_lvl) logger = rc_util.get_logger()
logger = logging.getLogger(__name__)
# Define your callback function # Define your callback function
def bright_account_create(ch, method, properties, body): def bright_account_create(ch, method, properties, body):
......
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