diff --git a/cdist/conf/type/__cron/gencode-remote b/cdist/conf/type/__cron/gencode-remote index e1ac5ef9..c04a7245 100755 --- a/cdist/conf/type/__cron/gencode-remote +++ b/cdist/conf/type/__cron/gencode-remote @@ -49,6 +49,29 @@ state_should="$(cat "$__object/parameter/state" 2>/dev/null || echo "present")" [ "$state_is" = "$state_should" ] && exit 0 +# If anything is going to change, ensure the old entries are +# not present anymore + +# These are the old markers +prefix="#cdist:__cron/$__object_id" +suffix="#/cdist:__cron/$__object_id" +cat << DONE +crontab -u $user -l | awk -v prefix="$prefix" -v suffix="$suffix" ' +{ + if (index(\$0,prefix)) { + triggered=1 + } + if (triggered) { + if (index(\$0,suffix)) { + triggered=0 + } + } else { + print + } +} +' | crontab -u $user - +DONE + case "$state_should" in present) echo "(" diff --git a/docs/changelog.2.2 b/docs/changelog.2.2 new file mode 100644 index 00000000..25f926c2 --- /dev/null +++ b/docs/changelog.2.2 @@ -0,0 +1,10 @@ +Changelog +--------- + + * Changes are always commented with their author in (braces) + * Exception: No braces means author == Nico Schottelius + +2.2.0: + * Type __cron: Dropped support for old internal format + Using this version prior to running cdist 2.1.2 will + break add the cron entries twice.