Skip to content

Commit

Permalink
Fix check_idmap_xml_filesystem_device failure
Browse files Browse the repository at this point in the history
Previously use name in line to get user id and group id.
In some cases, if there is one more name with same prefix in,it can get
wrong user information

Signed-off-by: chunfuwen <[email protected]>
  • Loading branch information
chunfuwen committed Sep 5, 2024
1 parent 37e94de commit c9d1669
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion virttest/utils_ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,14 @@ def _get_subid(id_filepath, name, info):
if not entry:
raise TestError("No entry for %s found in %s" % (name, id_filepath))

entry = entry[0].split(":")
matched_entry = None
for item in entry:
entry_name = item.strip().split(":")[0]
if entry_name == name:
matched_entry = item
break

entry = matched_entry.split(":")

key1, key2 = "subuid", "subuid_count"
if "subgid" in id_filepath:
Expand Down

0 comments on commit c9d1669

Please sign in to comment.