File: 2011-04-19

package info (click to toggle)
cdist 7.0.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,992 kB
  • sloc: sh: 16,815; python: 9,199; makefile: 344; awk: 261
file content (67 lines) | stat: -rw-r--r-- 1,746 bytes parent folder | download | duplicates (6)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
Meeting with: Steven, Thorsten, Nico

Problem: execute my code only if somebody else's changed something.

Proposals:

1) Introduce new binary (Steven)

gencode:

if has_changed __file/etc/nginx.conf; then
   echo mycode
fi

2) Use -f plus new variable to cover .cdist/has_code:

if [ -f $global/objects/__file/etc/nginx.conf/$has_code ]; then
   echo mycode
fi

And $has_code resolves to .cdist/has_code to cover the .cdist
directory.

3) Create a new tree that contains changed objects

if [ -e $global/changed/__file/etc/nginx.conf ]; then
   echo mycode
fi

4) Use a \n seperated list

if grep -q __file/etc/nginx.conf $global/changed; then
   echo mycode
fi

X) General problem (add to FAQ):

   When having "do something only if somebody else did something"
   it is possible that users get confused, because code will not
   be executed.

   This may especially happen in code development:

   a) User creates __file/etc/nginx.conf
   b) User creates a new type __nginx that restarts
      nginx, only if __file/etc/nginx.conf changed.
      But __file/etc/nginx.conf has already been deployed
      and thus will never be restarted.
--------------------------------------------------------------------------------

Introduce exclude/conflicts attribute for types?

   Handling in cdist vs. handling in the types themselves?
   
   Examples: __file, __link, __directory

   Need to handle errors on low level for those anyway.

   Conclusion: Wait until we need exclude in a different type.

   Pro:
      Throw error as soon as possible without touching the target.

   Contra:
      No needod for most cases.
      Very controversal for stuff like __package and __package_gem
      for instance: rails; Should those two conflict or not?