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 service.exists #767

Merged
merged 1 commit into from
May 26, 2024
Merged

Fix service.exists #767

merged 1 commit into from
May 26, 2024

Conversation

sblaisot
Copy link
Contributor

@sblaisot sblaisot 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

@martinhoyer martinhoyer 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
Contributor Author

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.

@philpep philpep force-pushed the fix_service_exists branch from 62abe2e to 85f027b Compare May 26, 2024 14:50
@philpep
Copy link
Contributor

philpep commented May 26, 2024

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.

@philpep philpep merged commit 8155242 into pytest-dev:main May 26, 2024
7 checks passed
@philpep
Copy link
Contributor

philpep commented May 26, 2024

Merged, thanks!

@sblaisot sblaisot 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 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.

service.exists with systemd fails
3 participants