← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 2015043] [NEW] cloud-init strips ending newline from "/var/lib/cloud/data/previous-hostname"

 

Public bug reported:

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:~$

** Affects: cloud-init
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/2015043

Title:
  cloud-init strips ending newline from  "/var/lib/cloud/data/previous-
  hostname"

Status in cloud-init:
  New

Bug description:
  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:~$

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/2015043/+subscriptions