fix some tests

This commit is contained in:
Thomas S Hatch 2015-02-25 18:02:43 -07:00
parent 15b4ed1ca6
commit 44132067a1
5 changed files with 10 additions and 10 deletions

View File

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

View File

@ -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():

View File

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

View File

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

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
'''
Contains systemd related help files
'''