mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Merge pull request #19921 from thatch45/The-Loeki-fix_sysctl
Merge #19838
This commit is contained in:
commit
5bd3ad8f76
@ -13,6 +13,7 @@ import salt.utils
|
|||||||
from salt._compat import string_types
|
from salt._compat import string_types
|
||||||
from salt.exceptions import CommandExecutionError
|
from salt.exceptions import CommandExecutionError
|
||||||
from salt.modules.systemd import _sd_booted
|
from salt.modules.systemd import _sd_booted
|
||||||
|
import string
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -132,7 +133,7 @@ def assign(name, value):
|
|||||||
salt '*' sysctl.assign net.ipv4.ip_forward 1
|
salt '*' sysctl.assign net.ipv4.ip_forward 1
|
||||||
'''
|
'''
|
||||||
value = str(value)
|
value = str(value)
|
||||||
sysctl_file = '/proc/sys/{0}'.format(name.replace('.', '/'))
|
sysctl_file = '/proc/sys/{0}'.format(name.translate(string.maketrans('./', '/.')))
|
||||||
if not os.path.exists(sysctl_file):
|
if not os.path.exists(sysctl_file):
|
||||||
raise CommandExecutionError('sysctl {0} does not exist'.format(name))
|
raise CommandExecutionError('sysctl {0} does not exist'.format(name))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user