Exemplo n.º 1
0
def init():
    if not hasattr(config, 'SYSTEM'):
        config.init()
        config_file = GaDataFile().get()

        construction_dict = {}

        for setting in GaAgent.setting_list:
            if setting in config_file:
                try:
                    _ = int(config_file[setting])
                    construction_dict[setting] = _

                except ValueError:
                    construction_dict[setting] = config_file[setting]

        config.AGENT = GaAgent(
            setting_dict=construction_dict,
            object_id=0,
            name='TMP Agent',
            description='TMP Startup Agent Object',
        )

        config.SERVER = GaServer(
            setting_dict={
                'security': 1,
                'timezone': 'Europe/Vienna',
                'version': 1.0,
                'version_detail': 'a3e9e6383bdb23f4f9560a7ef805f299c80dd2fa',
            },
            object_id=0,
            name='TMP Server',
            description='TMP Startup Server Object',
        )
Exemplo n.º 2
0
def init(agent_obj, server_obj):
    try:
        _ = config.AGENT.path_root
        _ = config.SERVER.security

    except (AttributeError, NameError):
        config.init()
        config.AGENT = _create_pseudo_config(agent_obj)
        config.SERVER = _create_pseudo_config(server_obj)
Exemplo n.º 3
0
 def _init_shared_vars(self):
     config.init()
     config.CONFIG = self.CONFIG
     config.AGENT = self.CONFIG[factory_config.KEY_OBJECT_AGENT][0]
     config.SERVER = self.CONFIG[factory_config.KEY_OBJECT_SERVER][0]
Exemplo n.º 4
0
from os import chown
from grp import getgrnam
from pwd import getpwnam
from time import sleep
from datetime import datetime

from core.config import shared as config

# NOTE: the script must be executed as ga-serviceuser; else you will find that no logs can be written by the service while it is executing

config.init()


class Test:
    security = 0
    log_level = 0
    debug = 0
    path_root = '/var/lib/ga'
    path_log = '/var/log/ga'
    sql_secret = 'placeholder'


try:
    config.AGENT = Test()
    from connect import Client
    print(Client(path='ga.core.device.input.1').post(data='start'))
    sleep(0.2)

except KeyboardInterrupt:
    pass