As you use the environment to pass variables could you not create 2 small
awk scripts in say $__type/files/, one for adding, one for removing, which
you then cat to stdout after exporting the env vars?

--> Tested, but 90% off the script logic is needed in both cases, so I do
not want to do that.


2014-02-27 9:08 GMT+01:00 Steven Armstrong <notifications@github.com>:

> In cdist/conf/type/__key_value/gencode-remote:
>
> > @@ -68,3 +46,94 @@ DONE
> >         echo "Unknown state: $state_should" >&2
> >         exit 1
> >  esac
> > +
> > +cat <<__CDIST_HEREDOC_END_HERE_MARKER
>
> I think it's a good idea to use awk to do this. But I don't like it that
> you are *allways* generating code, even if there is nothing to do. We
> should try really hard to keep the generated code dumb. We should not push
> to much logic into the generated code. You have all you need to know in the
> gencode-remote script to decide what should be done. Personally I also
> don't like 'large' here docs - difficult to read.
>
> As you use the environment to pass variables could you not create 2 small
> awk scripts in say $__type/files/, one for adding, one for removing, which
> you then cat to stdout after exporting the env vars?
> Could you maybe y
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/telmich/cdist/pull/317/files#r10115011>
> .
>