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

Look up search node name in config for weatherreport #4887

Merged
merged 2 commits into from
Nov 30, 2023

Conversation

jcoglan
Copy link
Contributor

@jcoglan jcoglan commented Nov 30, 2023

Overview

Weatherreport is hard-coded to assume the search node is at '[email protected]' and that it is running. This results in a useless warning for users that do not have search enabled, and also means that it will fail to connect if Clouseau is running somewhere other than 127.0.0.1.

This replaces the hard-coded node name with a config lookup to [dreyfus] name and handles the case of it not being set.

Testing recommendations

On main, running weatherreport against my dev cluster prints this warning about Clouseau not responding, regardless of what [dreyfus] name is set to:

$ ./weatherreport -c ../../dev/lib/node1/etc
['[email protected]'] [warning] Local search node at '[email protected]' not responding: pang

With this change, the above warning is not printed unless [dreyfus] name has been set:

$ cdb '/_node/_local/_config/dreyfus/name' -X DELETE
"[email protected]"

$ ./weatherreport -c ../../dev/lib/node1/etc
(no warning)

$ cdb '/_node/_local/_config/dreyfus/name' -X PUT -d '"[email protected]"'
""

$ ./weatherreport -c ../../dev/lib/node1/etc
['[email protected]'] [warning] Local search node at '[email protected]' not responding: pang

Checklist

  • Code is written and works correctly
  • Changes are covered by tests
  • Any new configurable parameters are documented in rel/overlay/etc/default.ini
  • Documentation changes were made in the src/docs folder
  • Documentation changes were backported (separated PR) to affected branches

Weatherreport is hard-coded to assume the search node is at
'[email protected]' and that it is running. This results in a useless
warning for users that do not have search enabled, and also means that
it will fail to connect if Clouseau is running somewhere other than
127.0.0.1.

This replaces the hard-coded node name with a config lookup to
`[dreyfus] name` and handles the case of it not being set.
undefined ->
[{info, clouseau_not_configured}];
_ ->
SearchNode = list_to_atom(SearchNodeStr),
Copy link
Member

Choose a reason for hiding this comment

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

needs to be list_to_existing_atom

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've pushed one more commit that implements this, is it what you had in mind?

Copy link
Member

@rnewson rnewson left a comment

Choose a reason for hiding this comment

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

pretty good. one thing to change first.

@janl janl merged commit 70d9035 into apache:main Nov 30, 2023
14 checks passed
@janl janl deleted the weatherreport-lookup-search-node branch November 30, 2023 15:51
format({clouseau_ok, SearchNode}) ->
{"Local search node at ~w responding ok", [SearchNode]};
format({clouseau_node, SearchNode}) ->
{"Search node name ~s is not recognised", [SearchNode]};
Copy link
Contributor

Choose a reason for hiding this comment

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

"recognised" is the UK spelling. I think the US spelling ("recognized") is used in this project, but I may be wrong here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants