Skip to content

Commit

Permalink
Merge pull request #22 from plesk/fix-check-masked
Browse files Browse the repository at this point in the history
Fix fail on checking if disabled service is masked
  • Loading branch information
SandakovMM authored Mar 29, 2024
2 parents 3ba57dc + 1a54e2c commit c02b69c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pleskdistup/common/src/systemd.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ def get_required_services(service: str) -> typing.List[str]:


def is_service_masked(service: str) -> bool:
# is-enabled for masked service will return return code 1
# so don't check operation result by the standard subprocess.run() way
res = subprocess.run(
[SYSTEMCTL_BIN_PATH, 'is-enabled', service],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
check=True,
universal_newlines=True
)

if res.stdout == 'masked':
return True
return False
Expand Down

0 comments on commit c02b69c

Please sign in to comment.