diff options
author | Tim Laszlo <tim.laszlo@gmail.com> | 2010-07-29 13:37:41 +0000 |
---|---|---|
committer | Sol Jerome <sol.jerome@gmail.com> | 2010-07-30 11:53:16 -0500 |
commit | 682ff68ecfc16e24bbe1a413e19639e4c7a15d9b (patch) | |
tree | ac948f1f36c2983cec908660509a51babae683fb /src/lib/Client/Tools/YUMng.py | |
parent | 368f9c770c0eadc8a4cf4b54255ee8d51b55c95b (diff) | |
download | bcfg2-682ff68ecfc16e24bbe1a413e19639e4c7a15d9b.tar.gz bcfg2-682ff68ecfc16e24bbe1a413e19639e4c7a15d9b.tar.bz2 bcfg2-682ff68ecfc16e24bbe1a413e19639e4c7a15d9b.zip |
YUMng: Better error handling for installs
Currently a missing package throws an exception during the install. This
traps it and gracefully logs an error.
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5993 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Client/Tools/YUMng.py')
-rw-r--r-- | src/lib/Client/Tools/YUMng.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/lib/Client/Tools/YUMng.py b/src/lib/Client/Tools/YUMng.py index cc13b00b9..07bf38793 100644 --- a/src/lib/Client/Tools/YUMng.py +++ b/src/lib/Client/Tools/YUMng.py @@ -344,14 +344,20 @@ class YUMng(Bcfg2.Client.Tools.RPMng.RPMng): for inst in install_pkgs: pkg_arg = self.instance_status[inst].get('pkg').get('name') - self.yb.install(**build_yname(pkg_arg, inst)) + try: + self.yb.install(**build_yname(pkg_arg, inst)) + except yum.Errors.YumBaseError, yume: + self.logger.error("Error installing some packages: %s" % yume) if len(upgrade_pkgs) > 0: self.logger.info("Attempting to upgrade packages") for inst in upgrade_pkgs: pkg_arg = self.instance_status[inst].get('pkg').get('name') - self.yb.update(**build_yname(pkg_arg, inst)) + try: + self.yb.update(**build_yname(pkg_arg, inst)) + except yum.Errors.YumBaseError, yume: + self.logger.error("Error upgrading some packages: %s" % yume) self._runYumTransaction() |