diff options
-rwxr-xr-x | cloudinit/sources/DataSourceAzure.py | 4 | ||||
-rw-r--r-- | tests/integration_tests/test_upgrade.py | 10 |
2 files changed, 9 insertions, 5 deletions
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py index f8641dfd..26c407ef 100755 --- a/cloudinit/sources/DataSourceAzure.py +++ b/cloudinit/sources/DataSourceAzure.py @@ -363,7 +363,9 @@ class DataSourceAzure(sources.DataSource): def _unpickle(self, ci_pkl_version: int) -> None: super()._unpickle(ci_pkl_version) - if "iso_dev" not in self.__dict__: + if not hasattr(self, "failed_desired_api_version"): + self.failed_desired_api_version = False + if not hasattr(self, "iso_dev"): self.iso_dev = None def __str__(self): diff --git a/tests/integration_tests/test_upgrade.py b/tests/integration_tests/test_upgrade.py index e90a5f9d..0ba4754c 100644 --- a/tests/integration_tests/test_upgrade.py +++ b/tests/integration_tests/test_upgrade.py @@ -84,11 +84,8 @@ def test_clean_boot_of_upgraded_package(session_cloud: IntegrationCloud): 'There were errors/warnings/tracebacks pre-upgrade. ' 'Any failures may be due to pre-upgrade problem') - # Upgrade and reboot + # Upgrade instance.install_new_cloud_init(source, take_snapshot=False) - instance.execute('hostname something-else') - instance.restart() - assert instance.execute('cloud-init status --wait --long').ok # 'cloud-init init' helps us understand if our pickling upgrade paths # have broken across re-constitution of a cached datasource. Some @@ -96,6 +93,11 @@ def test_clean_boot_of_upgraded_package(session_cloud: IntegrationCloud): # it here to ensure we get a dirty run. assert instance.execute('cloud-init init').ok + # Reboot + instance.execute('hostname something-else') + instance.restart() + assert instance.execute('cloud-init status --wait --long').ok + # get post values post_hostname = instance.execute('hostname') post_cloud_id = instance.execute('cloud-id') |