mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
removes methods to write to dest from net_config
This commit is contained in:
parent
c4e2c0f487
commit
e4b3032231
1 changed files with 2 additions and 19 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue