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:
Aneesh Agrawal 2015-07-06 07:44:46 -04:00
parent a723af0f10
commit b4d544fe70

View file

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