Bizarre Issue with External Scripts

Ralf Sawazki rsawazki at gobcn.ca
Fri Jul 28 15:17:58 EDT 2017


Here's a better explanation of the issue:

I create a provision, in this provision it calls an external script,
passing 2 args, serial and mac.

My external script, simply takes the two args it got, and returns them in
the callback within this structure: result = {username: arg[0], password:
arg[1]}. So it would return the "result" object

Now the provision takes that result object, and sets the pppoe username to
result.username, and password to result.password.

All of the above works fine.

The issue begins when I try to edit my external script. If I make a change,
let's say, rather then return result as it is above, I return some string
literals: result = {username: "user", password: "pass"}.

Now when the provision runs, it will NOT set the pppoe username and
password to "user" and "pass", it will set them to the arguments passed in
from the provision: arg[0], and arg[1], so the serial and mac address.

In this situation, it would seem that my external script is being cached
the first time the provision is run.

I can resolve this issue by renaming my external script with each change,
and changing the ext() function to target the new filename.

So, to me, it looks like either GenieACS, or Node.js is caching my external
script based off of the timestamp of the GenieACS provision, and not
checking the timestamp of the external script.

Hope that helps.

On Fri, Jul 28, 2017 at 1:56 PM, Ralf Sawazki <rsawazki at gobcn.ca> wrote:

> Because when I make changes to my script, those changes aren't reflected
> in what is actually happening. I was changing the name for testing
> purposes. Because even when I changed the name, so theoretically genieacs
> shouldn't be able to find it, genieacs wouldn't show any faults saying the
> file is not found, it would keep running the script as if I had never
> changed the name
>
> On Fri, Jul 28, 2017 at 1:40 PM, Dan Morphis <dan at milkcarton.com> wrote:
>
>> I'm not sure I understand your issue. If you are making changes to your
>> ext script, why are you copying the file to _bak? Why not just edit the one
>> file?
>>
>> -dan
>>
>> On Fri, Jul 28, 2017 at 9:56 AM, Ralf Sawazki <rsawazki at gobcn.ca> wrote:
>>
>>> Alright, that fixed it. But I believe i'm still having a caching issue.
>>>
>>> When I'm using the external script, no matter what changes I make to it,
>>> it will always run an older version of it that doesn't exist.
>>>
>>> If my genieacs provision says:
>>> let test = ext("getPPPoE","b", serial, mac);
>>>
>>> and I change the name of the file getPPPoE to getPPPoE_BAK for example,
>>> the provision will keep running and not show any faults.
>>>
>>> Now, If i change my genieacs provision to say:
>>> let test = ext("getPPPoE_BAK","b", serial, mac);
>>>
>>> It will start running my new script with no issue.
>>>
>>> So is the solution to rename my file everytime I make a change, and
>>> reflect that rename in the file name in the provision?
>>>
>>> If, in the first situation where the provision is running a script that
>>> doesn't exist, I manually change the username in the router, the provision
>>> will no longer update the username.
>>>
>>> Thanks for the help
>>>
>>> On Thu, Jul 27, 2017 at 6:15 PM, Dan Morphis <dan at milkcarton.com> wrote:
>>>
>>>> restart the cwmp.
>>>>
>>>> On Thu, Jul 27, 2017 at 11:40 AM, Ralf Sawazki <rsawazki at gobcn.ca>
>>>> wrote:
>>>>
>>>>> Update:
>>>>>
>>>>> I tried to rename my external script so that the provision couldn't
>>>>> find it, and it is still swapping between those two values.
>>>>>
>>>>> On Thu, Jul 27, 2017 at 2:18 PM, Ralf Sawazki <rsawazki at gobcn.ca>
>>>>> wrote:
>>>>>
>>>>>> Hello all,
>>>>>>
>>>>>> Images <http://imgur.com/a/BtB3U>
>>>>>>
>>>>>> The images above show what I see.
>>>>>>
>>>>>> The situation is that due to caching, seemingly, genieacs is
>>>>>> alternating between my current external script, and an older version that
>>>>>> no longer exists. I have the tr069 periodic inform interval at 5 seconds
>>>>>> for testing atm, and every 5 seconds, it swaps between the expected
>>>>>> information of the serial and mac, and the old output of literally arg[0]
>>>>>> and arg[1].
>>>>>>
>>>>>> I'm completely stumped as to what's going on.
>>>>>> --
>>>>>> Ralf Sawazki
>>>>>> 1 (204) 594-2567 <%28204%29%20594-2566>
>>>>>> Broadband Communications North Inc.
>>>>>> 26-30 Fort Street
>>>>>> Winnipeg. MB
>>>>>> R3C 1C4
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Ralf Sawazki
>>>>> 1 (204) 594-2567 <%28204%29%20594-2566>
>>>>> Broadband Communications North Inc.
>>>>> 26-30 Fort Street
>>>>> Winnipeg. MB
>>>>> R3C 1C4
>>>>>
>>>>> _______________________________________________
>>>>> 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
>>>>
>>>>
>>>
>>>
>>> --
>>> Ralf Sawazki
>>> 1 (204) 594-2567 <%28204%29%20594-2566>
>>> Broadband Communications North Inc.
>>> 26-30 Fort Street
>>> Winnipeg. MB
>>> R3C 1C4
>>>
>>> _______________________________________________
>>> 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
>>
>>
>
>
> --
> Ralf Sawazki
> 1 (204) 594-2567 <%28204%29%20594-2566>
> Broadband Communications North Inc.
> 26-30 Fort Street
> Winnipeg. MB
> R3C 1C4
>



-- 
Ralf Sawazki
1 (204) 594-2567 <%28204%29%20594-2566>
Broadband Communications North Inc.
26-30 Fort Street
Winnipeg. MB
R3C 1C4
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.genieacs.com/pipermail/users/attachments/20170728/555c0daf/attachment-0001.html>


More information about the Users mailing list