mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
fix some tests
This commit is contained in:
parent
15b4ed1ca6
commit
44132067a1
@ -15,7 +15,7 @@ from salt.ext.six.moves import shlex_quote as _cmd_quote
|
||||
# pylint: enable=import-error
|
||||
|
||||
# Import salt libs
|
||||
from salt.modules.systemd import _sd_booted
|
||||
import salt.utils.systemd
|
||||
|
||||
__func_alias__ = {
|
||||
'reload_': 'reload'
|
||||
@ -34,7 +34,7 @@ def __virtual__():
|
||||
'''
|
||||
Only work on Debian and when systemd isn't running
|
||||
'''
|
||||
if __grains__['os'] in ('Debian', 'Raspbian') and not _sd_booted(__context__):
|
||||
if __grains__['os'] in ('Debian', 'Raspbian') and not salt.utils.systemd.booted(__context__):
|
||||
return __virtualname__
|
||||
return False
|
||||
|
||||
|
@ -13,7 +13,7 @@ import re
|
||||
import salt.utils
|
||||
from salt.ext.six import string_types
|
||||
from salt.exceptions import CommandExecutionError
|
||||
from salt.modules.systemd import _sd_booted
|
||||
import salt.utils.systemd
|
||||
import string
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@ -31,8 +31,6 @@ def __virtual__():
|
||||
'''
|
||||
if __grains__['kernel'] != 'Linux':
|
||||
return False
|
||||
global _sd_booted
|
||||
_sd_booted = salt.utils.namespaced_function(_sd_booted, globals())
|
||||
return __virtualname__
|
||||
|
||||
|
||||
@ -59,7 +57,7 @@ def default_config():
|
||||
|
||||
salt -G 'kernel:Linux' sysctl.default_config
|
||||
'''
|
||||
if _sd_booted(__context__):
|
||||
if salt.utils.systemd.booted(__context__):
|
||||
for line in __salt__['cmd.run_stdout'](
|
||||
'systemctl --version'
|
||||
).splitlines():
|
||||
|
@ -1,3 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
'''
|
||||
Manage nspawn containers
|
||||
'''
|
||||
@ -72,7 +73,7 @@ def _fedora_bootstrap(name, **kwargs):
|
||||
if os.path.exists(dst):
|
||||
__context__['retcode'] = salt.defaults.exitcodes.SALT_BUILD_FAIL
|
||||
return {'err': 'Container {0} already exists'.format(name)}
|
||||
cmd = 'yum -y --releasever={0} --nogpg --installroot={0} --disablerepo="*" --enablerepo=fedora install systemd passwd yum fedora-release vim-minimal'.format(dst, version)
|
||||
cmd = 'yum -y --releasever={0} --nogpg --installroot={1} --disablerepo="*" --enablerepo=fedora install systemd passwd yum fedora-release vim-minimal'.format(version, dst)
|
||||
os.makedirs(dst)
|
||||
ret = __salt__['cmd.run_all'](cmd, python_shell=False)
|
||||
if ret['retcode'] != 0:
|
||||
@ -94,7 +95,7 @@ def bootstrap(name, dist=None, version=None):
|
||||
'''
|
||||
if not dist:
|
||||
dist = __grains__['os'].lower()
|
||||
return locals['_{0}_bootstrap'.format()]
|
||||
return locals['_{0}_bootstrap'.format(dist)](name, version=version)
|
||||
|
||||
|
||||
def enable(name):
|
||||
|
@ -47,7 +47,7 @@ import os
|
||||
# Import salt libs
|
||||
import salt.utils
|
||||
import salt.modules.cmdmod
|
||||
from salt.modules.systemd import _sd_booted
|
||||
import salt.utils.systemd
|
||||
|
||||
__func_alias__ = {
|
||||
'reload_': 'reload'
|
||||
@ -62,7 +62,7 @@ def __virtual__():
|
||||
Only work on Ubuntu
|
||||
'''
|
||||
# Disable on these platforms, specific service modules exist:
|
||||
if _sd_booted(__context__):
|
||||
if salt.utils.systemd.booted(__context__):
|
||||
return False
|
||||
elif __grains__['os'] in ('Ubuntu', 'Linaro', 'elementary OS', 'Mint'):
|
||||
return __virtualname__
|
||||
|
@ -1,3 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
'''
|
||||
Contains systemd related help files
|
||||
'''
|
||||
|
Loading…
Reference in New Issue
Block a user