Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def main(config):
global LDAP_SETTINGS
LDAP_SETTINGS = config['ldap_sync']
metrics.init(config, 'oncall-ldap-user-sync', stats)
spawn(metrics_sender)
# Default sleep one hour
sleep_time = config.get('user_sync_sleep_time', 3600)
engine = create_engine(config['db']['conn']['str'] % config['db']['conn']['kwargs'],
**config['db']['kwargs'])
while 1:
logger.info('Starting user sync loop at %s' % time.time())
sync(config, engine)
logger.info('Sleeping for %s seconds' % sleep_time)
sleep(sleep_time)
def main():
with open(sys.argv[1], 'r') as config_file:
config = yaml.safe_load(config_file)
init_notifier(config)
metrics_on = False
if 'metrics' in config:
metrics.init(config, 'oncall-notifier', {'message_blackhole_cnt': 0, 'message_sent_cnt': 0, 'message_fail_cnt': 0})
metrics_worker = spawn(metrics_sender)
metrics_on = True
else:
logger.warning('Not running with metrics')
init_messengers(config.get('messengers', []))
worker_tasks = [spawn(worker) for x in xrange(100)]
reminder_on = False
if config['reminder']['activated']:
reminder_worker = spawn(reminder.reminder, config['reminder'])
reminder_on = True
validator_on = False
if config['user_validator']['activated']:
validator_worker = spawn(user_validator.user_validator, config['user_validator'])
validator_on = True