@@ -440,8 +440,9 @@ def main():
440440 module .fail_json (msg = 'Could not import python augeas module.'
441441 ' Please install augeas related packages and '
442442 'augeas python bindings.' )
443- augeas_instance = Augeas (root = module .params ['root' ], loadpath = module .params ['loadpath' ],
444- flags = getattr (Augeas , 'ENABLE_SPAN' , 0 ))
443+ flags = getattr (Augeas , 'ENABLE_SPAN' , 0 )
444+ if module .params ['filter' ] == 'incl' :
445+ flags = flags | getattr (Augeas , 'NO_MODL_AUTOLOAD' , 0 )
445446 commands = None
446447 if module .params ['command' ] is not None :
447448 command = module .params ['command' ]
@@ -470,6 +471,9 @@ def main():
470471 except CommandsParseError , e :
471472 module .fail_json (msg = e .msg )
472473 try :
474+ if module .params ['filter' ] == 'incl' :
475+ flags = flags | getattr (Augeas , 'NO_MODL_AUTOLOAD' , 0 )
476+ augeas_instance = Augeas (root = module .params ['root' ], loadpath = module .params ['loadpath' ],flags = flags )
473477 results , changed = execute (augeas_instance , commands )
474478 except AugeasError , e :
475479 module .fail_json (msg = e .msg )
0 commit comments