Temporary compatibility layer for numhosts property support.
Temporary fix: AttributeError: 'IPNetwork' object has no attribute 'numhosts'
Change-Id: Ic3b18de3fc3b3e37cd6250a8e26ff010a3a6d80c
(cherry picked from commit ce22b15
)
This commit is contained in:
parent
7ed6cbdc05
commit
0099af9c7d
|
@ -36,6 +36,21 @@ from devops.models.volume import DiskDevice
|
|||
from devops.models.volume import Volume
|
||||
|
||||
|
||||
def _numhosts(self):
|
||||
msg = (
|
||||
'numhosts property is temporary compatibility spike '
|
||||
'and will be dropped soon! '
|
||||
'Replace by len(IPNetwork()) if required.'
|
||||
)
|
||||
logger.warning(msg)
|
||||
warn(msg, DeprecationWarning)
|
||||
return len(self)
|
||||
|
||||
IPNetwork.numhosts = property(
|
||||
fget=_numhosts,
|
||||
doc="""Temporary compatibility layer for numhosts property support.""")
|
||||
|
||||
|
||||
class Environment(DriverModel):
|
||||
class Meta(object):
|
||||
db_table = 'devops_environment'
|
||||
|
|
Loading…
Reference in New Issue