def __load_user(self): cfg = ConfigCommonDict() config_user_file = self['app']['config_user_file'] if 'config_user_file' in self['entry']: config_user_file = self['entry']['config_user_file'] cfg.load_from_file(expand_path(config_user_file)) return cfg
def __load_example(self): cfg = ConfigCommonDict() cfg['path'] = self['app']['example_config_user'] try: with open(self['app']['example_config_user']) as f: cfg['content'] = f.read() except Exception as e: _logger.warning('Open user config example failed: {0}'.format(e)) cfg['content'] = '' return cfg
def reset(self, config_entry=None, initial_env=None): self.__initial_env = initial_env if config_entry is None and 'entry' in self: config_entry = self['entry'].data() self.__config = {} self.__config['entry'] = ConfigCommonDict() for k, v in config_entry.items(): if v is not None: self['entry'][k] = v
def __load_option_list(self): cfg = ConfigCommonDict() if 'handler_python_dir' not in self['release_path']: _logger.debug('handler_python_dir not in release_path') return cfg try: with Handler(self['release_path']['handler_python_dir']) as h: cfg.update(h.run('option')) except HandlerNotFoundError: _logger.debug('Handler for option list not found') except Exception as e: _logger.error('Handler for option list run error: {0}'.format(e)) raise return cfg
def __load_output(self): cfg = ConfigCommonDict() # verbose cfg['verbose'] = False if 'verbose' in self['user']: cfg['verbose'] = self['user']['verbose'] if 'verbose' in self['entry']: cfg['verbose'] = self['entry']['verbose'] # quiet cfg['quiet'] = False if 'quiet' in self['user']: cfg['quiet'] = self['user']['quiet'] if 'quiet' in self['entry']: cfg['quiet'] = self['entry']['quiet'] return cfg
def __load_attribute(self): cfg = ConfigCommonDict() if 'handler_python_dir' not in self['release_path']: _logger.debug('handler_python_dir not in release_path') return cfg param = {} param['config_app'] = self['app'].data_copy() param['config_output'] = self['output'].data_copy() param['config_scenario'] = self['scenario'].data_copy() param['config_option'] = self['option'].data_copy() param['config_release_path'] = self['release_path'].data_copy() param['config_release_origin'] = self['release_origin'].data_copy() try: with Handler(self['release_path']['handler_python_dir']) as h: cfg.update(h.run('attribute', param)) except HandlerNotFoundError: _logger.debug('Handler for attribute not found') except Exception as e: _logger.error('Handler for attribute run error: {0}'.format(e)) raise return cfg
def __load_release_status(self): cfg = ConfigCommonDict() cfg.load_from_file(self['release_path']['status_file']) return cfg
def __load_info(self): cfg = ConfigCommonDict() cfg.load_from_file(expand_path(self['app']['config_info_file'])) return cfg