Ejemplo n.º 1
0
def teardown_request(error=None):

    if not g.context==None:
        if g.context.get_auto_logoff():
            AppInfo.logoff(g.context)
            g.context.close()
        else:
            AppInfo.save_context(g.context)

    if error:
        print(str(error))
Ejemplo n.º 2
0
    def __init__(self):
        user = AppInfo.system_credentials()
        self.session_id = AppInfo.login(user['username'], user['password'])
        if self.session_id == None:
            create_logger(__name__).info(
                "username / password wrong or user is disaled")

        context = AppInfo.create_context(self.session_id)
        context.get_session_values()['timer_interval'] = 0
        context.get_session_values()['timer_unit'] = 'm'
        AppInfo.save_context(context)
Ejemplo n.º 3
0
def every_minute(signum):
    context = AppInfo.create_context(session.session_id)

    interval = int(context.get_session_values()['timer_interval']) + 1
    context.get_session_values()['timer_interval'] = interval
    unit = context.get_session_values()['timer_unit']
    create_logger(__name__).info(f"Interval: {interval}")
    AppInfo.save_context(context, close_context=False)

    #every minute
    execute_plugin(context, "$timer_every_minute", {})

    # every ten minutes
    if interval % 10 == 0:
        execute_plugin(context, "$timer_every_ten_minutes", {})

    # every hour
    if interval % 60 == 0:
        execute_plugin(context, "$timer_every_hour", {})

    AppInfo.save_context(context)
Ejemplo n.º 4
0
 def tearDown(self):
     AppInfo.save_context(self.context, True)
     AppInfo.logoff(self.context)
Ejemplo n.º 5
0
def async_action(arguments):
    context = AppInfo.create_context(session.session_id)
    create_logger(__name__).info("spool")
    AppInfo.save_context(context)
Ejemplo n.º 6
0
logger=create_logger(__name__)

parser = argparse.ArgumentParser(description='Build the metadata cache.')
parser.add_argument('--user','-u', type=str, help='restapi user')
parser.add_argument('--password','-p', type=str, help='restapi password')
args = parser.parse_args()

user=args.user
password=args.password

AppInfo.init(__name__, CONFIG['default'])

print(f"Host............:{AppInfo.get_current_config('mysql','host')}")
print(f"Database........:{AppInfo.get_current_config('mysql','database')}")
print(f"User............:{AppInfo.get_current_config('mysql','user')}")

session_id=AppInfo.login(args.user,args.password)
if session_id==None:
    print(f"connot log in")
    sys.exit(-1)

print(f"Session.........:{session_id}")
context=AppInfo.create_context(session_id)

build_table_fields_meta(context)

AppInfo.save_context(context, True)
AppInfo.logoff(context)