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

Refactoring code to adhere to persistence connection. #44398

Merged
merged 6 commits into from
Aug 29, 2018
Merged

Refactoring code to adhere to persistence connection. #44398

merged 6 commits into from
Aug 29, 2018

Conversation

amuraleedhar
Copy link
Contributor

SUMMARY

In this PR I am moving the code which is in util file cnos.py to respective module code. There was a review comment is this regard that util file is of huge size. This is an effort to reduce the size.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

lib\ansible\modules\network\cnos\cnos_rollback.py
lib\ansible\module_util\network\cnos\cnos.py

ANSIBLE VERSION

ansible 2.7.0.dev0 (devel f9cbdcd) last updated 2018/07/03 14:55:43 (GMT +550)
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /home/ansible/sheru/ansible/lib/ansible
executable location = /home/ansible/sheru/ansible/bin/ansible
python version = 2.7.6 (default, Nov 23 2017, 15:49:48) [GCC 4.8.4]

ADDITIONAL INFORMATION

Unused code in cnos.py is removed. Tested with CNOS Mars switch for SFTP and SCP

@ansibot
Copy link
Contributor

ansibot commented Aug 20, 2018

@ansibot ansibot added affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. core_review In order to be merged, this PR must follow the core review workflow. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. networking Network category support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Aug 20, 2018
@ansibot
Copy link
Contributor

ansibot commented Aug 20, 2018

The test ansible-test sanity --test pylint [explain] failed with 1 error:

lib/ansible/modules/network/cnos/cnos_rollback.py:304:0: trailing-newlines Trailing newlines

The test ansible-test sanity --test pep8 [explain] failed with 1 error:

lib/ansible/modules/network/cnos/cnos_rollback.py:304:1: W391 blank line at end of file

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

lib/ansible/modules/network/cnos/cnos_rollback.py:303:0: E109 Next to last line should be: if __name__ == "__main__":

click here for bot help

@ansibot ansibot added ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. core_review In order to be merged, this PR must follow the core review workflow. and removed core_review In order to be merged, this PR must follow the core review workflow. ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Aug 20, 2018
@@ -183,6 +190,70 @@
from collections import defaultdict


# Utility Method to rollback the running config or start up copnfig
# This method supports only SCP or SFTP or FTP or TFTP
def doConfigRollBack(module, prompt, answer):
Copy link
Member

Choose a reason for hiding this comment

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

It appears this code was originally (in it's refactored form) licensed as BSD. I believe you will need to either include license information for this function stating that this function is still BSD licensed, or get approval from the prior authors of the removed code indicated above, to relicense as GPLv3.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am the only author for the entire solutions for supporting CNOS and ENOS switches on behalf of Lenovo. There has been a review comment from community that the utility file is growing in size which is further affecting its maintainability. So it has been decided to move few util code to module file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please suggest me, what should I do in this regard.

Copy link
Member

Choose a reason for hiding this comment

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

I can see attribution for 2 users, across the code you are removing:

dkasberg - dbb4521
amuraleedhar - ffd701c

I'm an unsure as to whether you are permitted to make a relicensing decision on behalf of dkasberg as a Lenovo employee.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

David Kasberg has retired from Lenovo and is no more in world of coding. We are still very much in contact. Should I contact him for approval?.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi Sivel,
Lenovo Legal team is suggesting to embed BSD License to the snippet that is getting moved from cnos.py. Once OSC team approves the sample code modification I have done, I will make necessary changes here for your approval. May be by Tuesday.

Copy link
Contributor

Choose a reason for hiding this comment

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

@amuraleedhar That sounds good. Can you please get this PR updated do we can merge before community freeze on 30th?

@sivel sivel removed the needs_triage Needs a first human triage before being processed. label Aug 20, 2018
@ansibot
Copy link
Contributor

ansibot commented Aug 23, 2018

Copy link
Contributor

@Qalthos Qalthos left a comment

Choose a reason for hiding this comment

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

The licensing issue aside, this looks fine as far as the refactor is concerned.

else:
transfer_status = "Invalid Protocol option"
output = ''
if(protocol == "tftp" or protocol == "ftp" or
Copy link
Contributor

Choose a reason for hiding this comment

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

If you like, something like this can be redone as if protocol in ('tftp', 'ftp', 'sftp', 'scp'):

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I will change that. I have requested for a mail from legal department. They are yet to respond. Will do this in meantime

@amuraleedhar
Copy link
Contributor Author

amuraleedhar commented Aug 28, 2018 via email

@Qalthos
Copy link
Contributor

Qalthos commented Aug 29, 2018

Included for posterity, here are the relevant bits of the response from Lenovo legal forwarded to me:

As to the specific changes identified in PR #44398, based on the review of the newly contributed code to “cnos_rollback.py” file vs. the code currently found with the “cnos.py” file, it is our understanding that, contrary to Anil’s description submitted in the PR, outside of the functional similarity that might exist between both code fragments, there is nothing else in common. Specifically, the code Anil would like to contribute to the “cnos_rollback.py” file is completely different from the code found in the “cnos.py” file. In other words, this is newly written code by Anil.

Furthermore, the work contributed by Anil to the “cnos_rollback.py” under the GPLv3 license and copyrighted to Lenovo, does not represent either directly or in modified form the original copyright material contributed by Dave Kasberg and found in the cnos.py file.

Hence, I would greatly appreciate you accepting/recognizing Anil as the future gatekeeper and contributor to the Ansible project from Lenovo. And, I would also ask, if you can accept Anil’s contributions/changes made to both cnos.py and cnos_rollback.py files.

@Qalthos Qalthos merged commit 822dbe3 into ansible:devel Aug 29, 2018
@ansible ansible locked and limited conversation to collaborators Jul 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. core_review In order to be merged, this PR must follow the core review workflow. module This issue/PR relates to a module. networking Network category support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants