Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cloud-init strips ending newline from "/var/lib/cloud/data/previous-hostname" #4096

Closed
ubuntu-server-builder opened this issue May 12, 2023 · 3 comments
Labels
launchpad Migrated from Launchpad

Comments

@ubuntu-server-builder
Copy link
Collaborator

This bug was originally filed in Launchpad as LP: #2015043

Launchpad details
affected_projects = []
assignee = None
assignee_name = None
date_closed = None
date_created = 2023-04-03T07:01:08.776906+00:00
date_fix_committed = 2023-04-05T22:05:44.836015+00:00
date_fix_released = None
id = 2015043
importance = undecided
is_complete = False
lp_url = https://bugs.launchpad.net/cloud-init/+bug/2015043
milestone = None
owner = anisinha
owner_name = Anirban Sinha
private = False
status = fix_committed
submitter = anisinha
submitter_name = Anirban Sinha
tags = []
duplicates = []

Launchpad user Anirban Sinha(anisinha) wrote on 2023-04-03T07:01:08.776906+00:00

Steps to Reproduce:

  1. enable cloud-init for rhel8

Actual results:
[root@mj-rhel87 ~]# cat /etc/hostname
mj-rhel87
[root@mj-rhel87 ~]# cat /var/lib/cloud/data/previous-hostname
mj-rhel87[root@mj-rhel87 ~]#

2023-03-28 14:47:45,733 - util.py[DEBUG]: Reading from /var/lib/cloud/data/previous-hostname (quiet=False)
2023-03-28 14:47:45,734 - util.py[DEBUG]: Read 9 bytes from /var/lib/cloud/data/previous-hostname
2023-03-28 14:47:45,734 - subp.py[DEBUG]: Running command ['hostname'] with allowed return codes [0] (shell=False, capture=True)
2023-03-28 14:47:45,738 - init.py[INFO]: /var/lib/cloud/data/previous-hostname differs from /etc/hostname, assuming user maintained hostname.

Expected results:
file /var/lib/cloud/data/previous-hostname will be terminated with new line as well

The issue is seen on RHEl 7, RHEL 8 and RHEL 9.

Ubuntu doesn't have this problem.

ubuntu@xiachen-test-ubuntu:$ cat /etc/hostname
xiachen-test-ubuntu
ubuntu@xiachen-test-ubuntu:
$ cat /var/lib/cloud/data/previous-hostname
xiachen-test-ubuntu
ubuntu@xiachen-test-ubuntu:~$

@ubuntu-server-builder ubuntu-server-builder added the launchpad Migrated from Launchpad label May 12, 2023
@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Anirban Sinha(anisinha) wrote on 2023-04-03T10:45:27.893162+00:00

Posted a PR: #2108

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Chad Smith(chad.smith) wrote on 2023-04-05T22:05:40.924299+00:00

Thanks Anirban for submitting the PR and Aciba for review/landing here. Marking Fix committed.

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Chad Smith(chad.smith) wrote on 2023-04-05T22:06:00.772853+00:00

Expect this fix released in cloud-init version 23.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
launchpad Migrated from Launchpad
Projects
None yet
Development

No branches or pull requests

1 participant