Page MenuHomePhabricator

Fix the `base::service_unit` template scoping problem
Closed, ResolvedPublic

Description

Since base::service_unit (ab)uses a behaviour of puppet 3 that has changed with puppet 4, so that templates defined within this define could freely lookup variables from the calling resource, that is not possible anymore with puppet 4.

So we need a clear way to fix this. My first take was "fix the templates", but that's a ton of work and is admittedly ugly. I'd rather do the following, in order:

  • Create an helper function that auto-calculates the template name and renders it, the same way base::service_unit did.
  • Convert all base::service_unit declarations that are systemd-only to use systemd::service or systemd::unit
  • Change base::service_unit to accept content from the caller, and obtain that with the functions implemented earlier

This should give us the possibility to avoid touching the templates, and let us transition to the future parser with less friction.

Event Timeline

Change 371452 had a related patch set uploaded (by Giuseppe Lavagetto; owner: Giuseppe Lavagetto):
[operations/puppet@production] wmflib: add init_template functions

https://gerrit.wikimedia.org/r/371452

Change 371453 had a related patch set uploaded (by Giuseppe Lavagetto; owner: Giuseppe Lavagetto):
[operations/puppet@production] calico: convert calico-node to systemd::service

https://gerrit.wikimedia.org/r/371453

Change 371478 had a related patch set uploaded (by Giuseppe Lavagetto; owner: Giuseppe Lavagetto):
[operations/puppet@production] cassandra: convert to systemd::service

https://gerrit.wikimedia.org/r/371478

Change 371479 had a related patch set uploaded (by Giuseppe Lavagetto; owner: Giuseppe Lavagetto):
[operations/puppet@production] celery: convert to systemd::service

https://gerrit.wikimedia.org/r/371479

Change 371480 had a related patch set uploaded (by Giuseppe Lavagetto; owner: Giuseppe Lavagetto):
[operations/puppet@production] confluent: convert to systemd::service

https://gerrit.wikimedia.org/r/371480

Change 371481 had a related patch set uploaded (by Giuseppe Lavagetto; owner: Giuseppe Lavagetto):
[operations/puppet@production] systemd::service: convert a bunch of modules to it

https://gerrit.wikimedia.org/r/371481

Change 371452 merged by Giuseppe Lavagetto:
[operations/puppet@production] wmflib: add init_template functions

https://gerrit.wikimedia.org/r/371452

Change 371453 merged by Giuseppe Lavagetto:
[operations/puppet@production] calico: convert calico-node to systemd::service

https://gerrit.wikimedia.org/r/371453

Change 371478 merged by Giuseppe Lavagetto:
[operations/puppet@production] cassandra: convert to systemd::service

https://gerrit.wikimedia.org/r/371478

Change 371479 merged by Giuseppe Lavagetto:
[operations/puppet@production] celery: convert to systemd::service

https://gerrit.wikimedia.org/r/371479

Change 371480 merged by Giuseppe Lavagetto:
[operations/puppet@production] confluent: convert to systemd::service

https://gerrit.wikimedia.org/r/371480

Change 371482 had a related patch set uploaded (by Giuseppe Lavagetto; owner: Giuseppe Lavagetto):
[operations/puppet@production] prometheus: convert to systemd::service where needed

https://gerrit.wikimedia.org/r/371482

Change 371617 had a related patch set uploaded (by Giuseppe Lavagetto; owner: Giuseppe Lavagetto):
[operations/puppet@production] varnish: convert to systemd::service

https://gerrit.wikimedia.org/r/371617

Change 371618 had a related patch set uploaded (by Giuseppe Lavagetto; owner: Giuseppe Lavagetto):
[operations/puppet@production] thumbor,swift: convert to systemd::service and systemd::unit

https://gerrit.wikimedia.org/r/371618

Change 371619 had a related patch set uploaded (by Giuseppe Lavagetto; owner: Giuseppe Lavagetto):
[operations/puppet@production] base::service_unit: convert services to systemd::service

https://gerrit.wikimedia.org/r/371619

Change 371481 merged by Giuseppe Lavagetto:
[operations/puppet@production] systemd::service: convert a bunch of modules to it

https://gerrit.wikimedia.org/r/371481

Change 371482 merged by Giuseppe Lavagetto:
[operations/puppet@production] prometheus: convert to systemd::service where needed

https://gerrit.wikimedia.org/r/371482

Change 371617 merged by Giuseppe Lavagetto:
[operations/puppet@production] varnish: convert to systemd::service

https://gerrit.wikimedia.org/r/371617

Change 371618 merged by Giuseppe Lavagetto:
[operations/puppet@production] thumbor,swift: convert to systemd::service and systemd::unit

https://gerrit.wikimedia.org/r/371618

Change 371619 merged by Giuseppe Lavagetto:
[operations/puppet@production] base::service_unit: convert services to systemd::service

https://gerrit.wikimedia.org/r/371619

Joe claimed this task.