web: model: Allow unsetting IP address/hostname
This commit is contained in:
@@ -61,6 +61,9 @@ class Host(Base, Serializable):
|
||||
|
||||
@ipaddr.setter
|
||||
def ipaddr(self, value):
|
||||
if not value:
|
||||
self._ipaddr = None
|
||||
return
|
||||
if ':' in value:
|
||||
af = socket.AF_INET6
|
||||
else:
|
||||
@@ -77,6 +80,9 @@ class Host(Base, Serializable):
|
||||
|
||||
@hostname.setter
|
||||
def hostname(self, value):
|
||||
if not value:
|
||||
self._hostname = None
|
||||
return
|
||||
if not self.HOSTNAME_RE.match(value):
|
||||
raise ValueError('Invalid hostname: {}'.format(value))
|
||||
self._hostname = value
|
||||
|
||||
Reference in New Issue
Block a user