Variable 'ds_name' referenced before assignment

Bug #2028784 reported by James Falcon
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init (Ubuntu)
Fix Released
Undecided
Unassigned
Focal
Fix Released
Undecided
Unassigned
Jammy
Fix Released
Undecided
Unassigned
Lunar
Fix Released
Undecided
Unassigned
Mantic
Fix Released
Undecided
Unassigned

Bug Description

=== Begin SRU Template ===
[Impact]
In 23.2, a function was added to match a case-insensitive module name with its corresponding module. This includes setting a variable in a conditional and then referencing it later such that if the 'if condition' is missed, cloud-init will traceback with a variable reference before assignment exception.

The issue is triggered by a datasource specified in the datasource_list having a "DataSource" prefix. For example, on LXD:

datasource_list: [ "LXD" ]
and
datasource_list: [ "DataSourceLXD" ]

are both valid ways to specify the LXD data source. By default, datasources do not use the "DataSource" prefix in cloud-init, so unaltered Ubuntu images should not be affected. Any instance adding custom config to specify a datasource with the "DataSource" prefix is affected.

[Test Case]
* Create /etc/cloud/cloud.cfg.d/99-check-fix.cfg containing 'datasource_list: [ "DataSourceLXD", "None" ]'
* Verify cloud-init runs without traceback in /var/log/cloud-init.log
* Verify cloud-init correctly uses the LXD datasource

[Regression Potential]
If there is any other way we could mismatch a name, it's possible we would return an invalid datasource name that cannot be initialized.

[Other Info]
Upstream bug: https://github.com/canonical/cloud-init/issues/4288
Upstream fix: https://github.com/canonical/cloud-init/pull/4292

James Falcon (falcojr)
description: updated
James Falcon (falcojr)
description: updated
James Falcon (falcojr)
description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cloud-init - 23.3~4ga31370af-0ubuntu1

---------------
cloud-init (23.3~4ga31370af-0ubuntu1) mantic; urgency=medium

  * Upstream snapshot based on upstream/main at a31370af.
    - Bugs fixed in this snapshot: (LP: #1923363, #2028562, #2028784)
  * d/cloud-init.maintscript: Remove the unused hook-network-manager
    conffile. (LP: #2027861)
  * d/control: Add python3-passlib as needed for testing

 -- James Falcon <email address hidden> Mon, 31 Jul 2023 11:38:42 -0500

Changed in cloud-init (Ubuntu Mantic):
status: New → Fix Released
James Falcon (falcojr)
description: updated
Revision history for this message
Chris Halse Rogers (raof) wrote : Please test proposed package

Hello James, or anyone else affected,

Accepted cloud-init into lunar-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/cloud-init/23.2.2-0ubuntu0~23.04.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-lunar to verification-done-lunar. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-lunar. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in cloud-init (Ubuntu Lunar):
status: New → Fix Committed
tags: added: verification-needed verification-needed-lunar
Revision history for this message
Chris Halse Rogers (raof) wrote :

Hello James, or anyone else affected,

Accepted cloud-init into jammy-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/cloud-init/23.2.2-0ubuntu0~22.04.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-jammy to verification-done-jammy. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-jammy. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in cloud-init (Ubuntu Jammy):
status: New → Fix Committed
tags: added: verification-needed-jammy
Changed in cloud-init (Ubuntu Focal):
status: New → Fix Committed
tags: added: verification-needed-focal
Revision history for this message
Chris Halse Rogers (raof) wrote :

Hello James, or anyone else affected,

Accepted cloud-init into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/cloud-init/23.2.2-0ubuntu0~20.04.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Revision history for this message
James Falcon (falcojr) wrote :

Attached is the verification of Lunar, Jammy, and Focal

description: updated
James Falcon (falcojr)
tags: added: verification-done verification-done-focal verification-done-jammy verification-done-lunar
removed: verification-needed verification-needed-focal verification-needed-jammy verification-needed-lunar
Revision history for this message
Andreas Hasenack (ahasenack) wrote : Update Released

The verification of the Stable Release Update for cloud-init has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cloud-init - 23.2.2-0ubuntu0~23.04.1

---------------
cloud-init (23.2.2-0ubuntu0~23.04.1) lunar; urgency=medium

  * Upstream snapshot based on 23.2.2.
    List of changes from upstream can be found at
    https://raw.githubusercontent.com/canonical/cloud-init/23.2.2/ChangeLog
    - Bugs fixed in this snapshot: (LP: #2028562, #2028784)

 -- Alberto Contreras <email address hidden> Tue, 01 Aug 2023 14:12:28 +0200

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

This bug was fixed in the package cloud-init - 23.2.2-0ubuntu0~22.04.1

---------------
cloud-init (23.2.2-0ubuntu0~22.04.1) jammy; urgency=medium

  * Upstream snapshot based on 23.2.2.
    List of changes from upstream can be found at
    https://raw.githubusercontent.com/canonical/cloud-init/23.2.2/ChangeLog
    - Bugs fixed in this snapshot: (LP: #2028562, #2028784)

 -- Alberto Contreras <email address hidden> Tue, 01 Aug 2023 14:16:07 +0200

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

This bug was fixed in the package cloud-init - 23.2.2-0ubuntu0~20.04.1

---------------
cloud-init (23.2.2-0ubuntu0~20.04.1) focal; urgency=medium

  * Upstream snapshot based on 23.2.2.
    List of changes from upstream can be found at
    https://raw.githubusercontent.com/canonical/cloud-init/23.2.2/ChangeLog
    - Bugs fixed in this snapshot: (LP: #2028562, #2028784)

 -- Alberto Contreras <email address hidden> Tue, 01 Aug 2023 14:18:47 +0200

Changed in cloud-init (Ubuntu Focal):
status: Fix Committed → Fix Released
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.