-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Bug fixes in Junos-related components #55824
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
Conversation
Fixes multiple bugs found by test team
Fixes multiple PRs raise by test team
@vnitinv Getting some help here, but wanted you to know I am working on this. thank you! |
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.
Also need to now use pre-commit and black for PR submissions. They will be run as part of the PR test etc. but good to catch issues beforehand. Check https://github.com/saltstack/salt-enhancement-proposals/blob/master/accepted/0015-black.md where it was discussed.
Apart from changing published interfaces it looks good, published interfaces have to go through a deprecation cycle (used to be two major releases) if the changes are not backwards compatible, that is, can extend them, but should not affect existing parameters.
salt/states/junos.py
Outdated
@@ -33,16 +33,15 @@ def wrapper(*args, **kwargs): | |||
|
|||
|
|||
@resultdecorator | |||
def rpc(name, dest=None, format="xml", args=None, **kwargs): | |||
def rpc(name, **kwargs): |
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.
changing an interface for a function which has been published without a deprecation cycle having been done is not allowed
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.
Salt initially made changes in Junos-salt modules 93ee5ee#diff-15ad308a12ea5b6d5188dd4a94eab4a0R490 93ee5ee#diff-15ad308a12ea5b6d5188dd4a94eab4a0R400. This commit caused all our state module to break Juniper#77.
@dmurphy18 Hi David, The issue was caused as salt changed positional arguments(*args) in our modules function definition to **kwargs. But, the state modules were not modified in those commit. we had changed it to **kwargs to keep it in line with changes done by salt.
Also we have neither changes any function name of removed any parameters, just that they are consumed via **kwargs.
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.
@vnitinv I have checked back as far as 2017.7.0 and the function signature is the same as that remove by your change. I can understand that this may not line up with Juniper's own functionality but it is an interface which has been published for a few years and it MUST go through a deprecation cycle before it can be changed. And I understand that the kwargs can handle the changes but the positional arguments MUST remain until the deprecation cycle for an interface change has completed. Note can add a new interface and mark the old interface for deprecation. Existing customers cannot have the rug pulled out from underneath them without time to adjust.
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.
@dmurphy18 I have reverted to old function definition itself.
salt/modules/junos.py
Outdated
@@ -149,7 +160,7 @@ def facts(): | |||
|
|||
|
|||
@timeoutDecorator | |||
def rpc(cmd=None, dest=None, **kwargs): | |||
def rpc(cmd=None, **kwargs): |
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.
changing an interface for a function which has been published without a deprecation cycle having been done is not allowed
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.
same as above
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.
see reply for salt/states/junos.py about deprecation cycle and changing interfaces
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.
@dmurphy18 I have reverted to old code itself.
salt/states/junos.py
Outdated
@@ -158,15 +152,14 @@ def commit(name, **kwargs): | |||
|
|||
|
|||
@resultdecorator | |||
def rollback(name, id, **kwargs): | |||
def rollback(name, **kwargs): |
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.
Changing an interface for a function which has been published without a deprecation cycle having been done is not allowed
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.
same as above
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.
see reply for salt/states/junos.py about deprecation cycle and changing interfaces
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.
@dmurphy18 I have reverted to old code itself.
salt/states/junos.py
Outdated
return ret | ||
|
||
|
||
@resultdecorator | ||
def diff(name, d_id): | ||
def diff(name, **kwargs): |
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.
Changing an interface for a function which has been published without a deprecation cycle having been done is not allowed. You could extend the interface
def diff(name, d_id, **kwargs)
and do a versionadded, but the interface has to be backwards compatible unless a deprecation cycle is performed
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.
same as above, also to add
For diff, the documentation clearly stated that it expects "id" as the parameter name but the name of the argument was "d_id". This is a bug and we don't see a reason to support "d_id". Also, this will go inline to changes done at 93ee5ee#diff-15ad308a12ea5b6d5188dd4a94eab4a0R490
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.
see reply for salt/states/junos.py about deprecation cycle and changing interfaces
The label of a positional argument doesn't really matter here compared to a documentation typo/error, but the positional argument is required otherwise the interface is changing without a deprecation cycle for the interface
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.
@dmurphy18 I have reverted to the old code function definition itself.
Used pre-commit tools and also done suggested changes like a single quote to double. |
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.
Interfaces cannot change without deprecation cycles, new interfaces can be added to address desired changes and the old interfaces marked for deprecation, which typically are removed after two major release cycles. Existing customers cannot have interfaces changes without time to accommodate them.
salt/states/junos.py
Outdated
@@ -158,15 +152,14 @@ def commit(name, **kwargs): | |||
|
|||
|
|||
@resultdecorator | |||
def rollback(name, id, **kwargs): | |||
def rollback(name, **kwargs): |
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.
see reply for salt/states/junos.py about deprecation cycle and changing interfaces
salt/states/junos.py
Outdated
return ret | ||
|
||
|
||
@resultdecorator | ||
def diff(name, d_id): | ||
def diff(name, **kwargs): |
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.
see reply for salt/states/junos.py about deprecation cycle and changing interfaces
The label of a positional argument doesn't really matter here compared to a documentation typo/error, but the positional argument is required otherwise the interface is changing without a deprecation cycle for the interface
@dmurphy18 Check if the changes are good now? |
Hi @sagetherage @cro @dmurphy18, Please help in getting this to closure. We want this to be part of Sodium release. Let us know if anything is to be done from our side. |
I have followed up internally as well @vnitinv with David Murphy and he will respond by no later than end of day, Monday 2020-04-27, he may respond sooner. |
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.
Apart from adding versionchanged for 'def diff' for the new extra kwargs, everything looks good, review wise.
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 work
@vnitinv Some failing tests that need to be fixed before can merge |
@dmurphy18 I have fixed pre-commit failures. For ci/py3/macosxmojave looks like there is something that needs to be done from salt backend. Check the existing issue related to enum failure of Mac. #56603 |
What does this PR do?
Multiple bug fixes were done for Junos-related components in salt.
What issues does this PR fix or reference?
Tests written?
Yes