-
Notifications
You must be signed in to change notification settings - Fork 77
Adding a new feature to use commit timer #416
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
base: main
Are you sure you want to change the base?
Adding a new feature to use commit timer #416
Conversation
Whall/commit timer
Enforcing commit timer "0 < value < 24 hours"
| commit=True, | ||
| replace=None, | ||
| comment=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.
my only concern around this change is the fact that the only keyword argument that exists is timer - and i think i would rather refactor all the calls to edit_config rather than introduce kwargs to this function.
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 agree it's a bit ugly, but if we change the interface and deviate from CliconfBase, then pylint fails. Not sure if the object instance has any state that contains the timer details?
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 asked @Qalthos on Slack and they replied with a bit of insight:
https://ansiblenetwork.slack.com/archives/CEXQ0U2RH/p1689792762886269
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.
Looks like we might be able to do this in edit_config
timer = self.get_option("timer")
But not sure how to test this specific code path.
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.
ok, I will try out that API call and make a PR to update it, if successful
| diff_ignore_lines=dict(type="list", elements="str"), | ||
| running_config=dict(aliases=["config"]), | ||
| intended_config=dict(), | ||
| timer=dict(), |
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.
this needs a type definition, and if required default value.
timer=dict(type="str" default="")
| try: | ||
| response = conn.edit_config(commands, commit, replace) | ||
| timer = parse_timer(self._module) | ||
| response = conn.edit_config(commands, commit, replace, None, timer) |
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.
| response = conn.edit_config(commands, commit, replace, None, timer) | |
| response = conn.edit_config(commands, commit, replace,None, timer=timer) |
| return json.loads(capabilities) | ||
|
|
||
|
|
||
| def parse_timer(module): |
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.
Better place for this would be utils.
|
@veyloster thanks for the work on this feature, I would like to bring more inputs to this, |
|
@rohitthakur2590 Is there anything I can do to help get this PR back on track? I am using @veyloster 's fork without issues (though I admit, I am only using the |
|
Hello @rohitthakur2590, I agree, we are also looking for this kind of functionality. Unfortunately, I don't have the skills to be able to help technically. It would help to be able to deploy. I also think this is an important feature of the module. |
@veyloster @pixelrebel @reymonlu Thank you for your patience and all the support on this. We’ve included this work in our upcoming sprint, though there may be some changes to the approach as we refine the solution. @Ruchip16 will be leading the reviews and driving further improvements. |
Hello, That's great news. Thank you for taking this into consideration. Thank you. |
21e79d1 to
b14927c
Compare
5381d78 to
c10d2aa
Compare
for more information, see https://pre-commit.ci
|
putting this PR for hold now as it needs some api changes in netcommon, its giving profile required error and some other errors in |
|



SUMMARY
This is about adding a new feature to use commit timer when deploying new config.
Right now there's no option to use it and this is a good mechanism to rollback if a bad configuration is pushed.
ISSUE TYPE
ADDITIONAL INFORMATION
Adding a new timer field in the eos_config module which let you set how long you want it to be (Ex: 1m, 30s ...)
You then need to combine this with another task to commit the ansible session.
Other task can be added in between like doing an ssh reset to make sure the device is still reachable after getting the new config.