mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
removes automated backup of ios to flash due to errors (#5245)
The feature is extremely unstable right now and decision to pull it out for 2.2. Workaround is to do the same in the playbook
This commit is contained in:
parent
25d00838a9
commit
43e6206559
1 changed files with 0 additions and 20 deletions
|
@ -230,17 +230,6 @@ def get_candidate(module):
|
||||||
candidate.add(module.params['lines'], parents=parents)
|
candidate.add(module.params['lines'], parents=parents)
|
||||||
return candidate
|
return candidate
|
||||||
|
|
||||||
def load_backup(module):
|
|
||||||
try:
|
|
||||||
module.cli(['exit', 'config replace flash:/ansible-rollback force'])
|
|
||||||
except NetworkError:
|
|
||||||
module.fail_json(msg='unable to load backup configuration')
|
|
||||||
|
|
||||||
def backup_config(module):
|
|
||||||
cmd = 'copy running-config flash:/ansible-rollback'
|
|
||||||
cmd = Command(cmd, prompt=re.compile('\? $'), response='\n')
|
|
||||||
module.cli(cmd)
|
|
||||||
|
|
||||||
def run(module, result):
|
def run(module, result):
|
||||||
match = module.params['match']
|
match = module.params['match']
|
||||||
replace = module.params['replace']
|
replace = module.params['replace']
|
||||||
|
@ -268,20 +257,12 @@ def run(module, result):
|
||||||
|
|
||||||
result['updates'] = commands
|
result['updates'] = commands
|
||||||
|
|
||||||
# create a backup copy of the current running-config on
|
|
||||||
# device flash drive
|
|
||||||
backup_config(module)
|
|
||||||
|
|
||||||
# send the configuration commands to the device and merge
|
# send the configuration commands to the device and merge
|
||||||
# them with the current running config
|
# them with the current running config
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
module.config(commands)
|
module.config(commands)
|
||||||
result['changed'] = True
|
result['changed'] = True
|
||||||
|
|
||||||
# remove the backup copy of the running-config since its
|
|
||||||
# no longer needed
|
|
||||||
module.cli('delete /force flash:/ansible-rollback')
|
|
||||||
|
|
||||||
if module.params['save']:
|
if module.params['save']:
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
module.config.save_config()
|
module.config.save_config()
|
||||||
|
@ -340,7 +321,6 @@ def main():
|
||||||
try:
|
try:
|
||||||
run(module, result)
|
run(module, result)
|
||||||
except NetworkError:
|
except NetworkError:
|
||||||
load_backup(module)
|
|
||||||
exc = get_exception()
|
exc = get_exception()
|
||||||
module.fail_json(msg=str(exc))
|
module.fail_json(msg=str(exc))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue