Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

op-mode: T5514: Allow safe reboots to config defaults when config.boot is deleted (backport #3654) #3695

Merged
merged 1 commit into from
Jun 22, 2024

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Jun 21, 2024

Change Summary

  • Added flag to vyos.config_mgmt.unsaved_commits() that will tolerate missing config.boot for specific circumstances
  • Shutdown/reboot uses this flag; config will regenerate from defaults after a reboot

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

Related PR(s)

Component(s) name

  • op-mode

Proposed changes

I considered regenerating config.boot from defaults on the spot; that will rarely work well. There may also be situations where unsaved_commits() is expected to fail.

This fix is for a specific situation:

  • User has deleted /config/config.boot
  • User wants to reboot back to a default config, cleanly
  • User has not deleted anything else on the system - this is not a full factory reset or intended to be such
  • User will be safely warned that there is unsaved configuration via the normal prompts
    • Breaking out at this point and issuing a save works fine
  • Following a reboot, the default config.boot regenerates cleanly

How to test

vyos@TEST-VYOS-LEFT:~$ rm /config/config.boot
vyos@TEST-VYOS-LEFT:~$ reboot
Warning: there are unsaved configuration changes!
Run 'save' command if you do not want to lose those changes after reboot/shutdown.
Are you sure you want to reboot this system? [y/N] y

[...1 reboot & re-IP later...]

vyos@vyos:~$ 

Smoketest result

No smoketests exist for opmode, but tried to double check over config functions:

vyos@TEST-VYOS-LEFT:~$ python3 /usr/libexec/vyos/tests/smoke/cli/test_configd_inspect.py 
test_config_modification (__main__.TestConfigdInclude.test_config_modification) ... ok
test_file_instance (__main__.TestConfigdInclude.test_file_instance) ... ok
test_function_instance (__main__.TestConfigdInclude.test_function_instance) ... ok
test_signatures (__main__.TestConfigdInclude.test_signatures) ... ok

----------------------------------------------------------------------
Ran 4 tests in 0.569s

OK
vyos@TEST-VYOS-LEFT:~$ python3 /usr/libexec/vyos/tests/smoke/cli/test_configd_init.py 
test_configd_init (__main__.TestConfigdInit.test_configd_init) ... ok

----------------------------------------------------------------------
Ran 1 test in 0.123s

OK
vyos@TEST-VYOS-LEFT:~$ python3 /usr/libexec/vyos/tests/smoke/system/test_config_mount.py 
test_config_dir (__main__.TestConfigDir.test_config_dir) ... ok

----------------------------------------------------------------------
Ran 1 test in 0.000s

OK

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

This is an automatic backport of pull request #3654 done by [Mergify](https://mergify.com).

…t is deleted

* Added flag to vyos.config_mgmt.unsaved_commits() that will tolerate missing config.boot for specific circumstances
* Shutdown/reboot uses this flag; config will regenerate from defaults after a reboot

(cherry picked from commit 8281383)
@mergify mergify bot requested a review from a team as a code owner June 21, 2024 02:48
@mergify mergify bot requested review from dmbaturin, sarthurdev, zdc, jestabro, sever-sever and c-po and removed request for a team June 21, 2024 02:48
@github-actions github-actions bot added the sagitta VyOS 1.4 LTS label Jun 21, 2024
Copy link

👍
No issues in PR Title / Commit Title

@dmbaturin dmbaturin merged commit f9c45bb into sagitta Jun 22, 2024
8 checks passed
@mergify mergify bot deleted the mergify/bp/sagitta/pr-3654 branch June 22, 2024 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sagitta VyOS 1.4 LTS
4 participants