New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decouple the regen-conf mechanism from services #480

Open
wants to merge 13 commits into
base: stretch-unstable
from

Conversation

Projects
None yet
3 participants
@alexAubin
Copy link
Member

alexAubin commented May 21, 2018

The problem

Regen-conf is currently heavily coupled to the notion of services, and this is problematic / annoying for many reasons :

  • we have "pseudo-services" like "ssl", "nsswitch" and "yunohost" which are not actual services but just here to handle some configuration files
  • it's annoying to create a whole service, then add all the hack to make it "not a real service" when you in fact just want to manage a single file. This is why I ended up putting the management of etckeeper.conf inside the "yunohost" regen-conf hook
  • we have other examples of files we would like to manage independently of the notion of service, for instance the dns resolvers (c.f. #352 ) and cron jobs (dyndns, cert-renewal)

Solution

Decouple the regen-conf mechanism from the concept of services. To do this, the regen-conf related code was moved in a regenconf.py and file hashes are now stored in a regenconf.yml, independently from services.yml.

Of course that's a delicate operation since the regen-conf is one of the core feature of the core :o and a migration is required to properly handle this ... (which is why I ended up working on stretch-unstable to add a 6th migration)

The API also gets changed from yunohost service regen-conf (still supported but deprecated) to yunohost tools regen-conf.

Nevertheless, after this we'll be able to safely add simple conf-regen hooks for new files without all the weird "pseudo-service" thing.

PR Status

Needs some heavy testing to make sure this doesn't break anything

How to test

Pull this branch ... the first time you run a regen-conf, it should automatically migrate. Though we also need to test postinstall and a "real-life upgrade" (which triggers the postinst script and so on)

Validation

  • Principle agreement 0/2 :
  • Quick review 0/1 :
  • Simple test 0/1 :
  • Deep review 0/1 :

@alexAubin alexAubin changed the base branch from unstable to stretch-unstable May 21, 2018

Psycojoker and others added some commits May 21, 2018

@Psycojoker Psycojoker added this to the 3.x milestone May 22, 2018

@zamentur
Copy link
Contributor

zamentur left a comment

LGTM, read quickly, tested, migrations goes well

Show resolved Hide resolved src/yunohost/regenconf.py

@alexAubin alexAubin modified the milestones: 3.x, 3.2.x Aug 15, 2018

@zamentur
Copy link
Contributor

zamentur left a comment

There is some conflict

@alexAubin alexAubin modified the milestones: 3.2.x, 3.x Oct 24, 2018

@alexAubin alexAubin referenced this pull request Nov 27, 2018

Open

[fix] Don't backup cron files #442

0 of 4 tasks complete

@alexAubin alexAubin modified the milestones: 3.x, 3.4.x Nov 27, 2018

@alexAubin alexAubin modified the milestones: 3.4.x, 3.5.x Dec 20, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment