예제 #1
0
 def readConfigVars(self):
     """
     Returns content of my.cnf
     @return ConfigParser config parser instance
     """                         
     if self.configVars:
         return self.configVars
     cnfContent = self.getConfigContent()
     if cnfContent: 
         self.configVars = iniparser.getInivars(cnfContent)
         return self.configVars 
예제 #2
0
 def readConfigVars(self):
     """
     Returns content of my.cnf
     @return ConfigParser config parser instance
     """
     if self.configVars:
         return self.configVars
     cnfContent = self.getConfigContent()
     if cnfContent:
         self.configVars = iniparser.getInivars(cnfContent)
         return self.configVars
예제 #3
0
    def __parse_db2cli_ini(self, content):
        """

        :param content: ini file content
        :type content: str or unicode
        :return: hostname, port, database
        :rtype: str, int, str
        """
        if content:
            lines = ifilter(None, imap(methodcaller('strip'), content.splitlines()))
            config = iniparser.getInivars(lines)
            items = dict(config.items(self._name))
            if items and items.get("dbalias") is None:
                return items.get("hostname"), items.get("port"), items.get("database")
예제 #4
0
    def __parse_db2cli_ini(self, content):
        """

        :param content: ini file content
        :type content: str or unicode
        :return: hostname, port, database
        :rtype: str, int, str
        """
        if content:
            lines = ifilter(None,
                            imap(methodcaller('strip'), content.splitlines()))
            config = iniparser.getInivars(lines)
            items = dict(config.items(self._name))
            if items and items.get("dbalias") is None:
                return items.get("hostname"), items.get("port"), items.get(
                    "database")