-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpolicy.py
48 lines (37 loc) · 898 Bytes
/
policy.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from typing import Any
from autocracy.decrees import File, Group, Packages, RecursiveFiles, Run
pretenses: Any
foo = File(
target='/tmp/foo',
contents="Hello world!\n",
)
bar = File(
target='/tmp/bar',
contents="Hello world?\n",
activate_if=lambda: foo.updated,
)
pretensesfile = File(
target='/tmp/pretenses',
contents=f"{pretenses.uname.version} {pretenses[4].foo.bar()=}\n",
)
gitignore = File(
target='/tmp/gitignore',
source='.gitignore',
)
bin = RecursiveFiles(
target='/tmp/recursive',
source='bin',
mode='755',
)
hello = Packages(
remove={'hello'},
gentle=True,
purge=True,
recommends=False,
)
grp = Group(
file1=File(target='/tmp/1', contents="1\n"),
file2=File(target='/tmp/2', contents="2\n"),
)
ls = Run(command='date', activate_if=lambda: grp.updated)
grp.file3 = File(target='/tmp/3', contents="3\n")