Skip to content

Commit e44ff4b

Browse files
authored
Merge pull request #5046 from nickanderson/simple-small-examples-files-promise-type-docs/master
Core examples for simple small examples to files promise type docs
2 parents 078dc80 + fac5fce commit e44ff4b

File tree

4 files changed

+93
-0
lines changed

4 files changed

+93
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#+begin_src prep
2+
#@ ```
3+
#@ rm -f /tmp/hello && touch /tmp/hello
4+
#@ ```
5+
#+end_src
6+
#+begin_src cfengine3
7+
body agent control
8+
{
9+
inform => "true";
10+
}
11+
bundle agent __main__
12+
{
13+
files:
14+
"/tmp/hello"
15+
content => "Hello, CFEngine",
16+
if => fileexists("/tmp/hello");
17+
}
18+
#+end_src
19+
#+begin_src example_output
20+
#@ ```
21+
#@ info: Updated file '/tmp/hello' with content 'Hello, CFEngine'
22+
#@ ```
23+
#+end_src

examples/files-content-with.cf

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#+begin_src prep
2+
#@ ```
3+
#@ test -e /tmp/hello && rm /tmp/hello
4+
#@ ```
5+
#+end_src
6+
#+begin_src cfengine3
7+
body agent control
8+
{
9+
inform => "true";
10+
}
11+
bundle agent __main__
12+
{
13+
files:
14+
"/tmp/hello"
15+
content => "Output from stat: $(with)",
16+
with => execresult( 'stat -c "%U" /', "useshell" );
17+
}
18+
#+end_src
19+
#+begin_src example_output
20+
#@ ```
21+
#@ info: Created file '/tmp/hello', mode 0600
22+
#@ info: Updated file '/tmp/hello' with content 'Output from stat: root'
23+
#@ ```
24+
#+end_src

examples/files-content.cf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#+begin_src prep
2+
#@ ```
3+
#@ test -e /tmp/hello && rm -f /tmp/hello
4+
#@ ```
5+
#+end_src
6+
#+begin_src cfengine3
7+
body agent control
8+
{
9+
inform => "true";
10+
}
11+
bundle agent __main__
12+
{
13+
files:
14+
"/tmp/hello"
15+
content => "Hello, CFEngine";
16+
}
17+
#+end_src
18+
#+begin_src example_output
19+
#@ ```
20+
#@ info: Created file '/tmp/hello', mode 0600
21+
#@ info: Updated file '/tmp/hello' with content 'Hello, CFEngine'
22+
#@ ```
23+
#+end_src
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#+begin_src prep
2+
#@ ```
3+
#@ test -e /tmp/linux && rm /tmp/linux
4+
#@ ```
5+
#+end_src
6+
#+begin_src cfengine3
7+
body agent control
8+
{
9+
inform => "true";
10+
}
11+
bundle agent __main__
12+
{
13+
files:
14+
linux::
15+
"/tmp/linux"
16+
create => "true";
17+
}
18+
#+end_src
19+
#+begin_src example_output
20+
#@ ```
21+
#@ info: Created file '/tmp/linux', mode 0600
22+
#@ ```
23+
#+end_src

0 commit comments

Comments
 (0)