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

Weaver: add option to automatically unregister old providers #423

Merged
merged 6 commits into from
Feb 15, 2024

Conversation

mishaschwartz
Copy link
Collaborator

Overview

Introduces the WEAVER_UNREGISTER_DROPPED_PROVIDERS variable. If set to "True", Weaver providers that are no longer working (not responding when deployed) and are not named in WEAVER_WPS_PROVIDERS will be unregistered. This is useful when deploying Weaver with fewer providers than a previous deployment.

For example, if the stack is deployed with the Weaver, Finch, and Raven components. Then later deployed with just Weaver and Raven, the Finch provider will be unregistered from weaver.

Previously, the Finch provider would have remained as a Weaver provider despite the fact that it has been removed from the stack.

Changes

Non-breaking changes

  • Adds an additional config option to unregister old weaver providers

Breaking changes
None

Related Issue / Discussion

Additional Information

Links to other issues or sources.

birdhouse_daccs_configs_branch: master
birdhouse_skip_ci: false

@github-actions github-actions bot added component/weaver Related to https://github.com/crim-ca/weaver documentation Improvements or additions to documentation feature/WPS Feature or service related to Web Processing Service labels Feb 9, 2024
Copy link
Collaborator

@fmigneault fmigneault left a comment

Choose a reason for hiding this comment

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

Good feature. Just a minor thing to check.

)
working_providers=$(echo "$working_providers_resp" | sed -e 's/.*"providers":\[//' -e 's/\].*//' -e 's/[",]/ /g')
for prov in $(echo "$all_providers_resp" | sed -e 's/.*"providers":\[//' -e 's/\].*//' -e 's/[",]/ /g'); do
if echo "${WEAVER_WPS_PROVIDERS}" | grep -wqv "$prov" && echo "${working_providers}" | grep -wqv "$prov"; then
Copy link
Collaborator

Choose a reason for hiding this comment

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

Might have an issue with - that is not considered in the "word" characters.

Example: finch replaced by some kind of finch-new finch-old definition. If finch is disabled, and therefore not in the list of enabled & working providers, echo "finch-1 finch-2" | grep -wv "finch" (error/if not triggered) believes that finch is still there and won't remove the provider.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch. Thanks!

Copy link
Collaborator

@tlvu tlvu left a comment

Choose a reason for hiding this comment

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

Nice feature ! I'd say this also cover the case where we "rename" a WPS service. This will remove the old name.

sed -e 's/.*"providers":\[//' -e 's/\].*//' -e 's/[",]/ /g')
for prov in $(echo "$all_providers_resp" | sed -e 's/.*"providers":\[//' -e 's/\].*//' -e 's/[",]/ /g'); do
# Note: both WEAVER_WPS_PROVIDERS and working_providers are whitespace delimited with no newlines
if echo " ${WEAVER_WPS_PROVIDERS} " | grep -qv "[[:space:]]${prov}[[:space:]]" && \
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will be run each time autodeploy runs, which runs inside its own container. Please test this with autodeploy.

The reason curl was a docker run is because there are no curl in the autodeploy container.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

can confirm this check works in the autodeploy container: grep, sed, etc. all work in that environment.

@github-actions github-actions bot added the ci/operations Continuous Integration components label Feb 15, 2024
@mishaschwartz mishaschwartz merged commit 67c6ca1 into master Feb 15, 2024
4 of 5 checks passed
@mishaschwartz mishaschwartz deleted the unregister-old-providers branch February 15, 2024 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/operations Continuous Integration components component/weaver Related to https://github.com/crim-ca/weaver documentation Improvements or additions to documentation feature/WPS Feature or service related to Web Processing Service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants