[PATCH 01/15] Put NoSuchGroup and DispatchError back, but not in errors.py. (#760786)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Their use is very limited, so just define them in the modules that
use them primarily.
---
 pyanaconda/dispatch.py                 |   12 +++++++-----
 pyanaconda/kickstart.py                |    2 +-
 pyanaconda/yuminstall.py               |    3 +++
 tests/pyanaconda_test/dispatch_test.py |   14 +++++++-------
 4 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/pyanaconda/dispatch.py b/pyanaconda/dispatch.py
index 18bfa58..85e66b0 100644
--- a/pyanaconda/dispatch.py
+++ b/pyanaconda/dispatch.py
@@ -24,7 +24,6 @@ import string
 from types import *
 
 import indexed_dict
-import errors
 from constants import *
 from packages import writeKSConfiguration, turnOnFilesystems
 from packages import doPostAction
@@ -56,6 +55,9 @@ from packages import doReIPL
 import logging
 log = logging.getLogger("anaconda")
 
+class DispatchError(Exception):
+    pass
+
 class Step(object):
     SCHED_UNSCHEDULED = 0
     SCHED_SCHEDULED = 1 # will execute if not explicitly skipped
@@ -93,7 +95,7 @@ class Step(object):
         s_from = self.sched
         new_sched = self.sched_state_machine[self.sched][to_sched]
         if new_sched is False:
-            raise errors.DispatchError(
+            raise DispatchError(
                 "Can not reschedule step '%s' from '%s' to '%s'" %
                 (self.name,
                  self.namesched(self._sched),
@@ -307,7 +309,7 @@ class Dispatcher(object):
         for step in steps:
             try:
                 self.request_steps(step)
-            except errors.DispatchError as e:
+            except DispatchError as e:
                 log.debug("dispatch: %s" % e)
 
     def reset_scheduling(self):
@@ -315,7 +317,7 @@ class Dispatcher(object):
         for step in self.steps:
             try:
                 self.steps[step].unschedule(self._current_step())
-            except errors.DispatchError as e:
+            except DispatchError as e:
                 log.debug("dispatch: %s" % e)
         log.info("dispatch: resetting finished.")
 
@@ -333,7 +335,7 @@ class Dispatcher(object):
         for step in steps:
             try:
                 self.schedule_steps(step)
-            except errors.DispatchError as e:
+            except DispatchError as e:
                 log.debug("dispatch: %s" % e)
 
     def step_data(self, step):
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index bc3d8eb..17138e4 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -29,7 +29,7 @@ import storage.iscsi
 import storage.fcoe
 import storage.zfcp
 
-from errors import *
+from yuminstall import NoSuchGroup
 import iutil
 import isys
 import os
diff --git a/pyanaconda/yuminstall.py b/pyanaconda/yuminstall.py
index 3d334e2..e77d41a 100644
--- a/pyanaconda/yuminstall.py
+++ b/pyanaconda/yuminstall.py
@@ -72,6 +72,9 @@ urlgrabber.grabber.default_grabber.opts.user_agent = "%s (anaconda)/%s" %(produc
 import iutil
 import isys
 
+class NoSuchGroup(Exception):
+    pass
+
 def size_string (size):
     def number_format(s):
         return locale.format("%s", s, 1)
diff --git a/tests/pyanaconda_test/dispatch_test.py b/tests/pyanaconda_test/dispatch_test.py
index 9f2fac1..669ec53 100644
--- a/tests/pyanaconda_test/dispatch_test.py
+++ b/tests/pyanaconda_test/dispatch_test.py
@@ -13,7 +13,7 @@ class StepTest(mock.TestCase):
 
     def done_test(self):
         from pyanaconda.dispatch import Step
-        from pyanaconda.errors import DispatchError
+        from pyanaconda.dispatch import DispatchError
         s = Step("a_step")
         s.schedule(None)
         s.request(None)
@@ -37,7 +37,7 @@ class StepTest(mock.TestCase):
 
     def reschedule_test(self):
         from pyanaconda.dispatch import Step
-        from pyanaconda.errors import DispatchError
+        from pyanaconda.dispatch import DispatchError
         s = Step("a_step")
         s._reschedule(Step.SCHED_UNSCHEDULED, None)
         self.assertEqual(s.sched, Step.SCHED_UNSCHEDULED)
@@ -59,7 +59,7 @@ class StepTest(mock.TestCase):
 
     def request_test(self):
         from pyanaconda.dispatch import Step
-        from pyanaconda.errors import DispatchError
+        from pyanaconda.dispatch import DispatchError
         s = Step("a_step")
         s.request(None)
         self.assertRaises(DispatchError, s.skip, None)
@@ -72,7 +72,7 @@ class StepTest(mock.TestCase):
 
     def unschedule_test(self):
         from pyanaconda.dispatch import Step
-        from pyanaconda.errors import DispatchError
+        from pyanaconda.dispatch import DispatchError
         s = Step("a_step")
         s.schedule(None)
         self.assertEquals(s.sched, Step.SCHED_SCHEDULED)
@@ -84,7 +84,7 @@ class StepTest(mock.TestCase):
 
     def skip_test(self):
         from pyanaconda.dispatch import Step
-        from pyanaconda.errors import DispatchError
+        from pyanaconda.dispatch import DispatchError
         s = Step("a_step")
         s.skip(None)
         self.assertEquals(s.sched, Step.SCHED_SKIPPED)
@@ -162,7 +162,7 @@ class DispatchTest(mock.TestCase):
     def done_test(self):
         from pyanaconda.dispatch import Dispatcher
         from pyanaconda.dispatch import Step
-        from pyanaconda.errors import DispatchError
+        from pyanaconda.dispatch import DispatchError
 
         d = self._getDispatcher()
         self.assertFalse(d.step_enabled("betanag"))
@@ -197,7 +197,7 @@ class DispatchTest(mock.TestCase):
         self.assertTrue(d.step_enabled("filtertype"))
 
     def request_steps_gently_test(self):
-        from pyanaconda.errors import DispatchError
+        from pyanaconda.dispatch import DispatchError
         from pyanaconda.dispatch import Step
         d = self._getDispatcher()
         d.schedule_steps("betanag", "complete")
-- 
1.7.3.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux