quattor / configuration-modules-core

Node Configuration Manager Components for Everyone
www.quattor.org
Other
6 stars 54 forks source link

ncm-systemd: Why is Environment modelled as a list of dicts? #1564

Open jrha opened 1 year ago

jrha commented 1 year ago

It is very confusing and we haven't documented it well.

I realise that upstream systemd supports multiple lines of assignments to allow later lines to override earlier ones, but does anyone actually have a use case for this? If so why can't it done at compile time?

Right now we just end up with lots of:

'/software/components/systemd/unit/{foo.service}/file/config/service/Environment/0/NODE_ENV' = 'production';

and

'Environment' = list(
    dict('CONFIG', '/etc/foo/bar.cfg'),
    dict('PIDFILE', '/run/foo-bar.pid'),
),

Which depending on ordering blows away configurtation and doesn't really help make code maintainable, as opposed to:

prefix '/software/components/systemd/unit/{foo.service}/file/config/service/Environment';
'NODE_ENV' = 'production';
'CONFIG' = '/etc/foo/bar.cfg';
'PIDFILE' = '/run/foo-bar.pid';
stdweird commented 1 year ago

the component was modelled after the capabilities of systemd. i don't think we ever used it either (would have to doublecheck)

it might be better to introduce some special key like {-} to indictate the start from empty line and handle it in the component for sure.

fyi, can't you use `prefix '/software/components/systemd/unit/{foo.service}/file/config/service/Environment/0' for now?