apport general hooks break on type annotations
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init (Ubuntu) |
Fix Released
|
Critical
|
Chad Smith | ||
Focal |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
[Impact]
On Focal systems, inability to report using apport CLI.
apport-bug cloud-init will Traceback preventing apport report collection.
This would force folks to manually file bugs against cloud-init and attach supporting evidence at https:/
[ Test Plan ]
Assert `apport-bug cloud-init` doesn't immediately traceback on the commandline and includes expected Cloud* report fields for openstack and ec2.
test script (attached):
#!/bin/bash
set -ex
cat > setup_proposed.sh <<EOF
#/bin/bash
mirror=http://
echo deb \$mirror \$(lsb_release -sc)-proposed main | tee /etc/apt/
apt-get update -q
apt-get install -qy cloud-init
EOF
cat > openstack.json <<EOF
{
"ds" : {},
"v1": {
"cloud_id": "openstack",
"machine": "CloudArchitect
"platform": "openstack",
"region": null,
}
}
EOF
cat > ec2.json << EOF
{
"ds": {
"imageId": "ami-123",
"instanceType": "m1.tiny",
"region": "us-east-1"
},
"v1": {
"cloud_name": "aws",
"distro": "ubuntu",
"distro_
"distro_
"instance_id": "i-06b5687b4d7b
"machine": "x86_64",
"platform": "ec2",
"python_
"region": "us-east-2",
"variant": "ubuntu"
}
}
EOF
for release in focal jammy kinetic lunar; do
VM=sru-$release
lxc launch ubuntu-
while ! lxc exec $VM -- cloud-init status --wait --long; do
sleep 5
done
echo --- 1. Generate current apport report, selecting Openstack as cloud.
echo --- step through prompts and select 'K' to keep report
lxc exec $VM -- apport-bug cloud-init
APPORT_FILE=$(lxc exec $VM ls /tmp | grep apport)
lxc file pull $VM/tmp/
lxc exec $VM rm /tmp/$APPORT_FILE
lxc file push setup_proposed.sh $VM/
lxc exec $VM -- bash /setup_proposed.sh | grep cloud-init
lxc file push openstack.json $VM/run/
echo --- 2. Generate -proposed apport report which sources openstack instance-data.json, selecting Openstack as cloud.
lxc exec $VM -- apport-bug cloud-init
APPORT_FILE=$(lxc exec $VM ls /tmp | grep apport)
lxc file pull $VM/tmp/
lxc exec $VM rm /tmp/$APPORT_FILE
echo --- 3. Generate -proposed apport report which sources ec2 instance-data, selecting Ec2 as cloud.
lxc file push ec2.json $VM/run/
lxc exec $VM -- apport-bug cloud-init
APPORT_FILE=$(lxc exec $VM ls /tmp | grep apport)
lxc file pull $VM/tmp/
lxc exec $VM rm /tmp/$APPORT_FILE
# redact logs lines for easy diffs
for file in `ls apport*`; do
sed -i '1,/logs.tgz/!d' $file
done
echo --- 4. Inspect diff tags of orig to openstack-proposed report
diff -urN apport-$VM.orig apport-
echo --- 5. Inspect diff tags of openstack-proposed to ec2-proposed report
diff -urN apport-
done
[ Where problems could occur ]
apport Report could omit new Cloud* keys if instance-data.json is not processed correctly.
More likely, if python code/syntax or logic is invalid apport command will quickly generate Tracebacks on unexpected values or data types.
This would prevent someone from creating cloud-init specific bugs on the apport CLI.
[ Other Info ]
This bug represents a SRU regression found during testing cloud-init 23.2 in -proposed and only affects Focal. It doesn't regress Jammy, Kinetic or Lunar series.
[ Original Description ]
SRU verification regression found during testing of https:/
cloud-init 23.2 introduced a couple new functions to extract cloud-specific values automatically for apport bug reports in apport/
The functions _get_azure_data and _get_ec2_data added type hints which were incompatible with Focal's python3.8.
Attempts to run apport-bug cloud-init on focal results in immediate tracebacks which collecting apport info:
*** Collecting problem information
The collected information can be sent to the developers to improve the
application. This might take a few minutes.
......ERROR: hook /usr/share/
Traceback (most recent call last):
File "/usr/lib/
exec(
File "/usr/share/
def _get_azure_
TypeError: 'type' object is not subscriptable
.
*** Your device details (lshw) may be useful to developers when addressing this bug, but gathering it requires admin privileges. Would you like to include this info?
This regression will block SRU to focal. It does not affect Jammy or later series
Changed in cloud-init (Ubuntu): | |
status: | Triaged → Fix Committed |
description: | updated |
Changed in cloud-init (Ubuntu): | |
status: | Fix Committed → Fix Released |
Fix landed in upstream repo: https:/ /github. com/canonical/ cloud-init/ pull/4216/ files
Unapproved upload queued for SRU review to focal: 23.2.1- 0ubuntu0~ 20.04.2 /launchpad. net/ubuntu/ focal/+ queue?queue_ state=1& queue_text= cloud-init
https:/
https:/ /launchpadlibra rian.net/ 674661735/ cloud-init_ 23.2.1- 0ubuntu0~ 20.04.2_ source. changes
also uploaded to ppa:cloud- init-dev/ proposed /launchpad. net/~cloud- init-dev/ +archive/ ubuntu/ proposed/ +packages
https:/