MCPcopy Create free account
hub / github.com/bootc-dev/bootc / load_groupnames

Function load_groupnames

crates/lib/src/sysusers_cleanup.rs:46–58  ·  view source on GitHub ↗

Load group names from a group-format file at `path` within `root`, returning an empty set if the file doesn't exist.

(root: &Dir, path: &str)

Source from the content-addressed store, hash-verified

44/// Load group names from a group-format file at `path` within `root`, returning
45/// an empty set if the file doesn't exist.
46fn load_groupnames(root: &Dir, path: &str) -> Result<HashSet<String>> {
47 use bootc_sysusers::nameservice::group::parse_group_content;
48 let mut names = HashSet::new();
49 if let Some(f) = root
50 .open_optional(path)
51 .with_context(|| format!("Opening {path}"))?
52 {
53 let entries = parse_group_content(std::io::BufReader::new(f))
54 .with_context(|| format!("Parsing {path}"))?;
55 names.extend(entries.into_iter().map(|e| e.name));
56 }
57 Ok(names)
58}
59
60// ── RemovedEntries ────────────────────────────────────────────────────────────
61

Callers 1

runFunction · 0.85

Calls 3

parse_group_contentFunction · 0.85
extendMethod · 0.45
into_iterMethod · 0.45

Tested by

no test coverage detected