cloud-init writes sources.list without newline at end of file

Bug #1355343 reported by Robie Basak
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
Fix Released
Low
Unassigned
cloud-init (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

This happens on Utopic. Trusty is fine. Steps to reproduce:

sudo lxc-create -t ubuntu-cloud -n utopic -- -F -s daily -r utopic
sudo lxc-start-ephemeral -o trusty -n test -d
sudo lxc-attach -n test -- login -f root

Examine /etc/apt/sources.list inside the host. For example, "cat /etc/apt/sources.list" shows the subsequent prompt at the end of the last line instead of on a fresh line. "vim /etc/apt/sources.list" says "noeol".

Expected: newline at end of file, following Unix convention.
Actual: no newline at end of file.

Impact: messes up my local script that does trivial manipulations (adds a local repository).

I've examined the sources.list shipped with the image, and it doesn't have this problem and the sources.list I see after startup looks radically different (matching the template in /etc/cloud/...). So it seems to me that the templating mechanism inside cloud-init is causing this.

ProblemType: Bug
DistroRelease: Ubuntu 14.10
Package: cloud-init 0.7.6~bzr992-0ubuntu1
ProcVersionSignature: Ubuntu 3.13.0-7.26-generic 3.13.1
Uname: Linux 3.13.0-7-generic x86_64
NonfreeKernelModules: veth xt_conntrack ipt_REJECT ip6table_filter ip6_tables ebtable_nat ebtables overlayfs xt_CHECKSUM iptable_mangle ipt_MASQUERADE iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack xt_tcpudp bridge stp llc iptable_filter ip_tables x_tables dm_crypt kvm_intel kvm crct10dif_pclmul crc32_pclmul ghash_clmulni_intel microcode psmouse serio_raw aesni_intel aes_x86_64 glue_helper lrw gf128mul ablk_helper cryptd floppy
ApportVersion: 2.14.5-0ubuntu4
Architecture: amd64
Date: Mon Aug 11 18:00:26 2014
PackageArchitecture: all
ProcEnviron:
 TERM=screen
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: cloud-init
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

Revision history for this message
Robie Basak (racb) wrote :
Scott Moser (smoser)
Changed in cloud-init:
status: New → Confirmed
Changed in cloud-init (Ubuntu):
status: New → Confirmed
Changed in cloud-init:
importance: Undecided → Low
Changed in cloud-init (Ubuntu):
importance: Undecided → Low
Revision history for this message
Scott Moser (smoser) wrote :

fixed in revno 1033

Changed in cloud-init:
status: Confirmed → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cloud-init - 0.7.7~bzr1055-0ubuntu1

---------------
cloud-init (0.7.7~bzr1055-0ubuntu1) vivid; urgency=medium

  * New upstream snapshot.
    * move to python3 (LP: #1247132)
    * systemd: run cloud-init before systemd-user-sessions.service
    * Use the GCE short hostname. (LP: #1383794)
    * Enable user-data encoding support for GCE. (LP: #1404311)
    * Update to use a newer and better OMNIBUS_URL
    * Be more tolerant of 'ssh_authorized_keys' types
    * Fix parse_ssh_config failing in ssh_util.py
    * Increase the robustness/configurability of the chef module.
    * retain trailing newline from template files when using
      jinja2 (LP: #1355343)
    * fix broken output handling (LP: #1387340)
    * digital ocean datasource
    * update url in config drive documentation
    * freebsd: enable correct behavior on Ec2.
    * freebsd: Use the proper virtio FreeBSD network interface name.
 -- Scott Moser <email address hidden> Wed, 11 Feb 2015 15:55:58 -0500

Changed in cloud-init (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Scott Moser (smoser) wrote :

This is fixed in cloud-init 0.7.7

Changed in cloud-init:
status: Fix Committed → Fix Released
Revision history for this message
James Falcon (falcojr) wrote :
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.