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

LVM-activate: fix drop-in check to avoid re-creating drop-in file when it already exists #1652

Merged

Conversation

oalbrigt
Copy link
Contributor

Fixes #1647

systemd_drop_in "99-LVM-activate" "After" \
systemctl show resource-agents-deps.target \
--property=After | cut -d'=' -f2 | \
grep -qE "(^|\s)blk-availability.service(\s|$)"
Copy link
Member

Choose a reason for hiding this comment

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

\s may or may not be supported as shorthand for [[:space:]], depending on the version of grep.
Why not use an actual space? Or even use the same shell "case" logic as before, but like this:
case " $after " in *" ... "*) (note the extra space around $after)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The shell logic before only matched if you got 3 or more hits (and blk... wasnt first or last). We use \s (and the combination with beginning/end of line) with grep in other agents, and noone has complained about it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I had used the case idiom in 79fb4b2 as an attempt at portability -- I don't remember the details, but I think I had found something less than ideal about grep at the time. -q is also not as portable as >/dev/null 2>&1.

But none of that mattered, since my two typos ("$after" instead of " $after ", and target.d instead of target) broke the whole thing anyway :)

@oalbrigt oalbrigt merged commit 34e75a5 into ClusterLabs:master Jun 1, 2021
@oalbrigt oalbrigt deleted the LVM-activate-fix-drop-in-check branch June 1, 2021 07:37
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.

[Question] About confirmation of "resource-agents-deps.target" at the start of LVM-activate resource.
3 participants