Provisions running twice when GPV/SPV involved.

Dan Morphis dan at milkcarton.com
Wed Sep 6 14:56:02 EDT 2017


Since your doing a download task, it should be possible to use the
timestamp on the Downloads key to figure out if anything has happened
recently. Something like:

let now = Date.now();
let downloads = declare("Downloads", {value: 1});

if (downloads.timestamp - now < (60 * 1000)) {
  //The downloads node has had some action within the past 60 seconds, bail.
  return;
}

On Wed, Sep 6, 2017 at 10:35 AM, Oliver Kraitschy <oliver at okraits.de> wrote:

> Am 06.09.2017 um 20:01 schrieb Dan Morphis:
>
>> You will need to use tags/another mechanism to prevent the script from
>> running multiple times if thats what you need. Provisioning scripts are
>> designed to be run as many times as necessary until no more changes are
>> detected. Is there a reason you don't want the provisioning script run
>> multiple times? Are you changing the PPP password? What I did to work
>> around the password issue is make the acct password deterministic:
>>
>> password = sha1("device-serial:username:secret-code").substring(0,16)
>>
>
> No, I'm calling an external script to create a firmware download task,
> modify the inform interval and create a refreshObject task, via the REST
> API. I also already use a tag to deactivate the script. Via the REST API, I
> can select a firmware file by OUI and ProductClass, which is not possible
> with only a provision.
>
> The problem is that the last step (create tag, change inform interval and
> create refreshObject task) is done twice because the provision and thus the
> extension is run twice.
>
> Greetings,
> Oliver
>
>>
>> On Tue, Sep 5, 2017 at 11:21 PM, Oliver Kraitschy <oliver at okraits.de
>> <mailto:oliver at okraits.de>> wrote:
>>
>>     Am 06.09.2017 08:33, schrieb Oliver Kraitschy:
>>
>>         I'm using an extension to interact with an external system and
>>         want to
>>         pass the DeviceID in the provision to the extension. But that line
>>         above has the effect that the provision (and thus the extension)
>> is
>>         run twice which is not what one would want.
>>
>>
>>     To be precise, the provision is run twice if another preset is
>>     executed at the same time, it seems.
>>
>>     _______________________________________________
>>     Users mailing list
>>     Users at lists.genieacs.com <mailto:Users at lists.genieacs.com>
>>     http://lists.genieacs.com/mailman/listinfo/users
>>     <http://lists.genieacs.com/mailman/listinfo/users>
>>
>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.genieacs.com
>> http://lists.genieacs.com/mailman/listinfo/users
>>
>>
> _______________________________________________
> Users mailing list
> Users at lists.genieacs.com
> http://lists.genieacs.com/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.genieacs.com/pipermail/users/attachments/20170906/87b268f0/attachment.html>


More information about the Users mailing list