2023-06-29 19:39:48 |
Chad Smith |
description |
SRU verification regression found during testing of https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1724623.
cloud-init 23.2 introduced a couple new functions to extract cloud-specific values automatically for apport bug reports in apport/general-hooks/cloud_init.py.
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/apport/general-hooks/cloud-init.py crashed:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport/report.py", line 226, in _run_hook
exec(compile(fd.read(), hook, 'exec'), symb)
File "/usr/share/apport/general-hooks/cloud-init.py", line 7, in <module>
def _get_azure_data(ds_data) -> dict[str, str]:
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 |
[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://bugs.launchpad.net/ubuntu/+source/cloud-init/bugs.
[ 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://archive.ubuntu.com/ubuntu
echo deb \$mirror \$(lsb_release -sc)-proposed main | tee /etc/apt/sources.list.d/proposed.list
apt-get update -q
apt-get install -qy cloud-init
EOF
cat > openstack.json <<EOF
{
"ds" : {},
"v1": {
"cloud_id": "openstack",
"cloud_name": "openstack",
"machine": "CloudArchitecture",
"platform": "openstack",
"region": null,
"subplatform": "metadata (http://169.254.169.254)"
}
}
EOF
cat > ec2.json << EOF
{
"ds": {
"imageId": "ami-123",
"instanceType": "m1.tiny",
"region": "us-east-1"
},
"v1": {
"cloud_name": "aws",
"distro": "ubuntu",
"distro_release": "jammy",
"distro_version": "22.04",
"instance_id": "i-06b5687b4d7b8595d",
"machine": "x86_64",
"platform": "ec2",
"python_version": "3.10.4",
"region": "us-east-2",
"variant": "ubuntu"
}
}
EOF
for release in focal jammy kinetic lunar; do
VM=sru-$release
lxc launch ubuntu-daily:$release $VM
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/$APPORT_FILE apport-$VM.orig
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/cloud-init/instance-data.json
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/$APPORT_FILE apport-$VM.openstack-proposed
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/cloud-init/instance-data.json
lxc exec $VM -- apport-bug cloud-init
APPORT_FILE=$(lxc exec $VM ls /tmp | grep apport)
lxc file pull $VM/tmp/$APPORT_FILE apport-$VM.ec2-proposed
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-$VM.openstack-proposed || true
echo --- 5. Inspect diff tags of openstack-proposed to ec2-proposed report
diff -urN apport-$VM.openstack-proposed apport-$VM.ec2-proposed || true
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://bugs.launchpad.net/ubuntu/+source/apport/+bug/1724623.
cloud-init 23.2 introduced a couple new functions to extract cloud-specific values automatically for apport bug reports in apport/general-hooks/cloud_init.py.
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/apport/general-hooks/cloud-init.py crashed:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport/report.py", line 226, in _run_hook
exec(compile(fd.read(), hook, 'exec'), symb)
File "/usr/share/apport/general-hooks/cloud-init.py", line 7, in <module>
def _get_azure_data(ds_data) -> dict[str, str]:
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 |
|