Azure data source assumes network is driven via dhcpclient

Bug #1845252 reported by Robert Schweikert
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
Expired
Medium
Unassigned

Bug Description

The Azure data source assumes that the network is set up by dhcpclient. During cloud-init initialization the following traceback is generated:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/cloudinit/sources/DataSourceAzure.py", line 668, in _negotiate
    fabric_data = metadata_func()
  File "/usr/lib/python3.6/site-packages/cloudinit/sources/helpers/azure.py", line 36, in impl
    return func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/cloudinit/sources/helpers/azure.py", line 458, in get_metadata_from_fabric
    return shim.register_with_azure_and_fetch_data(pubkey_info=pubkey_info)
  File "/usr/lib/python3.6/site-packages/cloudinit/sources/helpers/azure.py", line 36, in impl
    return func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/cloudinit/sources/helpers/azure.py", line 393, in register_with_azure_and_fetch_data
    'http://{0}/machine/?comp=goalstate'.format(self.endpoint))
  File "/usr/lib/python3.6/site-packages/cloudinit/sources/helpers/azure.py", line 272, in endpoint
    self.dhcpoptions)
  File "/usr/lib/python3.6/site-packages/cloudinit/sources/helpers/azure.py", line 36, in impl
    return func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/cloudinit/sources/helpers/azure.py", line 374, in find_endpoint
    fallback_lease_file)
  File "/usr/lib/python3.6/site-packages/cloudinit/sources/helpers/azure.py", line 36, in impl
    return func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/cloudinit/sources/helpers/azure.py", line 300, in _get_value_from_leases_file
    content = util.load_file(fallback_lease_file)
  File "/usr/lib/python3.6/site-packages/cloudinit/util.py", line 1359, in load_file
    with open(fname, 'rb') as ifh:
FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/dhcp/dhclient.eth0.leases'

Revision history for this message
Robert Schweikert (rjschwei) wrote :
Revision history for this message
Robert Schweikert (rjschwei) wrote :

On SUSE the option of interest is in /var/lib/wicked/lease-eth0-dhcp-ipv4.xml

Revision history for this message
Robert Schweikert (rjschwei) wrote :

This happens with 19.1, i.e. the current SUSE package. In master the code in question is wrapped with a try: except: block that avoids the traceback

 def _get_value_from_leases_file(fallback_lease_file):
        leases = []
        try:
            content = util.load_file(fallback_lease_file)
        except IOError as ex:
            LOG.error("Failed to read %s: %s", fallback_lease_file, ex)
            return None

Adding this to 19.1 leads to:

2019-09-25 13:03:35,101 - DataSourceAzure.py[WARNING]: Error communicating with Azure fabric; You may experience.connectivity issues.
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/cloudinit/sources/DataSourceAzure.py", line 668, in _negotiate
    fabric_data = metadata_func()
  File "/usr/lib/python3.6/site-packages/cloudinit/sources/helpers/azure.py", line 36, in impl
    return func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/cloudinit/sources/helpers/azure.py", line 462, in get_metadata_from_fabric
    return shim.register_with_azure_and_fetch_data(pubkey_info=pubkey_info)
  File "/usr/lib/python3.6/site-packages/cloudinit/sources/helpers/azure.py", line 36, in impl
    return func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/cloudinit/sources/helpers/azure.py", line 397, in register_with_azure_and_fetch_data
    'http://{0}/machine/?comp=goalstate'.format(self.endpoint))
  File "/usr/lib/python3.6/site-packages/cloudinit/sources/helpers/azure.py", line 272, in endpoint
    self.dhcpoptions)
  File "/usr/lib/python3.6/site-packages/cloudinit/sources/helpers/azure.py", line 36, in impl
    return func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/cloudinit/sources/helpers/azure.py", line 381, in find_endpoint
    raise ValueError('No endpoint found.')
ValueError: No endpoint found.

I am going to stop digging at this point.

Dan Watkins (oddbloke)
Changed in cloud-init:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
James Falcon (falcojr) wrote :
Changed in cloud-init:
status: Triaged → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.