-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add bond interfaces supporting #37
base: devel
Are you sure you want to change the base?
Conversation
ObjatieGroba
commented
Mar 9, 2021
•
edited
Loading
edited
- Reformat keys with lower case. Replace '_' with '-'.
- Support multiword values on parsing
- Bonding support
- Add bond attributes checking
- Add bond settings validation
- Add bond configuration tests
a6725df
to
03bc049
Compare
debinterface/interfacesReader.py
Outdated
sline = [x.strip() for x in line.split()] | ||
sline = [x.strip() for x in line.split(None, 1)] | ||
|
||
sline[0] = sline[0].lower().replace('_', '-') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no standard way to write such attributes.
It can be lower or upper case.
'-' and '_' are equal in this context.
Suggest to use lower-case
for keys and some attribute values
Let's release |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i know nothing about bonds, I trust you on the business logic !
debinterface/interfaces.py
Outdated
|
||
return self.addAdapter({"name": name, 'bond-mode': mode, 'bond-slaves': ' '.join(slaves)}) | ||
|
||
def validateBondSettings(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would move that method into NetworkAdapterValidation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to the new File infaterfacesValidation
to class InterfacesValidator
key (str): the option name | ||
val (any): the option value | ||
""" | ||
key = key.lower().replace('_', '-') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure about that one ? It may break a keyword ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should not break keyword. As NetworkManager sources says:
Normalize keys. Convert '_' to '-', as ifupdown accepts both variants.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sources of ifupdown cast all attr names into UPPER_SNAKE_CASE and accept any variants - lower or upper, '-' or '_' before writing it into OS
https://salsa.debian.org/debian/ifupdown/-/blob/master/execute.c#L41
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But there are some options that should be this-case
and neither another cases:
https://salsa.debian.org/debian/ifupdown/-/blob/master/config.c#L733
That's why I suggest to do such transformation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanations !
6fc49bf
to
99bbe55
Compare
…nclosed resources