change disable check for upstart service on ubuntu14

This commit is contained in:
Ch3LL 2018-05-15 12:07:27 -04:00
parent 33b4cfbc5b
commit 6032a01f55
No known key found for this signature in database
GPG Key ID: 132B55A7C13EFA73

View File

@ -115,12 +115,21 @@ class ServiceModuleTest(ModuleCase):
# enable service before test
srv_name = 'doesnotexist'
enable = self.run_function('service.enable', [srv_name])
if salt.utils.systemd.booted():
systemd = salt.utils.systemd.booted()
# check service was not enabled
if systemd:
self.assertIn('ERROR', enable)
else:
self.assertFalse(enable)
# check service was not disabled
if tuple(self.run_function('grains.item', ['osrelease_info'])['osrelease_info']) == (14, 0o4) and not systemd:
# currently upstart does not have a mechanism to report if disabling a service fails if does not exist
self.assertTrue(self.run_function('service.disable', [srv_name]))
else:
self.assertFalse(self.run_function('service.disable', [srv_name]))
if salt.utils.is_darwin():
self.assertFalse(self.run_function('service.disabled', [srv_name]))
else: