| 1 |
Meeting with: Steven, Thorsten, Nico |
| 2 |
|
| 3 |
Problem: execute my code only if somebody else's changed something. |
| 4 |
|
| 5 |
Proposals: |
| 6 |
|
| 7 |
1) Introduce new binary (Steven) |
| 8 |
|
| 9 |
gencode: |
| 10 |
|
| 11 |
if has_changed __file/etc/nginx.conf; then |
| 12 |
echo mycode |
| 13 |
fi |
| 14 |
|
| 15 |
2) Use -f plus new variable to cover .cdist/has_code: |
| 16 |
|
| 17 |
if [ -f $global/objects/__file/etc/nginx.conf/$has_code ]; then |
| 18 |
echo mycode |
| 19 |
fi |
| 20 |
|
| 21 |
And $has_code resolves to .cdist/has_code to cover the .cdist |
| 22 |
directory. |
| 23 |
|
| 24 |
3) Create a new tree that contains changed objects |
| 25 |
|
| 26 |
if [ -e $global/changed/__file/etc/nginx.conf ]; then |
| 27 |
echo mycode |
| 28 |
fi |
| 29 |
|
| 30 |
4) Use a \n seperated list |
| 31 |
|
| 32 |
if grep -q __file/etc/nginx.conf $global/changed; then |
| 33 |
echo mycode |
| 34 |
fi |
| 35 |
|
| 36 |
X) General problem (add to FAQ): |
| 37 |
|
| 38 |
When having "do something only if somebody else did something" |
| 39 |
it is possible that users get confused, because code will not |
| 40 |
be executed. |
| 41 |
|
| 42 |
This may especially happen in code development: |
| 43 |
|
| 44 |
a) User creates __file/etc/nginx.conf |
| 45 |
b) User creates a new type __nginx that restarts |
| 46 |
nginx, only if __file/etc/nginx.conf changed. |
| 47 |
But __file/etc/nginx.conf has already been deployed |
| 48 |
and thus will never be restarted. |
| 49 |
-------------------------------------------------------------------------------- |
| 50 |
|
| 51 |
Introduce exclude/conflicts attribute for types? |
| 52 |
|
| 53 |
Handling in cdist vs. handling in the types themselves? |
| 54 |
|
| 55 |
Examples: __file, __link, __directory |
| 56 |
|
| 57 |
Need to handle errors on low level for those anyway. |
| 58 |
|
| 59 |
Conclusion: Wait until we need exclude in a different type. |
| 60 |
|
| 61 |
Pro: |
| 62 |
Throw error as soon as possible without touching the target. |
| 63 |
|
| 64 |
Contra: |
| 65 |
No needod for most cases. |
| 66 |
Very controversal for stuff like __package and __package_gem |
| 67 |
for instance: rails; Should those two conflict or not? |