diff options
author | Christian Eichelmann <ceichelmann@gmx.de> | 2019-09-11 19:18:57 +0200 |
---|---|---|
committer | Liam Hopkins <liamh@google.com> | 2019-09-11 10:18:57 -0700 |
commit | 30d5d76bd70f8091c4293097f86a6808375362c1 (patch) | |
tree | 60b0748f54811bdbe77df207b6d602f6136a11fd | |
parent | 5e37f4e926a91aa804db67dbe4a28b422dd175f4 (diff) | |
download | google-compute-image-packages-30d5d76bd70f8091c4293097f86a6808375362c1.tar.gz |
fix network restart loop (#847)
if gethostname() returns the fqdn of the instance, hostname enforcement can cause continuous restart of the network. prevent this by only comparing the hostname part.
-rw-r--r-- | packages/python-google-compute-engine/google_compute_engine/networking/network_daemon.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/packages/python-google-compute-engine/google_compute_engine/networking/network_daemon.py b/packages/python-google-compute-engine/google_compute_engine/networking/network_daemon.py index 5a791cc..c15d597 100644 --- a/packages/python-google-compute-engine/google_compute_engine/networking/network_daemon.py +++ b/packages/python-google-compute-engine/google_compute_engine/networking/network_daemon.py @@ -107,7 +107,7 @@ class NetworkDaemon(object): for interface in network_interfaces: self.ip_forwarding.HandleForwardedIps( interface.name, interface.forwarded_ips, interface.ip) - if socket.gethostname() != result['hostname'].split('.')[0]: + if socket.gethostname().split('.')[0] != result['hostname'].split('.')[0]: self.distro_utils.RestartNetworking(self.logger) def _ExtractInterfaceMetadata(self, metadata): |