From: Huang Hao Date: Mon, 11 Mar 2013 10:42:25 +0000 (+0800) Subject: Remove useless try and reraise blocks. X-Git-Tag: 0.18~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f11008f4c3fe8adf14aa16d0106ed8e0baf087d7;p=tools%2Fmic.git Remove useless try and reraise blocks. These code catch all exceptions and simply reraise them, which is equivalent to not writing the try block. So just remove them to cleanup. Change-Id: I965356746a5b349458205de9c5a1d6bf97bf8d93 --- diff --git a/mic/bootstrap.py b/mic/bootstrap.py index ca42a19..66c291b 100644 --- a/mic/bootstrap.py +++ b/mic/bootstrap.py @@ -105,18 +105,15 @@ class MiniBackend(object): def downloadPkgs(self): nonexist = [] for pkg in self.dlpkgs: - try: - localpth = misc.get_package(pkg, self.repomd, self.arch) - if localpth: - self.localpkgs[pkg] = localpth - elif pkg in self.optionals: - # skip optional rpm - continue - else: - # mark nonexist rpm - nonexist.append(pkg) - except: - raise + localpth = misc.get_package(pkg, self.repomd, self.arch) + if localpth: + self.localpkgs[pkg] = localpth + elif pkg in self.optionals: + # skip optional rpm + continue + else: + # mark nonexist rpm + nonexist.append(pkg) if nonexist: raise errors.BootstrapError("Can't get rpm binary: %s" % @@ -215,13 +212,9 @@ class Bootstrap(object): pkgmgr.optionals = list(optlist) map(pkgmgr.selectPackage, pkglist + list(optlist)) pkgmgr.runInstall() - except (OSError, IOError, errors.CreatorError), err: raise errors.BootstrapError("%s" % err) - except: - raise - def run(self, cmd, chdir, rootdir=None, bindmounts=None): def mychroot(): os.chroot(rootdir) diff --git a/mic/kickstart/__init__.py b/mic/kickstart/__init__.py index 6594436..eb8bee2 100644 --- a/mic/kickstart/__init__.py +++ b/mic/kickstart/__init__.py @@ -315,10 +315,7 @@ class UserConfig(KickstartConfig): @apply_wrapper def apply(self, user): for userconfig in user.userList: - try: - self.addUser(userconfig) - except: - raise + self.addUser(userconfig) class ServicesConfig(KickstartConfig): """A class to apply a kickstart services configuration to a system.""" diff --git a/tools/mic b/tools/mic index 02a96df..b316dbf 100755 --- a/tools/mic +++ b/tools/mic @@ -90,11 +90,8 @@ class MicCmd(cmdln.Cmdln): @cmdln.alias("cr") def do_create(self, argv): - try: - cr = creator.Creator() - cr.main(argv[1:]) - except: - raise + cr = creator.Creator() + cr.main(argv[1:]) def _root_confirm(self): if os.geteuid() != 0: