Fixed augeas import

This commit is contained in:
rallytime 2014-07-31 12:05:11 -06:00
parent dfd4686a6c
commit a8e66c5726

View File

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