Skip to content

fix(azure): catch import error as reportable#6714

Merged
holmanb merged 23 commits into
canonical:mainfrom
cadejacobson:cade/catch-import-error
Mar 16, 2026
Merged

fix(azure): catch import error as reportable#6714
holmanb merged 23 commits into
canonical:mainfrom
cadejacobson:cade/catch-import-error

Conversation

@cadejacobson
Copy link
Copy Markdown
Contributor

@cadejacobson cadejacobson commented Feb 4, 2026

Proposed Commit Message

fix(azure): catch import error as reportable

Adds the ReportableErrorImportError class to catch
a known issue with unhandled exceptions when importing 
crypt and passlib, but both are missing.

Fixes GH-#6770

Test Steps

  • Create an Ubuntu 26.04 image with python3-passlib uninstalled
  • Deploy this image to Azure
  • Create a VM from the image, specifying an admin password
  • View error:
OS Provisioning failed for VM {VM_NAME} due to an internal error: result=error|reason=error importing passlib library|agent=Cloud-Init/99.0.0-1~bddeb|\'error=ModuleNotFoundError("No module named \'\'passlib\'\'")\'

Merge type

  • Squash merge using "Proposed Commit Message"

Resolves #6770
cc: @cjp256 @peytonr18

Comment thread cloudinit/sources/azure/errors.py Outdated
Comment thread cloudinit/sources/DataSourceAzure.py Outdated
Copy link
Copy Markdown
Contributor

@cjp256 cjp256 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great to capture the cloud-init log for the failure in your message to demonstrate the testing was done successfully.

Can you add a test case in:

  • test_errors.py for this new class
  • test_azure.py to demonstrate this. maybe look to test_query_vm_id_system_uuid_failure for inspiration

Thanks Cade!!

@holmanb holmanb self-assigned this Feb 5, 2026
@cadejacobson
Copy link
Copy Markdown
Contributor Author

It would be great to capture the cloud-init log for the failure in your message to demonstrate the testing was done successfully.

Can you add a test case in:

  • test_errors.py for this new class
  • test_azure.py to demonstrate this. maybe look to test_query_vm_id_system_uuid_failure for inspiration

Thanks Cade!!

Thanks for the review @cjp256!

Added in tests in those two files respectively. Also, I added the output message from the VM to the commit message above. I'd be happy to make any additional changes as needed.

Comment thread cloudinit/sources/DataSourceAzure.py Outdated
Comment thread tests/unittests/sources/azure/test_errors.py
Comment thread tests/unittests/sources/test_azure.py
Comment thread tests/unittests/sources/test_azure.py
@cadejacobson
Copy link
Copy Markdown
Contributor Author

This should be ready for review; the SSH key error that is failing the pipeline seems to be occurring in Main as well. It should not be a result of this change.

@cadejacobson cadejacobson requested a review from cjp256 February 17, 2026 15:57
Comment thread tests/unittests/sources/test_azure.py Outdated
Comment thread tests/unittests/sources/test_azure.py Outdated
@holmanb
Copy link
Copy Markdown
Member

holmanb commented Feb 27, 2026

@cadejacobson This doesn't merge cleanly. Please rebase on main branch.

@cadejacobson
Copy link
Copy Markdown
Contributor Author

@holmanb I have merged in the most recent main and re-pushed. If it specifically requires a rebase, I would be happy to do that as well.

@holmanb
Copy link
Copy Markdown
Member

holmanb commented Feb 27, 2026

That should suffice, thanks!

Copy link
Copy Markdown
Member

@holmanb holmanb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. Thanks!

@holmanb holmanb merged commit 724e085 into canonical:main Mar 16, 2026
22 checks passed
blackboxsw pushed a commit to blackboxsw/cloud-init that referenced this pull request Apr 13, 2026
Adds the ReportableErrorImportError class to catch
a known issue with unhandled exceptions when importing 
crypt and passlib, but both are missing.

Fixes canonicalGH-6770
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[enhancement]: catch missing passlib import as reportable for Azure

4 participants