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

nat64: T6627: call check_kmod within standard config function #3927

Merged
merged 1 commit into from
Aug 2, 2024

Conversation

jestabro
Copy link
Contributor

@jestabro jestabro commented Aug 1, 2024

Change Summary

The config mode script nat64.py calls the modprobe utility check_kmod outside of the standard functions, leading to an OSError when run under configd. Current behavior of configd will re-run the script within the CLI context, leading to config and smoketest success; as that behavior will be changed in the future to accommodate all scripts running within the configd context (T6608), correct now.

There are several other config scripts that use this pattern, which will be all changed in a separate PR. The nat64.py script deserved special attention as it provides an example of state configuration informing the syntax verification stage, which should be kept in mind as we move to distinguishing syntax verification from system state verification.

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

Proposed changes

How to test

Confirmation provided in task. Success in smoketest and journalctl output, below.

Smoketest result

vyos@vyos:/usr/libexec/vyos/tests/smoke/cli$ ./test_nat64.py
test_snat64 (__main__.TestNAT64.test_snat64) ... ok

----------------------------------------------------------------------
Ran 1 test in 3.788s

OK
vyos@vyos:/usr/libexec/vyos/tests/smoke/cli$ journalctl -u vyos-configd --no-pager

...
Aug 01 16:43:35 vyos vyos-configd[4299]: Received message: {"type": "node", "last": true, "data": "/usr/libexec/vyos/conf_mode/nat64.py"}
...
Aug 01 16:43:35 vyos vyos-configd[4299]: Sending response 1
...

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

@jestabro jestabro self-assigned this Aug 1, 2024
@jestabro jestabro requested a review from a team as a code owner August 1, 2024 17:19
Copy link

github-actions bot commented Aug 1, 2024

👍
No issues in PR Title / Commit Title

Copy link

github-actions bot commented Aug 1, 2024


warning: Unused Warning imported from vyos.base in src/conf_mode/vpn_ipsec.py:28.

if not nat64:
# no need to verify the CLI as nat64 is going to be deactivated
unload_kmod(['jool'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm quite uneasy about system state changes in verify(). I'm inclined to think that verify() should never include any logic except config verification. Do you think it's feasible to move this to apply()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed: though I consider the real problem with the logic of this script to be the need to modprobe in the verify() stage, no need to make it worse. Moved to apply().

Functions called from config scripts outside of the standard functions
get_config/verify/generate/apply will not be called when run under
configd. Move as appropriate for the general config script structure and
the specific script requirements.
@dmbaturin dmbaturin merged commit 0f66f4a into vyos:current Aug 2, 2024
9 of 10 checks passed
@jestabro
Copy link
Contributor Author

jestabro commented Aug 2, 2024

@Mergifyio backport circinus

Copy link

mergify bot commented Aug 2, 2024

backport circinus

✅ Backports have been created

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants