--- yum/config.py | 23 +++++++++++++++++++++++ yum/yumRepo.py | 36 ++++++++++++++++++++++++------------ 2 files changed, 47 insertions(+), 12 deletions(-)
diff --git a/yum/config.py b/yum/config.py index 2ae7e89..f2830bc 100644 --- a/yum/config.py +++ b/yum/config.py @@ -39,6 +39,7 @@ if not _use_iniparse: from ConfigParser import ConfigParser import rpmUtils.transaction import Errors +import types # Alter/patch these to change the default checking... __pkgs_gpgcheck_default__ = False @@ -708,6 +709,28 @@ class YumConf(StartupConf): _reposlist = [] + def dump(self): + output = '[main]\n' + # we exclude all vars which start with _ or are in this list: + excluded_vars = ['cfg', 'uid', 'yumvar', 'progress_obj', 'failure_obj', + 'disable_excludes', 'config_file_age', 'config_file_path', + ] + for attr in dir(self): + if attr.startswith('_'): + continue + if attr in excluded_vars: + continue + if isinstance(getattr(self, attr), types.MethodType): + continue + res = getattr(self, attr) + if not res: + res = '' + if type(res) == types.ListType: + res = ', '.join(res) + output = output + '%s = %s\n' % (attr, res) + + return output + class RepoConf(BaseConfig): ''' Option definitions for repository INI file sections. diff --git a/yum/yumRepo.py b/yum/yumRepo.py index b95fd20..debae51 100644 --- a/yum/yumRepo.py +++ b/yum/yumRepo.py @@ -366,18 +366,30 @@ class YumRepository(Repository, config.RepoConf): def dump(self): output = '[%s]\n' % self.id - vars = ['name', 'bandwidth', 'enabled', 'enablegroups', - 'gpgcheck', 'repo_gpgcheck', # FIXME: gpgcheck => pkgs_gpgcheck - 'includepkgs', 'keepalive', 'proxy', - 'proxy_password', 'proxy_username', 'exclude', - 'retries', 'throttle', 'timeout', 'mirrorlist', 'metalink', - 'cachedir', 'gpgkey', 'pkgdir', 'hdrdir'] - vars.sort() - for attr in vars: - output = output + '%s = %s\n' % (attr, getattr(self, attr)) - output = output + 'baseurl =' - for url in self.urls: - output = output + ' %s\n' % url + # we exclude all vars which start with _ or are in this list: + excluded_vars = ['mediafunc', 'sack', 'metalink_data', 'grab', + 'grabfunc', 'repoXML', 'cfg', 'retrieved', + 'mirrorlistparsed', 'gpg_import_func', 'failure_obj', + 'callback', 'confirm_func', 'groups_added', + 'interrupt_callback', 'id', 'mirror_failure_obj', + 'repo_config_age', 'groupsfilename', 'copy_local', + 'basecachedir', 'http_headers', 'metadata_cookie', + 'metadata_cookie_fn', 'quick_enable_disable', + 'repoMDFile', 'timestamp_check', 'urls', 'mirrorurls', + 'yumvar', 'repofile'] + for attr in dir(self): + if attr.startswith('_'): + continue + if attr in excluded_vars: + continue + if isinstance(getattr(self, attr), types.MethodType): + continue + res = getattr(self, attr) + if not res: + res = '' + if type(res) == types.ListType: + res = ', '.join(res) + output = output + '%s = %s\n' % (attr, res) return output -- 1.6.2.5 _______________________________________________ Yum-devel mailing list Yum-devel@lists.baseurl.org http://lists.baseurl.org/mailman/listinfo/yum-devel