Merge pull request #25705 from blackduckx/augeas-setm

Support for setm augeas command.
This commit is contained in:
Thomas S Hatch 2015-07-27 10:07:10 -06:00
commit 82ba390b7b
2 changed files with 9 additions and 1 deletions

View file

@ -104,6 +104,7 @@ def execute(context=None, lens=None, commands=()):
method_map = {
'set': 'set',
'setm': 'setm',
'mv': 'move',
'move': 'move',
'ins': 'insert',
@ -136,6 +137,13 @@ def execute(context=None, lens=None, commands=()):
path = os.path.join(context.rstrip('/'), path.lstrip('/'))
value = value.strip('"').strip("'")
args = {'path': path, 'value': value}
elif method == 'setm':
base, sub, value = re.findall('([^\'" ]+|"[^"]*"|\'[^\']*\')', arg)
base = base.rstrip()
if context:
base = os.path.join(context.rstrip('/'), base.lstrip('/'))
value = value.strip('"').strip("'")
args = {'base': base, 'sub': sub, 'value': value}
elif method == 'move':
path, dst = arg.split(' ', 1)
if context:

View file

@ -76,7 +76,7 @@ def change(name, context=None, changes=None, lens=None, **kwargs):
changes
List of changes that are issued to Augeas. Available commands are
``set``, ``mv``/``move``, ``ins``/``insert``, and ``rm``/``remove``.
``set``, ``setm``, ``mv``/``move``, ``ins``/``insert``, and ``rm``/``remove``.
lens
The lens to use, needs to be suffixed with `.lns`, e.g.: `Nginx.lns`. See