Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cloudinit/config/cc_mounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@ def mount_if_needed(
do_mount = bool(set(dirs).difference(mount_points))

if do_mount:
util.udevadm_settle()
subp.subp(["mount", "-a"])
if uses_systemd:
subp.subp(["systemctl", "daemon-reload"])
Expand Down
4 changes: 4 additions & 0 deletions tests/unittests/config/test_cc_mounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,9 @@ def setup(self, mocker, fake_fs):
fake_fs.create_dir("/etc")

self.m_subp = mocker.patch(f"{M_PATH}subp.subp")
self.m_udevadm_settle = mocker.patch(
f"{M_PATH}util.udevadm_settle"
)
self.m_mounts = mocker.patch(
f"{M_PATH}util.mounts",
return_value={
Expand Down Expand Up @@ -473,6 +476,7 @@ def test_no_change_fstab_sets_needs_mount_all(self):
with open(cc_mounts.FSTAB_PATH, "r") as fd:
fstab_new_content = fd.read()
assert fstab_original_content == fstab_new_content.strip()
self.m_udevadm_settle.assert_called_once_with()
self.m_subp.assert_has_calls(
[
mock.call(["mount", "-a"]),
Expand Down