summaryrefslogtreecommitdiff
path: root/cloudinit/sources
diff options
context:
space:
mode:
authorAnh Vo <anhvo@microsoft.com>2020-07-22 12:51:01 -0400
committerGitHub <noreply@github.com>2020-07-22 10:51:01 -0600
commitd600f47e91b904243263358324c413c4f7e5cf50 (patch)
treeb55154aa39c84867885d50e4dbbeeeaf76ed7ff7 /cloudinit/sources
parent995f8adf00509e5d2aefc9f0680c3c4894ae6666 (diff)
downloadvyos-cloud-init-d600f47e91b904243263358324c413c4f7e5cf50.tar.gz
vyos-cloud-init-d600f47e91b904243263358324c413c4f7e5cf50.zip
azure: disable bouncing hostname when setting hostname fails (#494)
DataSourceAzure: Gracefully handle the case of set hostname failure during provisioning
Diffstat (limited to 'cloudinit/sources')
-rwxr-xr-xcloudinit/sources/DataSourceAzure.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py
index 068537ee..a3810ca8 100755
--- a/cloudinit/sources/DataSourceAzure.py
+++ b/cloudinit/sources/DataSourceAzure.py
@@ -275,7 +275,14 @@ def temporary_hostname(temp_hostname, cfg, hostname_command='hostname'):
(previous_hostname == temp_hostname and policy != 'force')):
yield None
return
- set_hostname(temp_hostname, hostname_command)
+ try:
+ set_hostname(temp_hostname, hostname_command)
+ except Exception as e:
+ msg = 'Failed setting temporary hostname: %s' % e
+ report_diagnostic_event(msg)
+ LOG.warning(msg)
+ yield None
+ return
try:
yield previous_hostname
finally: