-
Notifications
You must be signed in to change notification settings - Fork 42
Add commit confirmed option to optional_args #126
Comments
On the longer term, we want to add this option directly to the device.open(..., optional_args={'junos_commit_confirmed': True})
device.load_merge_candidate(...)
device.commit() # yes, here I want to be commit confirmed
device.commit() # eeerr... how can I make this one unconfirmed now? Does this make sense to you? |
I was thinking about function scope of this functionality. I'd like to clarify this. If you define confirmed option in For example (logic during def commit_config(self):
"""Commit configuration."""
# confirmed optional args were used
if self.junos_commit_confirmed:
# executing commit with confirm option
self.device.cu.commit(confirm=self.confirm)
if self.junos_commit_wait:
# optional wait time
sleep(int(self.wait))
# if I can connect to device commit will be confirmed
# if not exception is raised and device will perform rollback by itself
self.device.cu.commit()
if not self.config_lock:
self._unlock() I have tested this concept and it seems to be working as expected. If |
I know what you mean. How would you be able distinguish between a commit confirmed and a straight commit over the same session? |
Ah ok, you are right. In this approach, it would be defined per session not per |
Sure @kderynski - commit confirm is undoubtedly useful and I'm pro introducing it. def commit_config(self, **kwargs):
junos_kwargs = {}
if 'confirmed' in kwargs:
junos_kwargs['confirmed'] = kwargs['confirmed']
self.device.cu.commit(junos_kwargs) etc. Same for other features:
The current blocker is the documentation. |
@mirceaulinic definitely, it would be great to have optional arg per method. I've just tried to add functionality without any other changes. Anyway, I'm ready to help with implementation or/and testing when guidelines will be ready :) |
Thanks @kderynski! |
I think this one should be added to the commit method itself. It's probably one of those cases where a slight change in the API makes complete sense but we will have to update all drivers. |
Btw, this will also require an extra method to confirm the operation, so I guess we will need:
|
Yes, that may be true. |
I can confirm that Junos needs normal commit after the confirmed one (also via netconf), so in this case, only |
I'd prefer to have two different methods even if the second one calls the first one with |
Yes, I agree with @dbarrosop's arguments. Makes sense to do it that way! |
Tracked in #128 |
Can we add
commit confirmed
option tooptional_args
? It may be useful in some cases and it is easy to implement. I think only junos supports real commit confirmed functionality so I assume it would be better to implement it as local optional argument.Example implementation:
Two optional arguments added to driver's init function:
and little change in commit method:
Does it make sense? :)
The text was updated successfully, but these errors were encountered: