aristanetworks / go-cvprac

BSD 3-Clause "New" or "Revised" License
4 stars 10 forks source link

`ApplyConfigletToDevice` does not create TempAction if configlet is already on device. #73

Open hansbogert opened 3 years ago

hansbogert commented 3 years ago

IIUC, ApplyConfigletToDevice does two things:

However this function does not create a tempaction when the configlet is already on the device. In fact, with the current functions in go-cvprac, I have no idea how to create a tempaction now in the scenario that a device already holds a configlet, but does not have an accompanying tempaction yet.

Note that this behaviour does not seem to be in the Python version of cvprac.

cheynearista commented 3 years ago

@hansbogert If the configlet exists, then you should be able to use UpdateConfigletWaitForTask() which will update the configlet and create a task if there is an actual change in the configuration.

hansbogert commented 3 years ago

I see, but in my case there isn't even an update to the configlet. Imo, the semantics of the function are wrong, and I think the python version got it right.

hansbogert commented 3 years ago

I probably should've stipulated this in the OP, but the situation is as described plus,

the running configuration differs from the designed configuration.

cheynearista commented 3 years ago

Can you explain more on how the python version got it right? We try to have parity between the python and golang libraries as best we can.

hansbogert commented 3 years ago

In the go version you exit if the action var is false, no TempAction will be created

In the python version, there is no similar construct and the TempAction is made unconditionally. Which makes sense in my exact situation, when a configlet is added to a device, but there isn't an accompanying TempAction yet.

I think the go version is trying to prematurely optimize in this case.