YunoHost-Apps / jitsi_ynh

Video conference for YunoHost
https://jitsi.org/
Apache License 2.0
21 stars 20 forks source link

Adding hook for metronome regen #11

Closed yalh76 closed 5 years ago

yalh76 commented 5 years ago

Problem

Solution

PR Status

Package_check results


Build Status

yalh76 commented 5 years ago

Dunno if that's really a clear explanation because that's tricky to explain but if you're around in the brique camp during the week I can tell you more about it ;P

Thanks for the informations, I will look at it. I hope to be at the brique camp on Wednesday night and maybe Thursday

yalh76 commented 5 years ago

Uuuuh I think you should consider having a look at the yunohost conf regen hook to see how they work.

so for instance here : https://github.com/YunoHost/yunohost/blob/stretch-unstable/data/hooks/conf_regen/12-metronome#L60-L74

You should feed $4 (the 'pending conf dir') to do_pre_regen and use it instead of defining your own temp_dir.

In fact ... the metronome hook runs before your hooks and the whole thing should looks something like :

1. core Metronome pre_regen, puts file in `${pending_dir}/etc/metronome`

2. your app pre_regen, should probably edit/patch the conf already in `${pending_dir}/../metronome/etc/metronome` (or maybe add additional files, idk your use case precisely).

   * for an example, check mailman [here](https://github.com/YunoHost-Apps/mailman_ynh/blob/master/sources/hooks/conf_regen/98-postfix_mailman#L9-L16)

3. ...yunohost decide or not to actually apply the conf from ${pending_dir} or not, c.f. the --dry-run option where the conf is generated but not actually applied in the "true" directories...

4. core post_regen (where it reloads the service possibly or fix some permission and other weird stuff _but it has nothing to do anymore about writing conf files_ anymore !)

5. your app post_regen ... i'm quite sure that you have nothing to do in it

@alexAubin

I have completely review the hook.

  1. Generating templates of the metronome config during install
  2. The hook copy the metronome template in the pending (I wasn't able to use ${pending_dir}/etc/metronome, $pending seems to not have a value)
  3. Tested and working.

I you can have a little look before merging