| 1 |
An alternative / complementary approach to notifications: triggers (or actions?) |
| 2 |
|
| 3 |
A type may support various actions by creating files in its subdirectory |
| 4 |
"actions". Other types can trigger an action of a different type or object |
| 5 |
by calling them (indirectly?): |
| 6 |
|
| 7 |
|
| 8 |
if grep "__file/etc/nginx/conf.d/.*:copy" "$__notifications"; then |
| 9 |
|
| 10 |
# Call action from a type |
| 11 |
cdist trigger __nginx/reload |
| 12 |
fi |
| 13 |
|
| 14 |
|
| 15 |
Not sure whether this approach (calling "actions" of other types) is sane, |
| 16 |
as nginx should probably better know if it should be restarted "itself". |
| 17 |
|
| 18 |
|
| 19 |
-------------------------------------------------------------------------------- |
| 20 |
|
| 21 |
Alternate approach: |
| 22 |
|
| 23 |
__nginx_vhost www.some-domain.ch --custom << eof |
| 24 |
some custom code for __nginx_vhost inclusion |
| 25 |
eof |
| 26 |
|
| 27 |
__nginx_vhost: |
| 28 |
|
| 29 |
manifest: |
| 30 |
# __nginx_vhost requires __nginx: creates directories |
| 31 |
|
| 32 |
require"$__object_name" __nginx --require-only |
| 33 |
|
| 34 |
# Do WE or __file ... depend on nginx? |
| 35 |
cdist require __nginx |
| 36 |
|
| 37 |
# Create file that contains the giving code |
| 38 |
__file /etc/nginx/conf.d/www.some-domain.ch |
| 39 |
|
| 40 |
require="__nginx" __file /etc/nginx/conf.d/www.some-domain.ch |
| 41 |
|
| 42 |
__nginx: |
| 43 |
manifest: |
| 44 |
__package nginx --state present |
| 45 |
|
| 46 |
__file some-custom-files |
| 47 |
|
| 48 |
gencode-remote: |
| 49 |
if first_install or file changed: |