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

ATTN: parser: validate lacp-rate properly (LP: #1745648) #324

Merged
merged 1 commit into from
Feb 23, 2023

Conversation

daniloegea
Copy link
Collaborator

@daniloegea daniloegea commented Feb 16, 2023

This field should accept only the values "fast" and "slow". It's documented in the Netplan documentation.

It addresses LP: #1745648

Note: although we have it documented that the expected values are "fast" and "slow", NetworkManager also accepts 1 and 0, respectively, besides the keywords. There is a chance that someone out there is using NetworkManager as renderer and the values as numbers and it is just working fine. Should we handle the case and also accept 1 and 0? In this case, we would simply forward the value to NM and translate it to text before generating the configuration for networkd.

Checklist

  • Runs make check successfully.
  • Retains 100% code coverage (make check-coverage).
  • New/changed keys in YAML format are documented.
  • (Optional) Adds example YAML for new feature.
  • (Optional) Closes an open bug in Launchpad. LP#1745648

@daniloegea

This comment was marked as resolved.

Copy link
Collaborator

@slyon slyon left a comment

Choose a reason for hiding this comment

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

Thanks, this is a simple change and lgtm overall!

BUT: We need to take some special attention, as this is making stricter input validation on parsing the input YAML. So if somebody has a broken configuration currently this change will stop the generate binary to produce any network configuration at bootup, leaving such systems with broken networking on update. That's not good!
I think we have two options to handle this case:

  • SAFE: Downgrade the yaml_error to just a warning, and keep ignoring invalid configuration as we did up to now. Then after some more releases, make it a hard requirement.
  • CLEAN: Make it a hard requirement for the next release (as proposed here). But clearly mark the commit (e.g. using an "ATTN:" prefix), so that when doing backports/SRUs to stable series we can make sure to downgrade the yaml_error to just a warning for stable series.

=> I think I slightly prefer the CLEAN option. WDYT?

1/ We can ignore the ERROR: Program 'pytest-3 pytest3' not found or not executable CodeQL failure, it's already fixed in the main branch

2/ I think we should not implement special handling for NetworkManager's 0/1 fallback. "slow"/"fast" is what our documentation specifies and also what systemd-networkd and NetworkManager expect by default.

3/ A small nitpick is inline, to improve the error message a bit, to provide a solution to the user right away.

src/parse.c Outdated Show resolved Hide resolved
@slyon slyon changed the title parser: validate lacp-rate properly (LP: #1745648) ATTN: parser: validate lacp-rate properly (LP: #1745648) Feb 23, 2023
@slyon slyon added the breaking A breaking change, e.g. stricter input YAML parsing/validation label Feb 23, 2023
This field should accept only the values "fast" and "slow". It's
documented in the Netplan documentation.

It addresses LP: #1745648

Note for backports/SRUs: this change will make invalid values
that were being accepted before to break netplan generate. While we want
this fixed for future releases, this shouldn't be adopted by stable
releases of Ubuntu. The recommended option for backports is to demote
the yaml_error to a simple warning so the user will know that the
configuration needs to be fixed.
@slyon slyon merged commit 748d877 into canonical:main Feb 23, 2023
daniloegea added a commit that referenced this pull request May 17, 2023
This field should accept only the values "fast" and "slow". It's
documented in the Netplan documentation.

It addresses LP: #1745648

Note for backports/SRUs: this change will make invalid values
that were being accepted before to break netplan generate. While we want
this fixed for future releases, this shouldn't be adopted by stable
releases of Ubuntu. The recommended option for backports is to demote
the yaml_error to a simple warning so the user will know that the
configuration needs to be fixed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking A breaking change, e.g. stricter input YAML parsing/validation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants