Skip to content

Commit 6895149

Browse files
committed
Added documentation for getgroups policy function
Ticket: ENT-12722 Signed-off-by: Victor Moene <victor.moene@northern.tech>
1 parent 126102a commit 6895149

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
layout: default
3+
title: getgroups
4+
---
5+
6+
{{< CFEngine_function_prototype(exclude_names, exclude_ids) >}}
7+
8+
**Description:** Returns a list of all groups defined, except those names in the comma separated string of `exclude_names` and the comma separated string of uids in `exclude_ids`
9+
10+
{{< CFEngine_function_attributes(exclude_names, exclude_ids) >}}
11+
12+
**Example:**
13+
14+
```
15+
bundle agent main
16+
{
17+
vars:
18+
"groups"
19+
slist => getgroups("root", "");
20+
21+
"first_three_groups"
22+
slist => sublist("@(groups)", head, 3);
23+
24+
reports:
25+
"$(first_three_groups)";
26+
27+
}
28+
```
29+
30+
**Output:**
31+
32+
```
33+
R: daemon
34+
R: bin
35+
R: sys
36+
```
37+
38+
**Notes:**
39+
40+
- This function is currently only available on Unix-like systems.
41+
- This function will return both local and remote (for example, groups defined in an external directory like LDAP) groups on a system.
42+
43+
**History:**
44+
45+
- Introduced in CFEngine 3.27.
46+
47+
**See also:** [`getgroupinfo()`][getgroupinfo].

0 commit comments

Comments
 (0)