diff --git a/common/parser_config.py b/common/parser_config.py new file mode 100644 index 0000000000000000000000000000000000000000..2c9ed42f9e131a9ab8f68fb813de83c8c2bcf2e2 --- /dev/null +++ b/common/parser_config.py @@ -0,0 +1,50 @@ +#/bin/env python3 +# -*- encoding=utf8 -*- +""" +created by: miaokaibo +date: 2020-10-20 9:55 + +parser config.ini +""" +import os +import configparser + + +class ParserConfigIni(object): + """ + get parmers from config.ini file + """ + def __init__(self): + """ + init parmers by config.ini + return: None + """ + self.update_enabled_flag = {} + config_path = os.path.join( + os.path.split(os.path.realpath(__file__))[0], + "../config/config.ini") + self.config = configparser.ConfigParser() + self.config.read(config_path, encoding='utf-8') + self._init_update_enabled_flag() + + def _init_update_enabled_flag(self): + """ + init update enable flag for branch from config.ini + return: None + """ + branch_list = self.config.options("update_enable") + for b in branch_list: + self.update_enabled_flag[b] = self.config.get("update_enable", b) + + def get_update_enabled_flag(self): + """ + get update enabled flag for branch + return: update enable flag dict + """ + return self.update_enabled_flag + + +if __name__ == "__main__": + p = ParserConfigIni() + update_enabled_flag = p.get_update_enabled_flag() + print(update_enabled_flag) diff --git a/config/config.ini b/config/config.ini index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..489e1fd9652cf2546a018cc639bf4cf39a3f59f7 100644 --- a/config/config.ini +++ b/config/config.ini @@ -0,0 +1,5 @@ +[update_enable] +master = True +openEuler-20.03-LTS = True +openEuler-20.03-LTS-Next = True +openEuler-20.09 = True diff --git a/core/runner.py b/core/runner.py index 99d7dd0e296549d353c501269c70d84b0ae8ce14..b1983803af986a675cbd74efd9afca3bc6d6794c 100644 --- a/core/runner.py +++ b/core/runner.py @@ -1,9 +1,11 @@ #/bin/env python3 # -*- encoding=utf8 -*- """ +created by: miaokaibo +date: 2020-10-20 9:55 + main script for running """ - from common.log_obs import log @@ -17,7 +19,8 @@ class Runner(object): kwargs: dict, init dict by "a"="A" style return: """ - print(kwargs) + self.kwargs = kwargs + print(self.kwargs) def run(self): """