Esempio n. 1
0
    args = parser.parse_args()

    if args.quite:
        mlogger.setLevel(logging.CRITICAL + 1)
    if args.debug:
        mlogger.setLevel(logging.DEBUG)

    confadditionalsubstitutions = list()
    confadditionalsubstitutions.append(("%%PWD%%", os.getcwd()))
    confadditionalsubstitutions.append(("%%SEP%%", os.path.sep))
    confadditionalsubstitutions.append(("%%DATE%%", datetime.datetime.now().strftime("%Y-%m-%d_%H:%M:%S")))
    confadditionalsubstitutions.append(("%%DATE_UTC_EPOCH%%", str(int(time.time()))))
    confadditionalsubstitutions.append(("%%USERNAME%%", getpass.getuser()))

    bootstrapconfig = jeggings_utils.load_configuration_from_json(args.configurationresource,
                                                                  args.configurationschema,
                                                                  withdefaults=True,
                                                                  additionalsubstitutions=confadditionalsubstitutions)

    if bootstrapconfig is None:
        mlogger.critical("Could not load configuration")
        sys.exit(-1)

    j = Jeggings(bootstrapconfig, True, mlogger)

    if args.debug:
        j.associate_messagehandler_with_regexs(JeggingsDebergMessageHandler(j), ["(.*)"])

    j.associate_messagehandler_with_regexs(JegggingsFreeRoomsMessageHandler(j), ["^rooms(.*)"])
    j.associate_messagehandler_with_regexs(JegggingsUserSearchMessageHandler(j), ["^search (.*)"])

    while j.is_running() and _keeprunning: