canonical / canonical/cloud-init

Azure data source assumes use of dhclient

Open
#3,891 2 comments 0 reactions 0 assignees View on GitHub
bug launchpad
Dominant language
Python
Stars
3.8k
Forks
1.1k
Avg merge
2d 23h
Merged PRs (30d)
18

Description

This bug was originally filed in Launchpad as [LP: #1936823](https://bugs.launchpad.net/cloud-init/+bug/1936823)

Launchpad details

affected_projects = []

assignee = None
assignee_name = None
date_closed = None
date_created = 2021-07-19T11:57:08.529823+00:00
date_fix_committed = None
date_fix_released = None
id = 1936823
importance = medium
is_complete = False
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1936823
milestone = None
owner = rjschwei
owner_name = Robert Schweikert
private = False
status = triaged
submitter = rjschwei
submitter_name = Robert Schweikert
tags = []
duplicates = []

_Launchpad user **Robert Schweikert(rjschwei)** wrote on 2021-07-19T11:57:08.529823+00:00_

The Azure data source assumes that all Linux distros use dhclient. Location of a lease file is hard coded to

"""
LEASE_FILE = '/var/lib/dhcp/dhclient.eth0.leases'
"""

and if the file is not found the data source reports errors:

"""
Failed to read /var/lib/dhcp/dhclient.eth0.leases: [Errno 2] No such file or directory: '/var/lib/dhcp/dhclient.eth0.leases'
"""

Further, during the cloud-init local stage cloud-init establishes a temporary dhclient connect but the lease file is written to a temporray location such as:

"""
/var/tmp/cloud-init/cloud-init-dhcp-sbhredt8/dhcp.leases
"""

The Azure data source should check if the network is up rather than depending on specific markers in the file system left by specific implementations for dhcp connections. The kernel sysfs provides more reliable methods to detect network connection precense.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.