Closed privateip closed 6 years ago
Looking good. I assume that you mean
Do we expect that e.g. ACI modules will also move their common library from module_utils/aci.py to module_utils/network/aci.py ?
@dagwieers
Do we expect that e.g. ACI modules will also move their common library from
module_utils/aci.py
tomodule_utils/network/aci.py
?
Answer: No. The new new directory is for code shared by multiple platforms
@dagwieers
Looking good. I assume that you mean Refactor module_utils/netcfg.py into module_utils/network/config.py Refactor module_utils/network_common.py into module_utils/network/common.py
Thanks, corrected in the proposal
Do we expect that e.g. ACI modules will also move their common library from module_utils/aci.py to module_utils/network/aci.py ?
Only if there are things that are truly common across anything network related. For instance, one thing that might common is functions for manipulating IP address information.
+1 to proposal
1) Does 2 weeks include time to write unit tests? Current coverage for the libraries is fairly low, so we will need to write a lot of new unit tests https://codecov.io/gh/ansible/ansible/tree/devel/lib/ansible/module_utils
2) Is this something we plan to do early during 2.5 development to allow partners to update their code to use these newer stable functions?
3) Is there any non-network specific code that is currently in these files that need to be moved else where (not basic.py
), thinking about common filters
I have updated the proposal to include a comment about what type of code should reside in ansible.module_utils.network
.
[edit] Amending this proposal to include a note of clarification. The only code that will live in the newly proposed package would be things that are truly platform agnostic and shareable across any and all network modules. This means there should be no platform specific code in this package
Does 2 weeks include time to write unit tests? Current coverage for the libraries is fairly low, so we will need to write a lot of new unit tests https://codecov.io/gh/ansible/ansible/tree/devel/lib/ansible/module_utils
Yes
Is this something we plan to do early during 2.5 development to allow partners to update their code to use these newer stable functions?
Yes, I don't anticipate much push back in getting this approved so the implementation can start very early.
Is there any non-network specific code that is currently in these files that need to be moved else where (not basic.py), thinking about common filters
Its a fair ask. I will go investigate and respond here
Will also need documenting in https://github.com/ansible/ansible/blob/devel/docs/docsite/rst/porting_guide_2.5.rst (create developers section under networking)
Will also need documenting in https://github.com/ansible/ansible/blob/devel/docs/docsite/rst/porting_guide_2.5.rst (create developers section under networking)
Proposal updated with comment
Code moved from plugins/filters/network.py will need to be relicensed.
[edit] relicense code from filter to module_utils moving from GPL to BSD
Proposal updated with comment about re-licensing
This seems like a good long term move, but in terms of priorities where does this fit? To me there are more pressing issues.
Ken, let's collect a list of stuff that people think is important on the Wiki at: https://github.com/ansible/community/wiki/Network:Core-community-plan
Having an overview of what people think is needed will help in structuring possible areas of attention and is helpful even for new or existing work. For the Windows Working Group this really helped solve some misconceptions, find areas that need improvement (docs, community), and bring in new ideas.
That said, people are always free to work on what they like or need themselves. It helps if we have a consensus of what we want, and how to get there. And the more people joining that conversation, the better the result.
For Windows we started off using Etherpad, which is very good for collaborating on content, but very bad for synthesizing that information. So we ended up moving everything into the Wiki. Maybe we could do the same for the Network WG ?
The Github Wiki is very (very, very) bad at concurrent access so probably Etherpad is best to start from.
Agreed, I think @gundalow was collecting all of our initial comments. (Correct me if I am wrong)
I thought that was more about how the Network WG could be improved.
@itdependsnetworks I was mainly collecting feedback around the Working Group process, no about specific development tasks.
approved to be implemented in ansible networking irc meeting
So, there's an argument wrt. if module_utils/network/ is to be used for all network-related libraries or only the generic libraries. Since the name is quite generic "network" and we have a lot of vendor-specific libraries in module_utils/ it is probably wise to have a similar structure in module_utils/ as we already have established in modules/ which means avi.py would live in module_utils/network/.
Holding this for one more week before finalizing to address @dagwieers comments. Original proposal is to create a package that does not include platform specific code but only common shared code for network modules.
Idea to change the package name to one of the following:
ansible.module_utils.network_common
ansible.module_utils.network.common
ansible.module_utils.network.shared
Amendment on the table to create a structure that more reflects the modules/
layout in module_utils/
. Discussion to be added to core irc meeting agenda and hashed out there
After having some one off individual discussions, proposal has been updated to move forward with the following packaging:
ansible.module_utils.network.common
- command shared functionsansible.module_utils.network.{{ platform }}
- where platform is platform specific shared functions@privateip Perfect as that will work much better with how ansibot is designed. With this scheme it will automatic label PRs with files in these directories.
AGREED in Network IRC meeting Wednesday 4th Oct
how does the proposal accommodate cases where the following occurs.
bigip* and bigiq* share code amongst themselves (classes, functions, constants). One does not want to copy the module code from one to the other
Would any of the following be true? (examples are directories unless otherwise specified). Which of the following would be preferred
Case 1 ansible.module_utils.network.bigiq (specific to bigiq) ansible.module_utils.network.bigip (specific to bigip) ansible.module_utils.network.f5 (common for all F5 products)
Case 2 ansible.module_utils.network.f5.bigiq (specific to bigiq) ansible.module_utils.network.f5.bigip (specific to bigip) ansible.module_utils.network.f5.common (common for all F5 products)
Case 3 ansible.module_utils.network.bigiq (specific to bigiq) ansible.module_utils.network.bigip (specific to bigip) ansible.module_utils.network.f5.common (a file, common for all F5 products)
Case 4 ansible.module_utils.network.bigiq (specific to bigiq) ansible.module_utils.network.bigip (specific to bigip) ansible.module_utils.network.f5_utils (a file, common for all F5 products)
Case 2 would be the preferred, imho
Code is complete (thanks @ganeshrn) Only thing left before closing this is to add some details to https://github.com/ansible/ansible/blob/devel/docs/docsite/rst/porting_guide_2.5.rst#networking
For reference, new packages are live and can be found in https://github.com/ansible/ansible/tree/devel/lib/ansible/module_utils/network
Done as part of PR https://github.com/ansible/ansible/pull/33452
Date: 2017/9/21
Motivation
The rapid pace of module development for network modules has amassed a significant amount of technical debt related to the network shared code found in
ansible/module_utils
. This proposal is designed to provide details on creating a stable network package inansible/module_utils/network
and move the current shared network libraries into the new package. Theansible.module_utils.network
package will only contain shared code that is common for all network modules to implement and will be maintained in a stable way moving forward.[edit] Amending this proposal to include a note of clarification. The only code that will live in the newly proposed package would be things that are truly platform agnostic and shareable across any and all network modules. This means there should be no platform specific code in this package
Problems
What problems exist that this proposal will solve?
What problems exist that this proposal will solve?
ansible.module_utils.network
)Solution proposal
In order to solve the problems mentioned above, this proposal will refactor a number of shared functions that currently reside in module_utils. The goal for the refactoring will be to introduce changes only where necessary to complete the refactor. All of the current functions in module_utils will remain and be deprecated per community process so as to provide backwards compatibility.
In order to solve the current problem, the following is proposed:
module_utils/netcfg.py
intomodule_utils/network/config.py
CustomNetworkConfig
module_utils/network_common.py
intomodule_utils/network/common.py
Entity
,EntityCollection
,ComplexDict
,ComplexList
(all can be replaced by subspecs)module_utils/network/parsing.py
module_utils/netcli.py
plugins/filters/network.py
(no change in function this is just moving code around)module_utils/netcfg.py
module_utils/network_common.py
module_utils/network.py
module_utils/netcli.py
module_utils/network
module_utils/network
Performing this work will help to stabilize the common code base used for developing network modules and add the missing test cases. Once completed new changes introduced into
ansible.module_utils.network
will be done to maintain backwards compatibility, keep the package stable and well documented.Dependencies (optional)
Testing (optional)
See comments in proposal around testing
Documentation (optional)
See comments in proposal around documentation
Anything else?