← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~raharper/cloud-init:ubuntu/devel/fix-90-dpkg-cfg into cloud-init:ubuntu/devel

 

Ryan Harper has proposed merging ~raharper/cloud-init:ubuntu/devel/fix-90-dpkg-cfg into cloud-init:ubuntu/devel.

Commit message:
debian/cloud-init.config get_yaml_list should return only the value

When fixing LP #1841697 we mistakenly added the key and list brackets
to the return value of the get_yaml_list function. This resulted in
cloud-init.postinst which creates 90_dpkg.cfg to duplicate the key
and brackets resulting in an invalid yaml file. This commit removes
the emitted $key and [ ] portions resulting in valid yaml when
cloud-init.postinst renders 90_dpkg.cfg.

LP: #1846511

Requested reviews:
  cloud-init Commiters (cloud-init-dev)
Related bugs:
  Bug #1841697 in cloud-init (Ubuntu): "Upgrade corrupts 90_dpkg.cfg"
  https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1841697
  Bug #1846511 in cloud-init: "KVM and LXD integration testing failing on Eoan due to debian/cloud-init.config get_yaml_list error"
  https://bugs.launchpad.net/cloud-init/+bug/1846511

For more details, see:
https://code.launchpad.net/~raharper/cloud-init/+git/cloud-init/+merge/373920
-- 
Your team cloud-init Commiters is requested to review the proposed merge of ~raharper/cloud-init:ubuntu/devel/fix-90-dpkg-cfg into cloud-init:ubuntu/devel.
diff --git a/debian/cloud-init.config b/debian/cloud-init.config
index af38ffb..aacb1bf 100644
--- a/debian/cloud-init.config
+++ b/debian/cloud-init.config
@@ -37,9 +37,8 @@ get_yaml_list() {
 	[ -f "$file" ] || return 1
 	# strip all whitespace, delete lines not matching key:,
 	# strip key: and [] and replace ',' with ', '
-	LISTVAL="$(sed -e "s/\s//g" -e "/^$key:/"'!'d \
+	RET="$(sed -e "s/\s//g" -e "/^$key:/"'!'d \
 	           -e "s/$key:\[//" -e "s/]//" -e "s/,/, /g" "$file")"
-	RET="$key: [ ${LISTVAL} ]"
 	[ -n "$RET" ] || RET="$default"
 }
 

References