[Yum-devel] [PATCH 2/2] Warn about mis-spelling setopt stuff.
James Antill
james at and.org
Tue Nov 9 19:32:52 UTC 2010
---
cli.py | 3 +++
yum/__init__.py | 3 +++
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/cli.py b/cli.py
index b84183b..b01a1ef 100644
--- a/cli.py
+++ b/cli.py
@@ -230,6 +230,9 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
# now set all the non-first-start opts from main from our setopts
if self.main_setopts:
for opt in self.main_setopts.items:
+ if not hasattr(self.conf, opt):
+ msg ="Main config did not have a %s attr. before setopt"
+ self.logger.warning(msg % opt)
setattr(self.conf, opt, getattr(self.main_setopts, opt))
except yum.Errors.ConfigError, e:
diff --git a/yum/__init__.py b/yum/__init__.py
index a588dc8..cfb60b3 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -418,6 +418,9 @@ class YumBase(depsolve.Depsolve):
if thisrepo.id in self.repo_setopts:
for opt in self.repo_setopts[thisrepo.id].items:
+ if not hasattr(thisrepo, opt):
+ msg = "Repo %s did not have a %s attr. before setopt"
+ self.logger.warning(msg % (thisrepo.id, opt))
setattr(thisrepo, opt, getattr(self.repo_setopts[thisrepo.id], opt))
if validate and not validate(thisrepo):
--
1.7.2.3
More information about the Yum-devel
mailing list