@ -1,5 +1,5 @@
#
# Copyright 2015 Peter Sprygada <psprygada@ansible.com>
# (c) 2016 Red Hat Inc.
#
# This file is part of Ansible
#
@ -25,32 +25,27 @@ import glob
import urlparse
from ansible . module_utils . _text import to_text
from ansible . plugins . action import ActionBas e
from ansible . plugins . network import ActionModule as _ActionModul e
class ActionModule ( ActionBase ) :
TRANSFERS_FILES = False
class ActionModule ( _ActionModule ) :
def run ( self , tmp = None , task_vars = None ) :
result = super ( ActionModule , self ) . run ( tmp , task_vars )
result [ ' changed ' ] = False
try :
self . _handle_template ( )
except ( ValueError , AttributeError ) as exc :
return dict ( failed = True , msg = exc . message )
result . update ( self . _execute_module ( module_name = self . _task . action ,
module_args = self . _task . args , task_vars = task_vars ) )
result = super ( ActionModule , self ) . run ( tmp , task_vars )
if self . _task . args . get ( ' backup ' ) and result . get ( ' _ backup' ) :
if self . _task . args . get ( ' backup ' ) and result . get ( ' _ _ backup__ ' ) :
# User requested backup and no error occurred in module.
# NOTE: If there is a parameter error, _ backup key may not be in results.
self . _write_backup ( task_vars [ ' inventory_hostname ' ] , result [ ' _ backup' ] )
# NOTE: If there is a parameter error, _ _ backup__ key may not be in results.
self . _write_backup ( task_vars [ ' inventory_hostname ' ] , result [ ' _ _ backup__ ' ] )
if ' _ backup' in result :
del result [ ' _ backup' ]
if ' _ _ backup__ ' in result :
del result [ ' _ _ backup__ ' ]
return result