It's just MHO. But if *configuration_changed* returns 0 at next iteration, then the device will never update. In most cases with default testing procedure it works. Except one: if for some reasons the controller doesn't return status 200OK for checksum request (bad channel, connection gap... etc) then the device will be stuck. In other words, if there is the controller's temporal problem or connection problem but new configuration is correct. In case of using custom test script, there are may exist other metrics that can lead to a "failed test". But config will be fine. We added to agent script next logic: we save last successful checksum and compare this one with controller's checksum at *configuration_changed*(). Yep, it leads to applying and testing even bad configuration each iteration but it's more failsafe.
пт, 21 сент. 2018 г. в 20:15, Federico Capoano <[email protected]>: > Your understanding looks correct to me. > > Fed > > On Fri, Sep 21, 2018 at 2:21 PM Артур Скок <[email protected]> wrote: > >> Thanks, I got it. >> We faced a situation when agent didn't update configuration. I've found >> cause here: >> [image: image.png] >> This statement always returns True: ($CURRENT_CHECKSUM != >> $REMOTE_CHECKSUM). >> When I deleted "/tmp/openwisp/checksum" then config updated (here I >> confused with variables... yes, it's not $TEST_CHECKSUM). >> As I understand the current algorithm of agent one cycle iteration: >> 1. get checksum from /tmp/openwisp/checksum to variable $CURRENT_CHECKSUM >> 2. request checksum from controller >> 3. save controller's checksum response to /tmp/openwisp/checksum >> (checksum overwriting) >> 4. get checksum from /tmp/openwisp/checksum to variable $REMOTE_CHECKSUM >> 5.1. $CURRENT_CHECKSUM == $REMOTE_CHECKSUM : OK, next iteration of cycle >> 5.2. $CURRENT_CHECKSUM != $REMOTE_CHECKSUM: need to update configuration >> 6. apply configuration >> 7. test if we can reach controller and get test checksum >> 7.1. the controller was reached: OK >> 7.2. the controller wasn't reached: restore a backup, but checksum at >> /tmp/openwisp/checksum already had overwritten. *Next >> configuration_changed returns 0*. >> >> пт, 21 сент. 2018 г. в 15:18, Federico Capoano < >> [email protected]>: >> >>> See here: >>> >>> CONFIGURATION_CHECKSUM="$WORKING_DIR/checksum" >>> TEST_CHECKSUM="$WORKING_DIR/test_checksum" >>> >>> TEST_CHECKSUM is not the same checksum used to understand when it's time >>> to download a new config. >>> The removal of the test checksum is done just to keep the in-memory >>> filesystem in /tmp clean. >>> Moreover, If your custom script does not download the checksum but >>> performs other checks it won't need to remove it. >>> >>> I hope this clarifies. >>> Thanks >>> Fed >>> >>> >>> On Thursday, September 20, 2018 at 10:28:16 PM UTC+2, BlancLoup wrote: >>>> >>>> Hi. >>>> When we use custom test script instead perform_default_test() we must >>>> set mandatory action: remove last checksum at /tmp/openwisp/checksum. >>>> Default test function preform it at 383 line. >>>> Otherwise agent will never update again (though we can change device >>>> configuration at controller). >>>> In my mind it's part of common logic that independent from test >>>> script/function. >>>> "rm $TEST_CHECKSUM" need to be setted at 352 line. >>>> >>>> >>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "OpenWISP" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "OpenWISP" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to the Google Groups > "OpenWISP" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "OpenWISP" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
