Update Azure _unpickle (SC-500)#1067
Conversation
When self.failed_desired_api_version was added to DataSourceAzure, the attribute was never added to the _unpickle method using the upgrade framework. This commit adds the attribute. LP: #1946644
blackboxsw
left a comment
There was a problem hiding this comment.
I realize we can't add the test/data/old_pickles option here for integration testing on Azure because we only support that integration test on NoCloud.
But, shouldn't this have been caught by our existing test_upgrade integration test](https://github.com/canonical/cloud-init/blob/main/tests/integration_tests/test_upgrade.py#L93-L97)? I'm thinking that the cloud-init init call should actually have been called before the inst.restart() a couple lines above. Because, cloud-init init deserializing won't fail after an instance restart on Azure because of the /lib/systemd/system/cloud-init-local.service.d/50-azure-clear-persistent-obj-pkl.conf clearing that pickled datasource during init-local timeframe of next boot.
|
@blackboxsw , yeah, you're definitely right...especially given that comment in the code stating such 🤦♂️ . I updated the test accordingly. |
blackboxsw
left a comment
There was a problem hiding this comment.
+1 Let's bring this home.
Proposed Commit Message
Additional Context
Test Steps
Unfortunately, there's no easy way to test this via unit or integration test. Using a pre-existing pickle doesn't work because specific things like instance id or network interfaces will be different instance to instance and raise other issues.
To test manually:
Launch an Azure Bionic VM
On the instance, 'rm /lib/systemd/system/cloud-init-local.service.d/50-azure-clear-persistent-obj-pkl.conf'
Checkout cloud-init source at the 19.1 tag.
Build a package with the source (DEB_BUILD_OPTIONS=nocheck packages/bddeb -d)
Push the deb to the azure instance and install it
cloud-init clean --logs --reboot
Similarly, create deb of this branch and push and install
DON'T cloud-init clean
reboot, verify no failure due to attributes not found in Azure datasource.
Checklist: