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

Fix Haraka help #3272

Closed
wants to merge 2 commits into from
Closed

Fix Haraka help #3272

wants to merge 2 commits into from

Conversation

lnedry
Copy link
Contributor

@lnedry lnedry commented Feb 4, 2024

Fixed issue #3212 - the help option for plugin execution order was sometimes displaying hooks in the wrong order.

Haraka help now displays plugin hooks in the correct order of execution.

There may be a better way to get a list of the hooks and their order of execution but it was not obvious to me. So I grabbed them from the Plugin.md file.

@msimerson
Copy link
Member

msimerson commented Feb 4, 2024

Putting them inline is a reasonable approach, but requires modifying both the docs and the help file in the future, which is likely to get missed. Something more automated seems prudent to me:

awk '/## Available/,/## rcpt/{ if (/^\*/) print $2 }' docs/Plugins.md | tr -d '\'
init_master
init_child
init_http
init_wss
connect_init
lookup_rdns
connect
capabilities
unrecognized_command
disconnect
helo
ehlo
quit
vrfy
noop
rset
mail
rcpt
rcpt_ok
data
data_post
max_data_exceeded
queue
queue_outbound
queue_ok
reset_transaction
deny
get_mx
deferred
bounce
delivered
send_email
pre_send_trans_email

Annotated

awk '/## Available/,/## rcpt/{ if (/^\*/) print $2 }' docs/Plugins.md | tr -d '\'
  • for the contents between the markers that starts with ## Available and ends with ## rcpt ...
  • print the 2nd word of lines that start with * (the first is *)
  • use tr to delete the \ escape characters

@lnedry
Copy link
Contributor Author

lnedry commented Feb 5, 2024

When I said that there may be a better way to get a list of the hooks, I was referring to programmatically getting a list from within Haraka.

What are the chances that a new hook will be added in the future? If that is a possibility, I could add some code to print a warning when someone uses a hook that is not in this help list. Or throw an error.

@msimerson
Copy link
Member

When I said that there may be a better way to get a list of the hooks, I was referring to programmatically getting a list from within Haraka.

I didn't see a straight forward way to do that. Hence, grabbing them from the docs.

What are the chances that a new hook will be added in the future?

Probably somewhere around 100%, eventually. We do require new features to be documented, so if another hook was added, I'd expect it to be documented in docs/Plugins.md, same as the rest of them.

Fixed issue haraka#3212 - Haraka help now displays plugin hooks in order of execution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants