diff options
author | Peter Rajnoha <prajnoha@redhat.com> | 2017-04-05 11:06:56 +0200 |
---|---|---|
committer | Peter Rajnoha <prajnoha@redhat.com> | 2017-04-05 11:06:56 +0200 |
commit | 448bf9491a10715650569d5eeceb1026941d70ae (patch) | |
tree | 1712bb32c767be3319f3b8d8a0f713aefe42d84f | |
parent | afa844817a716f054f1e56612fa19522225797f4 (diff) | |
download | lvm2-448bf9491a10715650569d5eeceb1026941d70ae.tar.gz |
lvmconf: fix systemd unit existence check for lvmconf --services --startstopservices
We have to unset the LoadState variable from previous use when we check
for systemd unit state. We use this variable to check if systemd services
are loaded or not and if it is loaded, we issue systemctl commands to
enable/disable and start/stop the service. We don't issue these commands
if the unit is not loaded to avoid error messages which may confuse users.
-rw-r--r-- | WHATS_NEW | 1 | ||||
-rw-r--r-- | scripts/lvmconf.sh | 6 |
2 files changed, 5 insertions, 2 deletions
@@ -1,5 +1,6 @@ Version 2.02.170 - ================================== + Fix systemd unit existence check for lvmconf --services --startstopservices. Check and use PATH_MAX buffers when creating vgrename device paths. Version 2.02.169 - 28th March 2017 diff --git a/scripts/lvmconf.sh b/scripts/lvmconf.sh index a86036d90..caf7faedd 100644 --- a/scripts/lvmconf.sh +++ b/scripts/lvmconf.sh @@ -361,7 +361,8 @@ function set_service { if [ "$type" = "systemd" ]; then if [ "$action" = "activate" ]; then for i in $@; do - eval $($SYSTEMCTL_BIN show $i -p LoadState) + unset LoadState + eval $($SYSTEMCTL_BIN show $i -p LoadState 2>/dev/null) test "$LoadState" = "loaded" || continue $SYSTEMCTL_BIN enable $i if [ "$START_STOP_SERVICES" = "1" ]; then @@ -370,7 +371,8 @@ function set_service { done elif [ "$action" = "deactivate" ]; then for i in $@; do - eval $($SYSTEMCTL_BIN show $i -p LoadState) + unset LoadState + eval $($SYSTEMCTL_BIN show $i -p LoadState 2>/dev/null) test "$LoadState" = "loaded" || continue $SYSTEMCTL_BIN disable $i if [ "$START_STOP_SERVICES" = "1" ]; then |