Skip to content

fix: validate IDs in collector enable/disable - #661

Open
Peto-RH wants to merge 1 commit into
mainfrom
pschrimp/collector-validates-id
Open

Peto-RH wants to merge 1 commit into
mainfrom
pschrimp/collector-validates-id

Conversation

@Peto-RH

@Peto-RH Peto-RH commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Reuse the existing ID validator before probing systemd or loading collector configuration. Add regression coverage for both commands.

@Peto-RH
Peto-RH requested a review from a team as a code owner November 20, 2026 13:46
* Card ID: RHEL-306441

Reuse the existing ID validator before probing systemd or loading
collector configuration. Add regression coverage for both commands.
@Peto-RH
Peto-RH force-pushed the pschrimp/collector-validates-id branch from 8bc4bf6 to 2deace0 Compare November 20, 2026 15:22
// and loads the collector configuration before connecting for timer operations.
// Returns the systemd connection, the collector config, and any validation errors.
func ValidateCollectorAndConnect(collectorID string) (*systemd.Conn, Config, error) {
validatedID, err := ValidateID(collectorID)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see there are a few functions that are initially running this same validation call. I wonder if we can move the ValidateID call into GetConfig so we don't have to have this as a requirement for each. and encapsulate this validation in one place.

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