Beispiel #1
0
 def test_upgrade_does_not_change_other_errors(self):
     error_type = factory.make_exception_type()
     error = error_type()
     self.expectThat(error, Not(IsInstance(ExternalProcessError)))
     ExternalProcessError.upgrade(error)
     self.expectThat(error, Not(IsInstance(ExternalProcessError)))
     self.expectThat(error.__class__, Is(error_type))
Beispiel #2
0
 def test_upgrade_does_not_change_CalledProcessError_subclasses(self):
     error_type = factory.make_exception_type(bases=(CalledProcessError,))
     error = factory.make_CalledProcessError()
     error.__class__ = error_type  # Change the class.
     self.expectThat(error, Not(IsInstance(ExternalProcessError)))
     ExternalProcessError.upgrade(error)
     self.expectThat(error, Not(IsInstance(ExternalProcessError)))
     self.expectThat(error.__class__, Is(error_type))
Beispiel #3
0
def bind_reconfigure():
    """Ask BIND to reload its configuration and *new* zone files.

    From rndc(8):

      Reload the configuration file and load new zones, but do not reload
      existing zone files even if they have changed. This is faster than a
      full reload when there is a large number of zones because it avoids the
      need to examine the modification times of the zones files.

    """
    try:
        execute_rndc_command(("reconfig", ))
    except CalledProcessError as exc:
        maaslog.error("Reloading BIND configuration failed: %s", exc)
        # Log before upgrade so that the output does not go to maaslog.
        ExternalProcessError.upgrade(exc)
        raise
Beispiel #4
0
 def test_upgrade_upgrades_CalledProcessError(self):
     error = factory.make_CalledProcessError()
     self.expectThat(error, Not(IsInstance(ExternalProcessError)))
     ExternalProcessError.upgrade(error)
     self.expectThat(error, IsInstance(ExternalProcessError))
Beispiel #5
0
 def test_upgrade_returns_None(self):
     self.expectThat(
         ExternalProcessError.upgrade(factory.make_exception()), Is(None)
     )