Skip to content

Instantly share code, notes, and snippets.

@mpdehaan
Created November 12, 2018 23:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpdehaan/2141f627784bed7ba432fab7b853cf4d to your computer and use it in GitHub Desktop.
Save mpdehaan/2141f627784bed7ba432fab7b853cf4d to your computer and use it in GitHub Desktop.
(env) llamaforge:opsmop michaeldehaan$ python bin/opsmop apply demo/conditionals.py
-----------------
1. File: /tmp/foo1.txt (signals: file1changed)
actions planned: (['chmod'])
result: ok
signals: file1changed
-----------------
2. File: /tmp/foo2.txt (signals: file2changed)
executing: (sha1sum /tmp/foo2.txt)
| fe8be4be067ee9110f934c795fe1e96949f3c229 /tmp/foo2.txt
> (ok, rc=0)
executing: (sha1sum files/foo2.txt)
| fe8be4be067ee9110f934c795fe1e96949f3c229 files/foo2.txt
> (ok, rc=0)
actions planned: ([])
result: ok
-----------------
3. File: /tmp/foo3.txt (signals: file3changed)
executing: (sha1sum /tmp/foo3.txt)
| 452e1b4dd8849f91a108f7f0a7590af21a50d8d9 /tmp/foo3.txt
> (ok, rc=0)
executing: (sha1sum files/foo3.txt)
| 452e1b4dd8849f91a108f7f0a7590af21a50d8d9 files/foo3.txt
> (ok, rc=0)
actions planned: ([])
result: ok
-----------------
4. Echo
| the OS distribution is MadeUpLinux
-----------------
5. Echo
| the value of x is True
-----------------
6. Shell
skipped, condition: <FileTest: /etc/motd.txt is present>
-----------------
7. Echo
| x is true at run time
-----------------
8. Echo
| a > b
-----------------
9. Echo
| c says go
-----------------
10. Echo
| this is unix? MadeUpLinux
-----------------
11. Echo
skipped, condition: All
-----------------
12. Echo
| one is true?
-----------------
13. Echo
skipped, condition: Choice
-----------------
14. Echo
skipped, condition: Equal
-----------------
15. Echo
skipped, condition: Equal
-----------------
16. Shell
actions planned: (['execute'])
executing: (date)
| Mon Nov 12 18:10:19 EST 2018
> (ok, rc=0)
result: ok, rc=0
-----------------
17. Echo
| shell output was Mon Nov 12 18:10:19 EST 2018
-----------------
18. Echo
skipped, condition: Equal
-----------------
19. Set
actions planned: (['set'])
| foo => 0
| bar => 0.5200645626415913
| baz => 3
| glorp => 6
| want => tails
result: ok
-----------------
20. Echo
| want=tails
-----------------
21. Stop
skipped, condition: More
-----------------
22. Shell
handling signal: file1changed
actions planned: (['execute'])
executing: (echo file1 has changed)
| file1 has changed
> (ok, rc=0)
result: ok, rc=0
resources:
scanned | 21
ran | 14
signaled | 1
changed | 12
skipped | 7
failed | 0
percentage | 100.00%
handlers:
scanned | 3
ran | 1
changed | 1
skipped | 0
failed | 0
percentage | 33.33%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment