Skip to content
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

rc: improve NAME_setup handling #1258

Merged
merged 1 commit into from
May 29, 2024
Merged

Conversation

fichtner
Copy link
Contributor

Reload is used for service reconfiguration as well and lacks a NAME_prepend-like mechanism so it makes sense to extend the NAME_reload hook into this
action.

precmd may use configuration checks and blocks setup from doing its designated work (e.g. nginx). In moving the invoke of the setup script in front allows us to provide custom scripts for config file generation and fixing prior to precmd checking configuration integrity.

Also introduce _run_rc_setup to separate the launcher from the main one. Let it run correctly in the case of restart_precmd and block further execution as
would be the case in start due to the internal plumbing of restart being split into calling stop and start afterwards.

Also see: https://reviews.freebsd.org/D36259

@fichtner
Copy link
Contributor Author

2efbd48 may have gotten in the way just this week. The review has been open since 2022 and I'm a bit discouraged to sink in more work without a path to complete the implementation of c9be47b

@bsdimp
Copy link
Member

bsdimp commented May 25, 2024

2efbd48 may have gotten in the way just this week. The review has been open since 2022 and I'm a bit discouraged to sink in more work without a path to complete the implementation of c9be47b

Pull requests are happening because too many phabs fell on the floor like this. I totally understand your frustration.

@bsdimp
Copy link
Member

bsdimp commented May 25, 2024

2efbd48 may have gotten in the way just this week. The review has been open since 2022 and I'm a bit discouraged to sink in more work without a path to complete the implementation of c9be47b

Pull requests are happening because too many phabs fell on the floor like this. I totally understand your frustration.

And does this still work correctly?

@fichtner
Copy link
Contributor Author

It did appear to do the right thing but let me double check on Monday and report back.

Comment on lines +1307 to +1309
if [ "$rc_arg" = 'start' -o \
"$rc_arg" = 'restart' -o \
"$rc_arg" = 'reload' ]; then
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just for reference I'm thinking about making this configurable because www/caddy also has a "reloadssl" option which requires setup to be run but will be missed here because it's a hand-rolled command

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would that look like?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the case of caddy it requires dealing with this extended reload concept :

www/caddy/files/caddy.in:reloadssl_cmd="caddy_execute reload --force ${caddy_flags}"

So when we are in this condition here we also check for existence of reloadssl_setup="YES" with a if ! checkyesno $_setup; then -- it requires fixing affected ports but only since the port was extended in this particular way.

I think it's fair to assume this only pertains to custom $_cmd definitions. For general service handling start, restart and reload do the right thing since they are the unmodified standard commands then and shouldn't be disabled, but it could also be added for consistency.

@fichtner
Copy link
Contributor Author

Ok this works as expected. Shall I bump the date in the manual page?

@bsdimp
Copy link
Member

bsdimp commented May 28, 2024

Yes. I may land this on the plane or at the hotel tonight. Generally i tell people not to do that, but in this case it's fine and would help me.

Also, if you could add a signed-off-by line that would be great since you are pushing anyway. It's desired, but not mandatory though. Thanks.

@fichtner fichtner force-pushed the rc_setup branch 2 times, most recently from db1c6de to 50f72cc Compare May 28, 2024 14:30
@fichtner
Copy link
Contributor Author

@bsdimp done, all yours

@bsdimp bsdimp self-assigned this May 29, 2024
@bsdimp
Copy link
Member

bsdimp commented May 29, 2024

OK. One more sanity check and I'll commit. Too much for today, though, to get squared away after travel.

Reload is used for service reconfiguration as well
and lacks a NAME_prepend-like mechanism so it makes
sense to extend the NAME_reload hook into this
action.

precmd may use configuration checks and blocks setup
from doing its designated work (e.g. nginx).  In moving
the invoke of the setup script in front allows us to
provide custom scripts for config file generation and
fixing prior to precmd checking configuration integrity.

Also introduce _run_rc_setup to separate the launcher
from the main one.  Let it run correctly in the case
of restart_precmd and block further execution as
would be the case in start due to the internal plumbing
of restart being split into calling stop and start
afterwards.

Differential-Revsiion: https://reviews.freebsd.org/D36259
Signed-off-by: Franco Fichtner <franco@opnsense.org>
Reviewed by: imp, oshogbo
Pull Request: freebsd#1258
@freebsd-git freebsd-git merged commit 11333dd into freebsd:main May 29, 2024
7 of 9 checks passed
@fichtner fichtner deleted the rc_setup branch June 4, 2024 03:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants