mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Allow checking for non-normalized systemd units.
When using service.available with the systemd provider, allow appending the .service suffix for service files, so that service.available('sshd') and service.available('sshd.service') both are True.
This commit is contained in:
parent
a723af0f10
commit
b4d544fe70
1 changed files with 2 additions and 0 deletions
|
@ -234,6 +234,8 @@ def available(name):
|
|||
salt '*' service.available sshd
|
||||
'''
|
||||
name = _canonical_template_unit_name(name)
|
||||
if name.endswith('.service'):
|
||||
name = name[:-8] # len('.service') is 8
|
||||
units = get_all()
|
||||
if name in units:
|
||||
return True
|
||||
|
|
Loading…
Add table
Reference in a new issue