1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2025-12-24 12:29:08 +00:00

Cleanup network mode & fix port mapping (#166)

* Cleanup network mode & fix port mapping

* Fix lint
This commit is contained in:
Pascal Vizeli
2017-08-24 16:39:06 +02:00
committed by GitHub
parent 04514a9f5c
commit 3525f5a02f
4 changed files with 27 additions and 10 deletions

View File

@@ -179,7 +179,7 @@ class Addon(object):
@property
def ports(self):
"""Return ports of addon."""
if self.network_mode or ATTR_PORTS not in self._mesh:
if self.host_network or ATTR_PORTS not in self._mesh:
return None
if not self.is_installed or \
@@ -222,11 +222,9 @@ class Addon(object):
return RE_WEBUI.sub(r"\g<1>{}\g<3>".format(real_port), webui)
@property
def network_mode(self):
"""Return network mode of addon."""
if self._mesh[ATTR_HOST_NETWORK]:
return 'host'
return None
def host_network(self):
"""Return True if addon run on host network."""
return self._mesh[ATTR_HOST_NETWORK]
@property
def devices(self):