[yum-cvs] yum cli.py,1.186,1.187 shell.py,1.19,1.20

Seth Vidal skvidal at login.linux.duke.edu
Thu Jun 30 05:58:02 UTC 2005


Update of /home/groups/yum/cvs/yum
In directory login:/tmp/cvs-serv9291

Modified Files:
	cli.py shell.py 
Log Message:

- make yum shell not exit when failing to enable/disable a repo
- fix an unneccesary sys.exit() in doRepoSetup()


Index: cli.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/cli.py,v
retrieving revision 1.186
retrieving revision 1.187
diff -u -r1.186 -r1.187
--- cli.py	27 Jun 2005 12:24:26 -0000	1.186
+++ cli.py	30 Jun 2005 05:58:00 -0000	1.187
@@ -68,10 +68,7 @@
 
         # Call parent class to do the bulk of work 
         # (this also ensures that reposetup plugin hook is called)
-        try:
-            yum.YumBase.doRepoSetup(self, thisrepo=thisrepo)
-        except yum.Errors.RepoError, e:
-            sys.exit(1)
+        yum.YumBase.doRepoSetup(self, thisrepo=thisrepo)
 
         if dosack: # so we can make the dirs and grab the repomd.xml but not import the md
             self.log(2, 'Reading repository metadata in from local files')

Index: shell.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/shell.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- shell.py	29 May 2005 06:14:36 -0000	1.19
+++ shell.py	30 Jun 2005 05:58:00 -0000	1.20
@@ -231,12 +231,20 @@
             for repo in repos:
                 try:
                     changed = self.base.repos.enableRepo(repo)
-                except yum.Errors.ConfigError, e:
+                except Errors.ConfigError, e:
                     self.base.errorlog(0, e)
+                except Errors.RepoError, e:
+                    self.base.errorlog(0, e)
+                    
                 else:
                     for repoid in changed:
-                        self.base.doRepoSetup(thisrepo=repoid)
-                    
+                        try:
+                            self.base.doRepoSetup(thisrepo=repoid)
+                        except Errors.RepoError, e:
+                            self.base.errorlog(0, 'Disabling Repository')
+                            self.base.repos.disableRepo(repo)
+                            return False
+                            
                     if hasattr(self.base, 'up'): # reset the updates
                         del self.base.up
             
@@ -245,9 +253,11 @@
             for repo in repos:
                 try:
                     self.base.repos.disableRepo(repo)
-                except yum.Errors.ConfigError, e:
+                except Errors.ConfigError, e:
                     self.base.errorlog(0, e)
-    
+                except Errors.RepoError, e:
+                    self.base.errorlog(0, e)
+
                 else:
                     if hasattr(self.base, 'pkgSack'): # kill the pkgSack
                         del self.base.pkgSack




More information about the Yum-cvs-commits mailing list