Skip to content

Commit

Permalink
Azure DS: honor cloud_dir and add integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
aciba90 committed Jun 20, 2022
1 parent 42366ca commit fa9161b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cloudinit/sources/DataSourceAzure.py
Expand Up @@ -1445,8 +1445,10 @@ def _cleanup_markers(self):

@azure_ds_telemetry_reporter
def activate(self, cfg, is_new_instance):
instance_dir = self.paths.get_ipath_cur()
try:
address_ephemeral_resize(
instance_dir,
is_new_instance=is_new_instance,
preserve_ntfs=self.ds_cfg.get(DS_CFG_KEY_PRESERVE_NTFS, False),
)
Expand Down Expand Up @@ -1730,7 +1732,10 @@ def count_files(mp):

@azure_ds_telemetry_reporter
def address_ephemeral_resize(
devpath=RESOURCE_DISK_PATH, is_new_instance=False, preserve_ntfs=False
instance_dir: str,
devpath: str = RESOURCE_DISK_PATH,
is_new_instance: bool = False,
preserve_ntfs: bool = False,
):
if not os.path.exists(devpath):
report_diagnostic_event(
Expand All @@ -1756,7 +1761,7 @@ def address_ephemeral_resize(
return

for mod in ["disk_setup", "mounts"]:
sempath = "/var/lib/cloud/instance/sem/config_" + mod
sempath = os.path.join(instance_dir, "sem", "config_" + mod)
bmsg = 'Marker "%s" for module "%s"' % (sempath, mod)
if os.path.exists(sempath):
try:
Expand Down
1 change: 1 addition & 0 deletions tests/integration_tests/bugs/test_lp1976564.py
Expand Up @@ -36,6 +36,7 @@ def custom_client(

@pytest.mark.lxd_container
@pytest.mark.lxd_vm
@pytest.mark.azure
class TestLp1976564:
def verify_log_and_files(self, custom_client):
log_content = custom_client.read_from_file("/var/log/cloud-init.log")
Expand Down

0 comments on commit fa9161b

Please sign in to comment.