Skip to content

Conversation

@sblaisot
Copy link
Contributor

@sblaisotsblaisot commented May 26, 2024

service.exists fail with systemd because there was a typo in the underlying command, missing a space between grep option -q and service name.

This PR fixes that problem

This fixes#768

Copy link
Contributor

@martinhoyermartinhoyer left a comment

Choose a reason for hiding this comment

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

Thanks for the fix.
I wonder what the ^ is for. Isn't it redundant?

@sblaisot
Copy link
ContributorAuthor

I wonder what the ^ is for. Isn't it redundant?

The ^ in the beginning of a regex means "beginning with" (start of line)

I only corrected the missing space between -q option and the searched regex.

@martinhoyer
Copy link
Contributor

I wonder what the ^ is for. Isn't it redundant?

The ^ in the beginning of a regex means "beginning with" (start of line)

Ah, I always get confused by the % substitution :)

I only corrected the missing space between -q option and the searched regex.

Of course, I was just curious.

@philpepphilpepforce-pushed the fix_service_exists branch from 62abe2e to 85f027bCompareMay 26, 2024 14:50
@philpep
Copy link
Contributor

I wonder what the ^ is for. Isn't it redundant?
I only corrected the missing space between -q option and the searched regex.

Of course, I was just curious.

I think this is to match service with or without the ".service" suffix. Maybe we could think about a better way of doing this because service s (which obvisouly doesn't exist) will match ssh.service and reported as existing.

@philpepphilpep merged commit 8155242 into pytest-dev:mainMay 26, 2024
@philpep
Copy link
Contributor

Merged, thanks!

@sblaisotsblaisot deleted the fix_service_exists branch May 26, 2024 14:57
jsf9k added a commit to cisagov/ansible-role-systemd-resolved that referenced this pull request May 28, 2024
jsf9k added a commit to cisagov/ansible-role-systemd-resolved that referenced this pull request May 28, 2024
jsf9k added a commit to cisagov/ansible-role-systemd-resolved that referenced this pull request Jun 25, 2024
Sign up for freeto 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.

service.exists with systemd fails

3 participants

@sblaisot@martinhoyer@philpep