Beispiel #1
0
    def __init__(self, database, theLogger=None):
        # initialise the logfile

        if theLogger == None:
            theLogger = nulLogger()

        self.log = theLogger

        self.log.debug("STARTED sqliteDB __init__")

        self.log.debug("STARTED process_config_file: filepaths")

        # Get the database we are using from the configuration file
        self.database = database

        self.log.debug("FINISHED sqlliteDB __init__ ")

        return
    def __init__(self, theConfig, theLogger=None):
        # initialise the logfile

        if theLogger == None:
            theLogger = nulLogger()

        self.log = theLogger

        self.log.debug("STARTED __init__")

        self.__set_config(theConfig)

        if self.api_ready():
            self.log.debug("__init__ - set_api_ready - building urls")
            self.build_api_url()

        self.log.debug("FINISHED __init__ ")

        return
Beispiel #3
0
    def __init__ (self, configFilePath=None, theLogger=None):
        # initialise the logfile
        if theLogger == None:
            theLogger = nulLogger()
        self.log = theLogger
        self.log.debug("STARTED __init__")


        if configFilePath == None:
            self.configFilePath = CONFIGPATH 

        if os.path.isfile(configFilePath) == False:
            print (f" getRates abandoned execution config file missing:{configFilePath}")
            self.configFilePath = None

        else:
            self.__load_config_file(configFilePath)

        self.log.debug("FINISHED __init__ ")
Beispiel #4
0
    def __init__(
        self,
        theConfig,
        theLogger=None,
    ):
        # initialise the logfile
        if theLogger == None:
            theLogger = nulLogger()

        self.log = theLogger

        self.log.debug("STARTED OctopusAgileDB __init__")

        self.log.debug("STARTED process_config_file: filepaths")

        # Get the database we are using from the configuration file
        self.database = theConfig.read_value('filepaths', 'database_file')

        if self.database == None:
            self.log.error("no database file path registered")
        else:
            self.dbobject = sqliteDB(self.database, theLogger)

        self.log.debug("STARTED process_config_file: chargebands")

        # Look at extreme - if not present use defaults
        rate = theConfig.read_value('chargebands', 'extreme_rate')
        if rate != None: self.chargebands["extreme"]["rate"] = rate

        # Look at high - if not present use defaults
        rate = theConfig.read_value('chargebands', 'high_rate')
        if rate != None: self.chargebands["high"]["rate"] = rate

        # Look at average - if not present use defaults
        rate = theConfig.read_value('chargebands', 'average_rate')
        if rate != None: self.chargebands["average"]["rate"] = rate

        # Look at good - if not present use defaults
        rate = theConfig.read_value('chargebands', 'good_rate')
        if rate != None: self.chargebands["good"]["rate"] = rate

        self.log.debug("FINISHED OctopusAgileDB __init__")
    def __init__ (self, theConfig, theLogger=None):
        # initialise the logfile
        if theLogger == None:
           theLogger = nulLogger()
        self.log = theLogger
        self.log.debug("STARTED __init__")

        self.__set_config(theConfig)

        if self.database == None :
            self.log.error("no database file path registered")
        else:
            self.dbobject = sqliteDB(self.database, theLogger)

        self.triggerFolder = theConfig.read_value('filepaths','trigger_folder')
        perms = theConfig.read_value('filepaths','trigger_permissions')

        permission = check_permission(perms, True)

        if self.triggerFolder == None or permission == None:
            print ("checkTriggers abandoned execution trigger path missing:")
            raise sys.exit(1)

        self.triggerPerms= int(perms,8)


        if os.path.isdir(self.triggerFolder) == False:
            try:
                os.mkdir(self.triggerFolder,self.triggerPerms)
            except OSError as error:
                print(f"checkTriggers Error - {error}")
                raise sys.exit(1)
        else:
            try:
                os.chmod(self.triggerFolder,self.triggerPerms)
            except OSError as error:
                print(f"checkTriggers Error - {error}")
                raise sys.exit(1)



        self.log.debug("FINISHED __init__ ")