Make ServiceMgrFactCollector.is_systemd_managed() a static method (#25316)

Fix 'hostname' module Facts is not defined by updating
'hostname' module to use it.

is_systemd_managed() was previously on the module_utils.facts.Facts
class that no longer exists.

Fixes #25289
This commit is contained in:
Adrian Likins 2017-06-05 09:39:05 -04:00 committed by GitHub
commit 087b5277f1
2 changed files with 4 additions and 3 deletions

View file

@ -53,7 +53,7 @@ from distutils.version import LooseVersion
# import module snippets
from ansible.module_utils.basic import *
from ansible.module_utils.facts import *
from ansible.module_utils.facts.system.service_mgr import ServiceMgrFactCollector
from ansible.module_utils._text import to_bytes, to_native
@ -112,7 +112,7 @@ class Hostname(object):
def __init__(self, module):
self.module = module
self.name = module.params['name']
if self.platform == 'Linux' and Facts(module).is_systemd_managed():
if self.platform == 'Linux' and ServiceMgrFactCollector.is_systemd_managed(module):
self.strategy = SystemdStrategy(module)
else:
self.strategy = self.strategy_class(module)