summaryrefslogtreecommitdiff
path: root/cloudinit/tests/test_upgrade.py
diff options
context:
space:
mode:
authorlucasmoura <lucas.moura@canonical.com>2021-04-12 13:22:22 -0300
committerGitHub <noreply@github.com>2021-04-12 12:22:22 -0400
commit83f6bbfbe5b924be61a3c098f4202377d69c8947 (patch)
tree0a6f8f9c0ec95b554774e94784977689b2629f2f /cloudinit/tests/test_upgrade.py
parentfb38aa591bca82b7aa89187695a2bff676d687cb (diff)
downloadvyos-cloud-init-83f6bbfbe5b924be61a3c098f4202377d69c8947.tar.gz
vyos-cloud-init-83f6bbfbe5b924be61a3c098f4202377d69c8947.zip
Fix unpickle for source paths missing run_dir (#863)
On the datasource class, we require the use of paths.run_dir to perform some operations. On older cloud-init version, the Paths class does not have the run_dir attribute. To fix that, we are now manually adding that attribute in the Paths object if doesn't exist in the unpickle operation. LP: #1899299
Diffstat (limited to 'cloudinit/tests/test_upgrade.py')
-rw-r--r--cloudinit/tests/test_upgrade.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/cloudinit/tests/test_upgrade.py b/cloudinit/tests/test_upgrade.py
index f79a2536..05eefd2a 100644
--- a/cloudinit/tests/test_upgrade.py
+++ b/cloudinit/tests/test_upgrade.py
@@ -43,3 +43,6 @@ class TestUpgrade:
def test_blacklist_drivers_set_on_networking(self, previous_obj_pkl):
"""We always expect Networking.blacklist_drivers to be initialised."""
assert previous_obj_pkl.distro.networking.blacklist_drivers is None
+
+ def test_paths_has_run_dir_attribute(self, previous_obj_pkl):
+ assert previous_obj_pkl.paths.run_dir is not None