mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Fixed augeas import
This commit is contained in:
parent
dfd4686a6c
commit
a8e66c5726
@ -32,7 +32,7 @@ import logging
|
||||
# Make sure augeas python interface is installed
|
||||
HAS_AUGEAS = False
|
||||
try:
|
||||
from augeas import Augeas
|
||||
from augeas import Augeas as _Augeas
|
||||
HAS_AUGEAS = True
|
||||
except ImportError:
|
||||
pass
|
||||
@ -109,8 +109,8 @@ def execute(context=None, lens=None, commands=()):
|
||||
'remove': 'remove',
|
||||
}
|
||||
|
||||
flags = Augeas.NO_MODL_AUTOLOAD if lens else Augeas.NONE
|
||||
aug = Augeas(flags=flags)
|
||||
flags = _Augeas.NO_MODL_AUTOLOAD if lens else _Augeas.NONE
|
||||
aug = _Augeas(flags=flags)
|
||||
|
||||
if lens:
|
||||
aug.add_transform(lens, re.sub('^/files', '', context))
|
||||
@ -182,7 +182,7 @@ def get(path, value=''):
|
||||
|
||||
salt '*' augeas.get /files/etc/hosts/1/ ipaddr
|
||||
'''
|
||||
aug = Augeas()
|
||||
aug = _Augeas()
|
||||
ret = {}
|
||||
|
||||
path = path.rstrip('/')
|
||||
@ -239,7 +239,7 @@ def setvalue(*args):
|
||||
|
||||
%wheel ALL = PASSWD : ALL , NOPASSWD : /usr/bin/apt-get , /usr/bin/aptitude
|
||||
'''
|
||||
aug = Augeas()
|
||||
aug = _Augeas()
|
||||
ret = {'retval': False}
|
||||
|
||||
tuples = filter(lambda x: not str(x).startswith('prefix='), args)
|
||||
@ -283,7 +283,7 @@ def match(path, value=''):
|
||||
|
||||
salt '*' augeas.match /files/etc/services/service-name ssh
|
||||
'''
|
||||
aug = Augeas()
|
||||
aug = _Augeas()
|
||||
ret = {}
|
||||
|
||||
try:
|
||||
@ -309,7 +309,7 @@ def remove(path):
|
||||
|
||||
salt '*' augeas.remove /files/etc/sysctl.conf/net.ipv4.conf.all.log_martians
|
||||
'''
|
||||
aug = Augeas()
|
||||
aug = _Augeas()
|
||||
ret = {'retval': False}
|
||||
try:
|
||||
count = aug.remove(path)
|
||||
@ -348,7 +348,7 @@ def ls(path): # pylint: disable=C0103
|
||||
ret[_ma] = aug.get(_ma)
|
||||
return ret
|
||||
|
||||
aug = Augeas()
|
||||
aug = _Augeas()
|
||||
|
||||
path = path.rstrip('/') + '/'
|
||||
match_path = path + '*'
|
||||
@ -375,7 +375,7 @@ def tree(path):
|
||||
|
||||
salt '*' augeas.tree /files/etc/
|
||||
'''
|
||||
aug = Augeas()
|
||||
aug = _Augeas()
|
||||
|
||||
path = path.rstrip('/') + '/'
|
||||
match_path = path
|
||||
|
Loading…
Reference in New Issue
Block a user