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 listing and running checks with dashes in name #213

Merged
merged 1 commit into from
Dec 19, 2024

Conversation

rodrigogansobarbieri
Copy link
Contributor

@rodrigogansobarbieri rodrigogansobarbieri commented Dec 2, 2024

Fix running checks with both dashes and underscores in name

The "list-nrpe-checks" action converts underscores
to dashes because of key:value juju action result
structure, and "run-nrpe-check" converts dashes back
to underscores when specifying a check name with dashes.
However, if a check name has both dashes and underscores,
running the action with the listed check name will never
work.

This patch using regex search to find the name of the file
ignoring dashes and underscores, so it will find the check file
in all 3 scenarios. In case there are multiple results it returns
an error.

Closes: #212

@rodrigogansobarbieri rodrigogansobarbieri force-pushed the fix_dash_rename branch 2 times, most recently from cb8e886 to 2777d82 Compare December 5, 2024 17:22
jneo8
jneo8 previously approved these changes Dec 10, 2024
@rodrigogansobarbieri
Copy link
Contributor Author

Latest force-push was to remove a white-space that was added accidentally in the code.

@rodrigogansobarbieri
Copy link
Contributor Author

rebased on top of main

Pjack
Pjack previously approved these changes Dec 13, 2024
jneo8
jneo8 previously approved these changes Dec 16, 2024
@jneo8
Copy link
Contributor

jneo8 commented Dec 17, 2024

@rodrigogansobarbieri rodrigogansobarbieri dismissed stale reviews from Pjack and jneo8 via cb0929a December 17, 2024 11:41
@rodrigogansobarbieri rodrigogansobarbieri force-pushed the fix_dash_rename branch 3 times, most recently from c7b4f95 to 10c43e5 Compare December 17, 2024 11:48
The "list-nrpe-checks" action converts underscores
to dashes because of key:value juju action result
structure, and "run-nrpe-check" converts dashes back
to underscores when specifying a check name with dashes.
However, if a check name has both dashes and underscores,
running the action with the listed check name will never
work.

This patch using regex search to find the name of the file
ignoring dashes and underscores, so it will find the check file
in all 3 scenarios. In case there are multiple results it returns
an error.

Closes: canonical#212
@rodrigogansobarbieri
Copy link
Contributor Author

Signed

@gabrielcocenza gabrielcocenza merged commit 4d66618 into canonical:main Dec 19, 2024
6 checks passed
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.

nrpe charm has wrong cfg filenames
5 participants