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

Don't generate switch targets for sites without a switch #332

Merged
merged 3 commits into from
Apr 18, 2024

Conversation

nkinkade
Copy link
Contributor

@nkinkade nkinkade commented Apr 17, 2024

Now that we are supporting minimal physical sites without a switch, we don't want to generate Prometheus switch targets for these sites. This PR adds a simple conditional to check whether the siteinfo value for "switch" is None ("null" in the JSON), and whether the target begins with "s1", which would`indicate a switch target.


This change is Reviewable

Now that we are supporting minimal physical sites without a switch, we don't
want to generate Prometheus switch targets for these sites. This PR adds a
simple conditional to check whether the siteinfo value for "switch" is None
("null" in the JSON), and whether the target begins with "s1-", which would
indicate a switch target.
Adds a "switch" field to default sites variable. Adds a new global variable for
a site where switch=None. Edits test to be sure that this site is excluded from
switch targets.
Today, the calls to select_prometheus_site_targets() all filter on
"only_physical", but perhaps in the future we might want targets that aren't
physical and don't have switches, in which case site['switch'] would not exist
and might throw an error, so explicitly check for its existence before trying
to figure out if its value is None.
Copy link
Contributor

@robertodauria robertodauria left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 1 approvals obtained

@nkinkade nkinkade merged commit a5be679 into main Apr 18, 2024
3 checks passed
@nkinkade nkinkade deleted the sandbox-kinkade branch April 18, 2024 15:21
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.

2 participants