Repository navigation
Conversation
Fix issues related to timeout decorator breaking when dev_timeout or timeout variable is a none int. Merged the timeout_decorator and timeout_decorator_cleankwargs
Author
|
Tests and documentation is already correct for these fixes therefor no new tests or docs. |
twangboy
previously approved these changes
Mar 7, 2023
Author
|
Pinging this |
s0undt3ch
suggested changes
Apr 27, 2023
Comment on lines
+188
to
+189
| except: | ||
| raise |
Contributor
There was a problem hiding this comment.
Suggested change
| except: | |
| raise |
Don't catch exceptions just to raise them afterwards without doing anything with that information.
Author
There was a problem hiding this comment.
It was done like that before therefor I keept the same functionality.
Contributor
s0undt3ch
suggested changes
Apr 28, 2023
Comment on lines
+188
to
+189
| except: | ||
| raise |
Contributor
Removed except: raise block since it doesn't do anything. Keeping the finalyl since it adds back the kwargs that is needed and sets the timeout to the old timeout.
Author
|
Removed the except: raise part but kept the finally |
s0undt3ch
suggested changes
Apr 30, 2023
s0undt3ch
left a comment
Contributor
There was a problem hiding this comment.
We also need test coverage, the bare minimum is unit testing the decorator code path.
| @wraps(function) | ||
| def wrapper(*args, **kwargs): | ||
| timeout_changed = False | ||
| old_kwargs = kwargs |
Contributor
There was a problem hiding this comment.
You actually need to create a copy, most likely, even a copy.deepcopy of the dictionary, otherwise changing kwargs will also change old_kwargs
2 of 3 tasks
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removed dev_timeout from junos_cli which passes None as a variable. max() does not like None variable which makes this input mandatory when using junos_cli in salt.
Did also merge the __timeout_decorator and __timeout_decorator_cleanargs into one with comments and more readable code.
This sovles the issue with problems running junos_cli and other commands where the __pubs are exposed and max() is breaking the function since dev_timeout is provided all the time (as None) even if not provided in cli.
What does this PR do?
Fix issues related to napalm junos_cli and other methods.
What issues does this PR fix or reference?
Fixes: #63599 #58108
Previous Behavior
junos_cli was breaking due to timeout_decorator was provided with value None from the dev_timeout variable used in max()
New Behavior
Working
Merge requirements satisfied?
Commits signed with GPG?
No