mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
samba.sites: reduce code duplication in Exception classes
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
358c0f20cc
commit
9ac5e3cf30
@ -28,35 +28,20 @@ class SiteException(Exception):
|
||||
self.value = value
|
||||
|
||||
def __str__(self):
|
||||
return "SiteException: " + self.value
|
||||
return "%s: %s" % (self.__class__.__name__, self.value)
|
||||
|
||||
|
||||
class SiteNotFoundException(SiteException):
|
||||
"""Raised when the site is not found and it's expected to exists."""
|
||||
|
||||
def __init__(self, value):
|
||||
self.value = value
|
||||
|
||||
def __str__(self):
|
||||
return "SiteNotFoundException: " + self.value
|
||||
|
||||
class SiteAlreadyExistsException(SiteException):
|
||||
"""Raised when the site is not found and it's expected not to exists."""
|
||||
|
||||
def __init__(self, value):
|
||||
self.value = value
|
||||
|
||||
def __str__(self):
|
||||
return "SiteAlreadyExists: " + self.value
|
||||
|
||||
class SiteServerNotEmptyException(SiteException):
|
||||
"""Raised when the site still has servers attached."""
|
||||
|
||||
def __init__(self, value):
|
||||
self.value = value
|
||||
|
||||
def __str__(self):
|
||||
return "SiteServerNotEmpty: " + self.value
|
||||
|
||||
def create_site(samdb, configDn, siteName):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user