1###############################################################################
2#+begin_src cfengine3
3bundle agent __main__
4# @brief Illustrating the behavior of rxdirs in perms bodies. Note, by default, when read is requested for a directory, execute is given as well.
5{
6  vars:
7      "example_dirs" slist => {
8                                "/tmp/rxdirs_example/rxdirs=default(true)-r",
9                                "/tmp/rxdirs_example/rxdirs=default(true)-rx",
10                                "/tmp/rxdirs_example/rxdirs=false-r",
11                                "/tmp/rxdirs_example/rxdirs=false-rx",
12      };
13
14  files:
15      "$(example_dirs)/."
16        create => "true";
17
18      "/tmp/rxdirs_example/rxdirs=default(true)-r"
19        perms => example:m( 600 );
20
21      "/tmp/rxdirs_example/rxdirs=default(true)-rx"
22        perms => example:m( 700 );
23
24      "/tmp/rxdirs_example/rxdirs=false-r"
25        perms => example:m_rxdirs_off( 600 );
26
27      "/tmp/rxdirs_example/rxdirs=false-rx"
28        perms => example:m_rxdirs_off( 700 );
29
30  reports:
31      "$(example_dirs) modeoct='$(with)'"
32        with => filestat( $(example_dirs), modeoct );
33}
34
35body file control{ namespace => "example"; }
36
37body perms m(mode)
38# @brief Set the file mode
39# @param mode The new mode
40{
41        mode   => "$(mode)";
42}
43body perms m_rxdirs_off(mode)
44# @brief Set the file mode, don't be clever and try to set +x on directory when +r is desired
45# @param mode The new mode
46{
47        inherit_from => m( $(mode) );
48        rxdirs => "false";
49}
50#+end_src
51###############################################################################
52#+begin_src example_output
53#@ ```
54#@ R: /tmp/rxdirs_example/rxdirs=default(true)-r modeoct='40700'
55#@ R: /tmp/rxdirs_example/rxdirs=default(true)-rx modeoct='40700'
56#@ R: /tmp/rxdirs_example/rxdirs=false-r modeoct='40600'
57#@ R: /tmp/rxdirs_example/rxdirs=false-rx modeoct='40700'
58#@ ```
59#+end_example
60