From e4b303223117b4e6ac690f83ff40cb0b0268293f Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Fri, 15 Jul 2016 17:34:46 -0400 Subject: [PATCH] removes methods to write to dest from net_config --- lib/ansible/plugins/action/net_config.py | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/lib/ansible/plugins/action/net_config.py b/lib/ansible/plugins/action/net_config.py index 765f7a339a..8c0d90d6fd 100644 --- a/lib/ansible/plugins/action/net_config.py +++ b/lib/ansible/plugins/action/net_config.py @@ -49,13 +49,8 @@ class ActionModule(ActionBase): # NOTE: If there is a parameter error, _backup key may not be in results. self._write_backup(task_vars['inventory_hostname'], result['__backup__']) - if self._task.args.get('dest') and result.get('__config__'): - self._write_dest(self._task.args['dest'], result['__config__'], - append=self._task.args['append']) - - for key in ['__config__', '__backup__']: - if key in result: - del result[key] + if '__backup__' in result: + del result['__backup__'] return result @@ -75,18 +70,6 @@ class ActionModule(ActionBase): filename = '%s/%s_config.%s' % (backup_path, host, tstamp) open(filename, 'w').write(contents) - def _write_dest(self, path, contents, append=False): - dirpath = os.path.dirname(path) - if not dirpath[0] == '/': - dirpath = self._get_working_path() + dirpath - if not os.path.exists(dirpath): - os.mkdir(dirpath) - if append: - flags = 'a' - else: - flags = 'w' - open(path, flags).write(contents) - def _handle_template(self): src = self._task.args.get('src') working_path = self._get_working_path()