Azure / Azure/WALinuxAgent

[BUG] WALinuxAgent removes LF from /etc/hostname.

Open
#2,742 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
581
Forks
397
Avg merge
2d 15h
Merged PRs (30d)
9

Description

**Describe the bug: A clear and concise description of what the bug is.**
During the boot sequence, OpenRC changes a hostname according to the `/etc/hostname`, and waagent also automatically writes the same hostname to `/etc/hostname` without a line feed (LF).
This causes problems because OpenRC assumes `/etc/hostname` ends with LF.

I think at least waagent should compare a new host name to the content of `/etc/hostname`, and change `/etc/hostname` only when necessary.

**Distro and WALinuxAgent details:**
$ waagent --version
WALinuxAgent-2.8.0.11 running on gentoo 2.9
Python: 3.10.9
Goal state agent: 2.8.0.11

Contributor guide

Open the contributing guide

Research direction

No file or test is named. Start by tracing WALinuxAgent's boot-sequence handling of /etc/hostname and reproduce the behavior with OpenRC on Gentoo; done means the hostname is compared before rewriting and the file retains its trailing LF when a write is needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.